Subject: netinet, netinet6, and PRC_IFDOWN
To: None <tech-net@netbsd.org>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-net
Date: 02/02/2000 12:47:54
So, I've discovered a problem with IPv4 and IPv6 in that they don't
pay attention to PRC_IFDOWN.  Other protocols do (e.g. OSI, XNS), and
generate "host unreachable" errors for everything using that interface.

Possibly what netinet{,6} should do is an in{,6}_rtchange() to release
the refernce to the routes they're holding (these are e.g. default
route, ARP entries, etc.), so as to force allocation of a new one the
next time through.  This is what redirects do, and I suspeect it will
be harmless... if it's a case of "ifconfig tlp0 down" *without*
detaching the interface, I'm pretty sure it will just allocate the
same route as before, so no side-effects like "ifconfig down/up
causes my connections to zorf".  But I obviously need to double-check
that :-)

...or should we add a PRC_IFGONE?  Note I'm not speaking for ifaddrs
and the PRU_PRUGEIF issue; this one would be for e.g. notifying PCBs
that they need to refresh themselves?

...or is this something that could be done in in{,6}_purgeaddr()?  I.e.
when purging an ifaddr, traverse the PCB tables, looking for PCBs with
cached routes that reference our ifaddr/ifnet, and in{,6}_rtchange() them?

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