dhclient-script: use 'ip addr replace' for both BOUND & RENEW

amends e79843f28
This commit is contained in:
Jiri Popelka 2015-02-17 16:22:24 +01:00
parent cbf79dcf16
commit 986801e117
2 changed files with 13 additions and 13 deletions

View File

@ -340,6 +340,13 @@ dhconfig() {
flush_dev ${interface} flush_dev ${interface}
fi fi
# make sure the interface is up
ip link set dev ${interface} up
# replace = add if it doesn't exist or override (update lifetimes) if it's there
ip -4 addr replace ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface} \
valid_lft ${new_dhcp_lease_time} preferred_lft ${new_dhcp_lease_time} >/dev/null 2>&1
if [ "${reason}" = "BOUND" ] || [ "${reason}" = "REBOOT" ] || if [ "${reason}" = "BOUND" ] || [ "${reason}" = "REBOOT" ] ||
[ ! "${old_ip_address}" = "${new_ip_address}" ] || [ ! "${old_ip_address}" = "${new_ip_address}" ] ||
[ ! "${old_subnet_mask}" = "${new_subnet_mask}" ] || [ ! "${old_subnet_mask}" = "${new_subnet_mask}" ] ||
@ -347,9 +354,6 @@ dhconfig() {
[ ! "${old_broadcast_address}" = "${new_broadcast_address}" ] || [ ! "${old_broadcast_address}" = "${new_broadcast_address}" ] ||
[ ! "${old_routers}" = "${new_routers}" ] || [ ! "${old_routers}" = "${new_routers}" ] ||
[ ! "${old_interface_mtu}" = "${new_interface_mtu}" ]; then [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ]; then
ip -4 addr replace ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface} \
valid_lft ${new_dhcp_lease_time} preferred_lft ${new_dhcp_lease_time} >/dev/null 2>&1
ip link set dev ${interface} up
# The 576 MTU is only used for X.25 and dialup connections # The 576 MTU is only used for X.25 and dialup connections
# where the admin wants low latency. Such a low MTU can cause # where the admin wants low latency. Such a low MTU can cause
@ -475,10 +479,6 @@ dhconfig() {
fi fi
fi fi
fi fi
else # RENEW||REBIND - only update address lifetimes
ip -4 addr change ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface} \
valid_lft ${new_dhcp_lease_time} preferred_lft ${new_dhcp_lease_time} >/dev/null 2>&1
fi fi
if [ ! "${new_ip_address}" = "${alias_ip_address}" ] && if [ ! "${new_ip_address}" = "${alias_ip_address}" ] &&
@ -600,12 +600,9 @@ dh6config() {
[[ -n "${new_ip6_prefixlen}" ]]; then [[ -n "${new_ip6_prefixlen}" ]]; then
if [[ ! "${new_ip6_address}" = "${old_ip6_address}" ]]; then if [[ ! "${new_ip6_address}" = "${old_ip6_address}" ]]; then
[[ -n "${old_ip6_address}" ]] && ip -6 addr del ${old_ip6_address} dev ${interface} [[ -n "${old_ip6_address}" ]] && ip -6 addr del ${old_ip6_address} dev ${interface}
add_ipv6_addr_with_DAD
else # only update address lifetimes
ip -6 addr change ${new_ip6_address}/${new_ip6_prefixlen} \
dev ${interface} scope global valid_lft ${new_max_life} \
preferred_lft ${new_preferred_life}
fi fi
# call it even if new_ip6_address = old_ip6_address to update lifetimes
add_ipv6_addr_with_DAD
fi fi
if [ ! "${new_dhcp6_name_servers}" = "${old_dhcp6_name_servers}" ] || if [ ! "${new_dhcp6_name_servers}" = "${old_dhcp6_name_servers}" ] ||

View File

@ -18,7 +18,7 @@
Summary: Dynamic host configuration protocol software Summary: Dynamic host configuration protocol software
Name: dhcp Name: dhcp
Version: 4.3.2 Version: 4.3.2
Release: 0.3%{prever}%{?dist} Release: 0.4%{prever}%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and # dcantrell maintaining the package) made incorrect use of the epoch and
# that's why it is at 12 now. It should have never been used, but it was. # that's why it is at 12 now. It should have never been used, but it was.
@ -675,6 +675,9 @@ done
%doc doc/html/ %doc doc/html/
%changelog %changelog
* Tue Feb 17 2015 Jiri Popelka <jpopelka@redhat.com> - 12:4.3.2-0.4b1
- dhclient-script: use 'ip addr replace' for both BOUND & RENEW
* Tue Feb 17 2015 Jiri Popelka <jpopelka@redhat.com> - 12:4.3.2-0.3b1 * Tue Feb 17 2015 Jiri Popelka <jpopelka@redhat.com> - 12:4.3.2-0.3b1
- doc/dhclient/dhclient-enter-hooks for dhclient-script debugging - doc/dhclient/dhclient-enter-hooks for dhclient-script debugging