From owner-freebsd-net@FreeBSD.ORG Mon May 3 19:27:20 2010 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F2B4A1065672; Mon, 3 May 2010 19:27:20 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id CA70A8FC12; Mon, 3 May 2010 19:27:20 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 73D6C46B8A; Mon, 3 May 2010 15:27:20 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 955748A021; Mon, 3 May 2010 15:27:19 -0400 (EDT) From: John Baldwin To: net@freebsd.org Date: Mon, 3 May 2010 15:27:18 -0400 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201005031527.18468.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 03 May 2010 15:27:19 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Brooks Davis Subject: Workaround automatic re-loading of network drivers X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 19:27:21 -0000 While testing some changes with vlans and the new vlan_ syntax in rc.conf I've noticed the following behavior: ifconfig foo0.100 destroy Will actually try to kldload the 'foo' driver. This can prove very non- intuitive. In general I think we shouldn't try to kldload anything when destroying an interface period. What I've done locally is to pass '-n' to ifconfig when destroying an interface. We should possibly fix some other bugs however. For example, ifmaybeload() in ifconfig should probably stop at the first non-digit it finds (e.g. ".") rather than trimming from the first digit on. Also, perhaps 'ifconfig destroy' should imply -n without requiring it to be explicit. I also moved the ifconfig destroy of wlan and vlan devices up before running ifn_stop to prevent running 'ifconfig down' which would also reload the driver due to the first bug in ifconfig. Index: network.subr =================================================================== --- network.subr (revision 207329) +++ network.subr (working copy) @@ -915,7 +915,7 @@ _list= for ifn in ${cloned_interfaces}; do - ifconfig ${ifn} destroy + ifconfig -n ${ifn} destroy if [ $? -eq 0 ]; then _list="${_list}${_prefix}${ifn}" [ -z "$_prefix" ] && _prefix=' ' @@ -1000,10 +1000,10 @@ if ! ifexists $child; then continue fi + ifconfig -n $child destroy && cfg=0 if autoif $child; then ifn_stop $child fi - ifconfig $child destroy && cfg=0 done child_vlans=`get_if_var $ifn vlans_IF` @@ -1014,10 +1014,10 @@ if ! ifexists $child; then continue fi + ifconfig -n $child destroy && cfg=0 if autoif $child; then ifn_stop $child fi - ifconfig $child destroy && cfg=0 done return ${cfg} -- John Baldwin