From b979933c257f6513a3674d23526833113b14484c Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Mar 06 2015 13:46:47 +0000 Subject: dhclient-script: s/addr add/addr replace/ It might happen that the address is already there, in which case we want to update life-times. BZ#1187856#c15 ip addr add = NLM_F_CREATE|NLM_F_EXCL ip addr replace = NLM_F_CREATE|NLM_F_REPLACE ip addr change = NLM_F_REPLACE from linux/netlink.h NLM_F_REPLACE 0x100 /* Override existing */ NLM_F_EXCL 0x200 /* Do not touch, if it exists */ NLM_F_CREATE 0x400 /* Create, if it does not exist */ --- diff --git a/dhclient-script b/dhclient-script index fbf1032..b785d32 100644 --- a/dhclient-script +++ b/dhclient-script @@ -359,7 +359,7 @@ dhconfig() { [ ! "${old_broadcast_address}" = "${new_broadcast_address}" ] || [ ! "${old_routers}" = "${new_routers}" ] || [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ]; then - ip -4 addr add ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface} \ + 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 @@ -497,7 +497,7 @@ dhconfig() { [ -n "${alias_ip_address}" ]; then # Reset the alias address (fix: this should really only do this on changes) ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1 - ip -4 addr add ${alias_ip_address}/${alias_prefix} broadcast ${alias_broadcast_address} dev ${interface} label ${interface}:0 + ip -4 addr replace ${alias_ip_address}/${alias_prefix} broadcast ${alias_broadcast_address} dev ${interface} label ${interface}:0 ip -4 route replace ${alias_ip_address}/32 dev ${interface} fi @@ -554,7 +554,7 @@ dhconfig() { # the addresses in any IAs it receives in the Reply message before # using that address for traffic. add_ipv6_addr_with_DAD() { - ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \ + ip -6 addr replace ${new_ip6_address}/${new_ip6_prefixlen} \ dev ${interface} scope global valid_lft ${new_max_life} \ preferred_lft ${new_preferred_life} @@ -793,7 +793,7 @@ case "${reason}" in remove_old_addr if [ -n "${alias_ip_address}" ]; then - ip -4 addr add ${alias_ip_address}/${alias_prefix} broadcast ${alias_broadcast_address} dev ${interface} label ${interface}:0 + ip -4 addr replace ${alias_ip_address}/${alias_prefix} broadcast ${alias_broadcast_address} dev ${interface} label ${interface}:0 ip -4 route replace ${alias_ip_address}/32 dev ${interface} fi @@ -806,7 +806,7 @@ case "${reason}" in ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1 fi - ip -4 addr add ${new_ip_address}/${new_prefix} \ + 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} set ${new_routers} diff --git a/dhcp.spec b/dhcp.spec index 2e98947..42e3bb9 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -18,7 +18,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.3.1 -Release: 12%{?dist} +Release: 13%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # 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. @@ -614,6 +614,9 @@ done %doc doc/html/ %changelog +* Fri Feb 13 2015 Jiri Popelka - 12:4.3.1-13 +- dhclient-script: s/addr add/addr replace/ + * Tue Feb 03 2015 Jiri Popelka - 12:4.3.1-12 - send unicast request/release via correct interface (#800561, #1177351)