From 60e971c9e58bb5d32aa93febba103111225745aa Mon Sep 17 00:00:00 2001 From: Tomas Hozza Date: Aug 20 2012 13:41:22 +0000 Subject: dhclient-script: calling dhclient-up-hooks after setting up route, gateways & interface alias (#848869) --- diff --git a/dhclient-script b/dhclient-script index f43f4eb..ac2b7ac 100644 --- a/dhclient-script +++ b/dhclient-script @@ -363,12 +363,6 @@ dhconfig() { ip link set dev ${interface} mtu ${new_interface_mtu} fi - if [ -x ${ETCDIR}/dhclient-${interface}-up-hooks ]; then - . ${ETCDIR}/dhclient-${interface}-up-hooks - elif [ -x ${ETCDIR}/dhclient-up-hooks ]; then - . ${ETCDIR}/dhclient-up-hooks - fi - # static routes if [ -n "${new_classless_static_routes}" ] || [ -n "${new_static_routes}" ]; then @@ -494,6 +488,23 @@ dhconfig() { 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 + + # After dhclient brings an interface UP with a new IP address, subnet mask, + # and routes, in the REBOOT/BOUND states -> search for "dhclient-up-hooks". + if [ "${reason}" = "BOUND" ] || [ "${reason}" = "REBOOT" ] || + [ ! "${old_ip_address}" = "${new_ip_address}" ] || + [ ! "${old_subnet_mask}" = "${new_subnet_mask}" ] || + [ ! "${old_network_number}" = "${new_network_number}" ] || + [ ! "${old_broadcast_address}" = "${new_broadcast_address}" ] || + [ ! "${old_routers}" = "${new_routers}" ] || + [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ]; then + + if [ -x ${ETCDIR}/dhclient-${interface}-up-hooks ]; then + . ${ETCDIR}/dhclient-${interface}-up-hooks + elif [ -x ${ETCDIR}/dhclient-up-hooks ]; then + . ${ETCDIR}/dhclient-up-hooks + fi + fi make_resolv_conf diff --git a/dhcp.spec b/dhcp.spec index 0841b81..204fd2b 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -593,6 +593,8 @@ fi %changelog * Mon Aug 20 2012 Tomas Hozza - 12:4.2.4-12.P1 - dhclient-script: fixed CONFIG variable value passed to need_config (#848858) +- dhclient-script: calling dhclient-up-hooks after setting up route, gateways + & interface alias (#848869) * Fri Aug 17 2012 Jiri Popelka - 12:4.2.4-11.P1 - don't build libdst, it hasn't been used since 4.2.0 (#849166)