dhclient-script: address alias fixes (#741786)

This commit is contained in:
Jiri Popelka 2011-09-29 14:18:16 +02:00
parent 1e3f54a9ec
commit 5c5bbc0b1a
2 changed files with 16 additions and 12 deletions

View File

@ -333,7 +333,7 @@ dhconfig() {
if [ -n "${old_ip_address}" ] && [ -n "${alias_ip_address}" ] &&
[ ! "${alias_ip_address}" = "${old_ip_address}" ]; then
# possible new alias, remove old alias first
ip -4 addr del ${old_ip_address} dev ${interface}:0
ip -4 addr del ${old_ip_address} dev ${interface} label ${interface}:0
fi
if [ -n "${old_ip_address}" ] &&
@ -479,9 +479,10 @@ dhconfig() {
if [ ! "${new_ip_address}" = "${alias_ip_address}" ] &&
[ -n "${alias_ip_address}" ]; then
ip -4 addr flush dev ${interface}:0 >/dev/null 2>&1
ip -4 addr add ${alias_ip_address}/${alias_prefix} dev ${interface}:0
ip -4 route replace ${alias_ip_address}/32 dev ${interface}:0
# 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 route replace ${alias_ip_address}/32 dev ${interface}
fi
make_resolv_conf
@ -648,8 +649,8 @@ case "${reason}" in
PREINIT)
if [ -n "${alias_ip_address}" ]; then
# Bring down alias interface, its routes will disappear too.
ip link set ${interface}:0 down
# Flush alias, its routes will disappear too.
ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1
fi
if [ "${keep_old_ip}" = "yes" ]; then
@ -724,8 +725,8 @@ case "${reason}" in
fi
if [ -n "${alias_ip_address}" ]; then
# Turn off alias interface
ip link set ${interface}:0 down
# Flush alias
ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1
fi
if [ -n "${old_ip_address}" ]; then
@ -734,8 +735,8 @@ case "${reason}" in
fi
if [ -n "${alias_ip_address}" ]; then
ip -4 addr add ${alias_ip_address}/${alias_prefix} dev ${interface}:0
ip -4 route replace ${alias_ip_address}/32 ${interface}:0
ip -4 addr add ${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
exit_with_hooks 0
@ -744,7 +745,7 @@ case "${reason}" in
TIMEOUT)
if [ -n "${new_routers}" ]; then
if [ -n "${alias_ip_address}" ]; then
ip -4 addr flush dev ${interface}:0 >/dev/null 2>&1
ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1
fi
ip -4 addr add ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface}

View File

@ -19,7 +19,7 @@
Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.2.2
Release: 9%{?dist}
Release: 10%{?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 @@ fi
%{_initddir}/dhcrelay
%changelog
* Thu Sep 29 2011 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.2-10
- dhclient-script: address alias handling fixes from Scott Shambarger (#741786)
* Thu Sep 22 2011 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.2-9
- dhclient-script: do not backup&restore /etc/resolv.conf and /etc/localtime.