[dhcp] Do not bring the interface down (#574568)
Jiří Popelka
jpopelka at fedoraproject.org
Thu Sep 30 14:06:35 UTC 2010
commit d5a4ff8b46824b29e861970fc865aa5ee52d10a7
Author: Jiri Popelka <jpopelka at redhat.com>
Date: Thu Sep 30 15:49:08 2010 +0200
Do not bring the interface down (#574568)
dhclient-script | 21 +++++++++++++--------
dhcp.spec | 12 ++++++++----
2 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/dhclient-script b/dhclient-script
index 9290d91..1cd4ee0 100755
--- a/dhclient-script
+++ b/dhclient-script
@@ -256,6 +256,14 @@ add_default_gateway() {
return 1
}
+flush_dev() {
+# Instead of bringing the interface down (#574568)
+# explicitly clear the ARP cache and flush all addresses & routes.
+ ip -4 addr flush dev ${1} >/dev/null 2>&1
+ ip -4 route flush dev ${1} >/dev/null 2>&1
+ ip -4 neigh flush dev ${1} >/dev/null 2>&1
+}
+
dhconfig() {
if [ -n "${old_ip_address}" ] && [ -n "${alias_ip_address}" ] &&
[ ! "${alias_ip_address}" = "${old_ip_address}" ]; then
@@ -265,9 +273,8 @@ dhconfig() {
if [ -n "${old_ip_address}" ] &&
[ ! "${old_ip_address}" = "${new_ip_address}" ]; then
- # IP address changed. Bringing down the interface will delete all
- # routes, and clear the ARP cache.
- ip -4 addr flush dev ${interface} >/dev/null 2>&1
+ # IP address changed. Delete all routes, and clear the ARP cache.
+ flush_dev ${interface}
fi
if [ "${reason}" = "BOUND" ] || [ "${reason}" = "REBOOT" ] ||
@@ -710,9 +717,8 @@ case "${reason}" in
fi
if [ -n "${old_ip_address}" ]; then
- # Shut down interface, which will delete routes and clear arp cache.
- ip -4 addr flush dev ${interface} >/dev/null 2>&1
- ip link set ${interface} down
+ # Delete addresses/routes/arp cache.
+ flush_dev ${interface}
fi
if [ -n "${alias_ip_address}" ]; then
@@ -737,8 +743,7 @@ case "${reason}" in
exit_with_hooks 0
fi
- ip -4 addr flush dev ${interface} >/dev/null 2>&1
- ip link set ${interface} down
+ flush_dev ${interface}
exit_with_hooks 1
else
exit_with_hooks 1
diff --git a/dhcp.spec b/dhcp.spec
index c3b4e7c..4a9d798 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -7,7 +7,7 @@
Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.2.0
-Release: 7%{?dist}
+Release: 8%{?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.
@@ -515,13 +515,17 @@ fi
%attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
%changelog
-* Tue Sep 7 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.0-7
+* Thu Sep 30 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.0-8
+- Explicitly clear the ARP cache and flush all addresses & routes
+ instead of bringing the interface down (#574568)
+
+* Tue Sep 07 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.0-7
- Hardening dhcpd/dhcrelay/dhclient by making them PIE & RELRO
-* Thu Sep 2 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.0-6
+* Thu Sep 02 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.0-6
- Another fix for handling time values on 64-bit platforms (#628258)
-* Wed Sep 1 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.0-5
+* Wed Sep 01 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.0-5
- Fix parsing of lease file dates & times on 64-bit platforms (#628258)
* Tue Aug 31 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.0-4
More information about the scm-commits
mailing list