From owner-freebsd-arch Tue Dec 14 19:51:15 1999 Delivered-To: freebsd-arch@freebsd.org Received: from ns1.yes.no (ns1.yes.no [195.204.136.10]) by hub.freebsd.org (Postfix) with ESMTP id F147115375 for ; Tue, 14 Dec 1999 19:51:09 -0800 (PST) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [195.204.143.218]) by ns1.yes.no (8.9.3/8.9.3) with ESMTP id EAA15868 for ; Wed, 15 Dec 1999 04:51:07 +0100 (CET) Received: (from eivind@localhost) by bitbox.follo.net (8.8.8/8.8.6) id EAA67975 for freebsd-arch@freebsd.org; Wed, 15 Dec 1999 04:51:06 +0100 (MET) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by hub.freebsd.org (Postfix) with ESMTP id 2826C14BE1 for ; Tue, 14 Dec 1999 19:50:44 -0800 (PST) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.9.1/8.9.1) with ESMTP id WAA13897; Tue, 14 Dec 1999 22:50:42 -0500 (EST) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.9.3/8.9.1) id WAA14947; Tue, 14 Dec 1999 22:50:11 -0500 (EST) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 14 Dec 1999 22:50:11 -0500 (EST) To: Jonathan Lemon Cc: freebsd-arch@freebsd.org Subject: Re: The if_detach problem In-Reply-To: <19991214160454.26093@right.PCS> References: <199912142145.VAA34161@hak.lan.Awfulhak.org> <19991214160454.26093@right.PCS> X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid Message-ID: <14423.3759.258444.555708@grasshopper.cs.duke.edu> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Jonathan Lemon writes: > > Is there a lot to be gained by removing interfaces ? > > Loadable device drivers. I ran into this last week or so when > unloading a driver I'm developing; if I don't do an 'ifconfig xxx delete' > before the kldunoad, I get a panic. I have the following code in a loadable (IP-only, not ethernet) driver of mine. It doesn't crash on unload anymore. However, I think something like this should be standard & available for (un)loadable drivers to call at unload time: s = splnet(); /* * Close down routes etc. * This needs to be at splnet */ TAILQ_FOREACH(ifp, &ifnet, if_link){ if(ifp == &sc->myri_if){ ifp_valid = 1; break; } } if(ifp_valid){ struct ifaddr *ia = 0; struct in_ifaddr *in_ia = 0; ifp = &sc->myri_if; TAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link){ if (ia->ifa_addr->sa_family != AF_INET) continue; in_ia = (struct in_ifaddr *)ia; in_ifscrub(ifp, in_ia); TAILQ_REMOVE(&in_ifaddrhead, in_ia, ia_link); } if_detach(&sc->myri_if); } splx(s); Cheers, Drew ------------------------------------------------------------------------------ Andrew Gallatin, Sr Systems Programmer http://www.cs.duke.edu/~gallatin Duke University Email: gallatin@cs.duke.edu Department of Computer Science Phone: (919) 660-6590 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message