Do not bring the interface down (#574568)

This commit is contained in:
Jiri Popelka 2010-09-30 15:49:08 +02:00
parent 1a731ce50f
commit d5a4ff8b46
2 changed files with 21 additions and 12 deletions

View File

@ -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

View File

@ -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@redhat.com> - 12:4.2.0-7
* Thu Sep 30 2010 Jiri Popelka <jpopelka@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@redhat.com> - 12:4.2.0-7
- Hardening dhcpd/dhcrelay/dhclient by making them PIE & RELRO
* Thu Sep 2 2010 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.0-6
* Thu Sep 02 2010 Jiri Popelka <jpopelka@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@redhat.com> - 12:4.2.0-5
* Wed Sep 01 2010 Jiri Popelka <jpopelka@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@redhat.com> - 12:4.2.0-4