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 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() { dhconfig() {
if [ -n "${old_ip_address}" ] && [ -n "${alias_ip_address}" ] && if [ -n "${old_ip_address}" ] && [ -n "${alias_ip_address}" ] &&
[ ! "${alias_ip_address}" = "${old_ip_address}" ]; then [ ! "${alias_ip_address}" = "${old_ip_address}" ]; then
@ -265,9 +273,8 @@ dhconfig() {
if [ -n "${old_ip_address}" ] && if [ -n "${old_ip_address}" ] &&
[ ! "${old_ip_address}" = "${new_ip_address}" ]; then [ ! "${old_ip_address}" = "${new_ip_address}" ]; then
# IP address changed. Bringing down the interface will delete all # IP address changed. Delete all routes, and clear the ARP cache.
# routes, and clear the ARP cache. flush_dev ${interface}
ip -4 addr flush dev ${interface} >/dev/null 2>&1
fi fi
if [ "${reason}" = "BOUND" ] || [ "${reason}" = "REBOOT" ] || if [ "${reason}" = "BOUND" ] || [ "${reason}" = "REBOOT" ] ||
@ -710,9 +717,8 @@ case "${reason}" in
fi fi
if [ -n "${old_ip_address}" ]; then if [ -n "${old_ip_address}" ]; then
# Shut down interface, which will delete routes and clear arp cache. # Delete addresses/routes/arp cache.
ip -4 addr flush dev ${interface} >/dev/null 2>&1 flush_dev ${interface}
ip link set ${interface} down
fi fi
if [ -n "${alias_ip_address}" ]; then if [ -n "${alias_ip_address}" ]; then
@ -737,8 +743,7 @@ case "${reason}" in
exit_with_hooks 0 exit_with_hooks 0
fi fi
ip -4 addr flush dev ${interface} >/dev/null 2>&1 flush_dev ${interface}
ip link set ${interface} down
exit_with_hooks 1 exit_with_hooks 1
else else
exit_with_hooks 1 exit_with_hooks 1

View File

@ -7,7 +7,7 @@
Summary: Dynamic host configuration protocol software Summary: Dynamic host configuration protocol software
Name: dhcp Name: dhcp
Version: 4.2.0 Version: 4.2.0
Release: 7%{?dist} Release: 8%{?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.
@ -515,13 +515,17 @@ fi
%attr(0644,root,root) %{_mandir}/man3/omapi.3.gz %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
%changelog %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 - 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) - 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) - 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 * Tue Aug 31 2010 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.0-4