Subject: Re: proposed fix for stray ifnet pointers from interface deletion
To: Bill Studenmund <>
From: Greg Troxel <>
List: tech-net
Date: 07/18/2005 16:10:24
Bill Studenmund <> writes:

> The real fix for this is to add reference counts. That way we really know
> when no one else has a copy of the pointer. Way back when I made the
> initial patch for deleting interfaces, I added code so that we added and
> deleted references, and only deleted the innards of an ifnet (and ifaddr)  
> when the count went to zero. Thus we should be able to avoid this whole
> class of errors.

I don't see a reference count in struct ifnet now, so I'm not sure I
follow you.  It certainly makes sense to do reference counting when
there could be dangling pointers, but one can also make a case that a
reference to an ifnet that's being logically deleted should be cleaned
up somehow.

Did you mean by your comment 'The real fix' that you do not want me to
commit the proposed change?  My change is really just fixing a logic
error where PRU_PURGEIF was not called and should have been, and doing
that doesn't preclude adding reference counts later (or even make it
harder, I think).

        Greg Troxel <>