Subject: Re: if_detach handling styles
To: None <itojun@iijlab.net>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-net
Date: 02/02/2000 08:58:30
On Thu, 03 Feb 2000 01:40:15 +0900 
 itojun@iijlab.net wrote:

 > 	I'm a bit confused.  When I emailed about bsdi-wildboar/freebsd-PAO/
 > 	netbsd pcmcia models, someone told me that "interface and routes goes
 > 	away, daemons and programs should live with it" is the right thing
 > 	to do.  "Retainning routes even if interface is not there" is not
 > 	consistent with it...

right, the interface is gone... who's to say you're even going to pop
it back in?

Now, regarding the inp_route thing... yah, it should probably be purged
when the ifaddr is purged.  The same goes for when you delete an interface
address with SIOCDIFADDR that's being used by a cached route, which has
added a reference count to the route, I belive:

dr-evil:thorpej 126$ netstat -r 
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use    Mtu  Interface
default            w001.z209220028.sj UGS         9    29315   1500  kue0
localhost          localhost          UH          4      413  32976  lo0
209.220.28/28      link#10            UC          0        0   1500  kue0
w001.z209220028.sj 00:20:6f:04:13:1d  UHL         1        1   1500  kue0
w002.z209220028.sj localhost          UGHS        0        0  32976  lo0

The refs on my default route ought to be from those cached inp_route's.

Now, when if_down(ifp) happens in if_detach(), protocols should deal
with that, finding another route, etc, right?  What about if I forcibly
deleted the default route?  The protocol would deal, right?

So, it's probably not a problem at the moment...

        -- Jason R. Thorpe <thorpej@nas.nasa.gov>