From e79843f2837ed645c03f0f1518e347a9faf6d75c Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Fri, 13 Feb 2015 19:49:39 +0100 Subject: [PATCH] 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 */ --- dhclient-script | 10 +++++----- dhcp.spec | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dhclient-script b/dhclient-script index d1fb166..99d2dbb 100644 --- a/dhclient-script +++ b/dhclient-script @@ -347,7 +347,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 @@ -485,7 +485,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 @@ -541,7 +541,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} @@ -780,7 +780,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 @@ -793,7 +793,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 9d0a9e5..1d17998 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -18,7 +18,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.3.2 -Release: 0.1%{prever}%{?dist} +Release: 0.2%{prever}%{?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. @@ -657,6 +657,9 @@ done %doc doc/html/ %changelog +* Fri Feb 13 2015 Jiri Popelka - 12:4.3.2-0.2b1 +- dhclient-script: s/addr add/addr replace/ + * Sun Feb 08 2015 Jiri Popelka - 12:4.3.2-0.1b1 - 4.3.2b1