From owner-freebsd-current@FreeBSD.ORG Sun Jul 1 04:10:58 2007 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8EC8E16A46F for ; Sun, 1 Jul 2007 04:10:58 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from heff.fud.org.nz (203-109-251-39.static.bliink.ihug.co.nz [203.109.251.39]) by mx1.freebsd.org (Postfix) with ESMTP id 4D12F13C4C4 for ; Sun, 1 Jul 2007 04:10:57 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: by heff.fud.org.nz (Postfix, from userid 1001) id D5FA71CC58; Sun, 1 Jul 2007 16:10:55 +1200 (NZST) Date: Sun, 1 Jul 2007 16:10:55 +1200 From: Andrew Thompson To: FreeBSD Current Message-ID: <20070701041055.GA82649@heff.fud.org.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) Cc: brooks@freebsd.org Subject: dhclient-script will reload a module X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jul 2007 04:10:58 -0000 Hi, Recently ifconfig was given the -n flag to suppress module loading so the userland teardown scripts did not cause a module to load again. This is still happening when dhcp is used as dhclient calls ifconfig internally. The following patch addresses that, any objections? Andrew Index: dhclient-script =================================================================== RCS file: /home/ncvs/src/sbin/dhclient/dhclient-script,v retrieving revision 1.16 diff -u -p -r1.16 dhclient-script --- dhclient-script 13 Apr 2007 15:07:10 -0000 1.16 +++ dhclient-script 1 Jul 2007 04:06:02 -0000 @@ -22,6 +22,7 @@ ARP=/usr/sbin/arp AWK=/usr/bin/awk HOSTNAME=/bin/hostname +IFCONFIG='/sbin/ifconfig -n' NETSTAT=/usr/bin/netstat LOCALHOST=127.0.0.1 @@ -55,11 +56,11 @@ arp_flush() { } delete_old_address() { - eval "ifconfig $interface inet -alias $old_ip_address $medium" + eval "$IFCONFIG $interface inet -alias $old_ip_address $medium" } add_new_address() { - eval "ifconfig $interface \ + eval "$IFCONFIG $interface \ inet $new_ip_address \ netmask $new_subnet_mask \ broadcast $new_broadcast_address \ @@ -73,14 +74,14 @@ add_new_address() { delete_old_alias() { if [ -n "$alias_ip_address" ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 + $IFCONFIG $interface inet -alias $alias_ip_address > /dev/null 2>&1 #route delete $alias_ip_address $LOCALHOST > /dev/null 2>&1 fi } add_new_alias() { if [ -n "$alias_ip_address" ]; then - ifconfig $interface inet alias $alias_ip_address netmask \ + $IFCONFIG $interface inet alias $alias_ip_address netmask \ $alias_subnet_mask #route add $alias_ip_address $LOCALHOST fi @@ -276,14 +277,14 @@ fi case $reason in MEDIUM) - eval "ifconfig $interface $medium" - eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1 + eval "$IFCONFIG $interface $medium" + eval "$IFCONFIG $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1 sleep 1 ;; PREINIT) delete_old_alias - ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up + $IFCONFIG $interface inet 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up ;; ARPCHECK|ARPSEND) @@ -346,7 +347,7 @@ TIMEOUT) fi fi fi - eval "ifconfig $interface inet -alias $new_ip_address $medium" + eval "$IFCONFIG $interface inet -alias $new_ip_address $medium" delete_old_routes exit_with_hooks 1 ;;