Darren Reed wrote:
Peter Memishian wrote:
> > We discussed this in an internal code review and I thought we
resolved > to do something with this but obviously nothing happened..
> > I believe the code should really be:
> > if (ipif->ipif_flags & IPIF_UP) {
> mutex_enter(&ill->ill_lock);
> ipif->ipif_flags &= ~IPIF_UP;
> mutex_exit(&ill->ill_lock);
> ASSERT(ill->ill_ipif_up_count > 0);
> --ill->ill_ipif_up_count;
> ipif_was_up = B_TRUE;
> > if (ill->ill_ipif_up_count == 0) {
> ...
> (void) hook_run(hr, (hook_data_t)&info);
> }
> /* Update status in SCTP's list */
> sctp_update_ipif(ipif, SCTP_IPIF_DOWN);
> }
The routing socket messages are generated in ipif_down_tail(); is there
a reason we want to run the hook a different place (ipif_down())?
ipif_down_tail() is called when changing an IP address on an interface.
Putting the hook in there resulted in the following events being
delivered
for an address change when there is only a :0 configured for a NIC:
NE_DOWN
NE_ADDRESS_CHANGE
NE_UP
For the routing socket, this means an RTM_DELETE is generated along
with an RTM_ADD - the only way it is capable of dealing with this
event.
Actually, ignore that rubbish, that sequence of events is generated anyway
for this particular condition.
Winding back my brain, I believe that the hook was placed there because
that is where ill_ipif_up_count is decremented. The event for NE_UP is in
ipif_up_done(), where ill_ipif_up_count is incremented.
If we move the event to ipif_down_tail, for a network interface that has
multiple logical interfaces instantiated then doing an unplumb will generate
an NE_DOWN for each logical interface. The following dtrace script will
show you this:
dtrace -n 'fbt::ipif_down_tail:entry{ipif = (ipif_t *)arg0; ill = (ill_t
*)ipif->ipif_ill; printf("%s up %d", stringof(ill->ill_name),
ill->ill_ipif_up_count);}'
To exercise this, run the above dtrace and do the following:
ifconfig ip.tun0 plumb
ifconfig ip.tun0 addif 1.1.1.1
ifconfig ip.tun0 unplumb
In addition, ipif_down_tail() has no knowledge about whether or not the
interface was previously up and is now going down - that knowledge
only exists in ipif_down().
Darren
_______________________________________________
networking-discuss mailing list
[email protected]