Subject: Re: possibility of panics in netinet{,6} detach logic
To: None <thorpej@netbsd.org>
From: None <itojun@iijlab.net>
List: tech-net
Date: 07/09/2001 16:18:56
> it seems that PRU_PURGEIF logic still has a possibility for panics.
>
> the current logic is like below. therefore, by the time we call the
> 2nd in_pcbpurgeif0(), the interface address can be gone already.
>
> i guess what should be done is like below. correct me if i'm mistaken.
oops sorry, i guess i was mistaken. IFAREF() should protect the
situation from happening. but anyway, it is a bit confusing...
i guess i prefer the following order, not sure if it makes real
difference or not.
- remove all reference from pcbs, to in_ifaddr or ifp
- remove all in_ifaddr
- refresh route caches for all pcbs
itojun
--- should be
if_detach()
{
for (all usrreq)
xx_usrreq(PRU_PURGEIF0);
for (all protos)
xx_purgeif();
for (all usrreq)
xx_usrreq(PRU_PURGEIF);
}
xx_usrreq()
{
if (cmd == PRU_PURGEIF0)
in_pcbpurgeif0();
else if (cmd == PRU_PURGEIF)
in_pcbpurgeif();
}