From 7afd6325f5aa14bfd6f5a0685ab475c8e2b95985 Mon Sep 17 00:00:00 2001 From: Ermal Date: Mon, 6 Dec 2010 18:53:48 +0000 Subject: Modify dhclient-script to call rc.newwanip after all the changes to system have been done so races and no stale information can be extracted from the later. --- sbin/dhclient-script | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'sbin') diff --git a/sbin/dhclient-script b/sbin/dhclient-script index 01dfc78..515191a 100755 --- a/sbin/dhclient-script +++ b/sbin/dhclient-script @@ -59,7 +59,7 @@ arp_flush() { } delete_old_address() { - rm -f /var/db/${interface}_ip + /bin/rm -f /var/db/${interface}_ip $IFCONFIG $interface inet -alias $old_ip_address $medium } @@ -82,8 +82,6 @@ add_new_address() { echo $new_routers > /tmp/${interface}_router echo $new_ip_address > /var/db/${interface}_ip - /usr/local/sbin/pfSctl -c "interface newip $interface" - } delete_old_alias() { @@ -226,7 +224,7 @@ add_new_resolv_conf() { done fi if [ -n "$new_domain_name_servers" ]; then - rm -f /var/etc/nameserver_$interface + /bin/rm -f /var/etc/nameserver_$interface for nameserver in $new_domain_name_servers; do # Add a route to the nameserver out the correct interface # so that mulitple wans work correctly with multiple dns @@ -235,7 +233,6 @@ add_new_resolv_conf() { $ROUTE add $nameserver -iface $interface done echo $new_domain_name >/var/etc/searchdomain_$interface - /usr/local/sbin/pfSctl -c 'service reload dns' fi return 0 @@ -243,6 +240,7 @@ add_new_resolv_conf() { # Notify rc.newwanip of changes to an interface notify_rc_newwanip() { + /usr/local/sbin/pfSctl -c "interface newip $interface" } # @@ -287,17 +285,17 @@ ARPCHECK|ARPSEND) BOUND|RENEW|REBIND|REBOOT) check_hostname - changes=no + changes="no" if [ -n "$old_ip_address" ]; then if [ -n "$alias_ip_address" ] && \ [ "$old_ip_address" != "$alias_ip_address" ]; then delete_old_alias - changes=yes + changes="yes" fi if [ "$old_ip_address" != "$new_ip_address" ]; then delete_old_address delete_old_routes - changes=yes + changes="yes" fi fi if [ "$reason" = BOUND ] || \ @@ -306,12 +304,12 @@ BOUND|RENEW|REBIND|REBOOT) [ "$old_ip_address" != "$new_ip_address" ]; then add_new_address add_new_routes - changes=yes + changes="yes" fi if [ -n "$alias_ip_address" ] && \ [ "$new_ip_address" != "$alias_ip_address" ]; then add_new_alias - changes=yes + changes="yes" fi add_new_resolv_conf if [ "$changes" = "yes" ] ; then -- cgit v1.1