FreeBSD 8.x - ifa -> ifp refcount

Gopakumar Pillai gpillai at vmware.com
Wed Jun 3 13:37:04 UTC 2015


Hi,
I am using FreeBSD 8.x with some modifications.

The question I have is that no reference count is taken when ifa is pointed to ifp. There are cases when I encounter issues like ifa is alive and has a pointer to ifp, but ifp itself is deleted.

Looks like we expect all ifa entries to be gone when ifp is being deleted. In FreeBSD 8.x we store the ifa address inside mbufs (for IPv6), which takes an ifa refcount when one accesses it (but not when added, which is probably wrong).  Hence there are more chances that the mbuf may be around (and the ifa) when an interface is being deleted.

Solution: Was thinking of incrementing the refcount of ifp when ifa points to it, thus the ifp goes away only after the last ifa (or the last mbuf with the ifa pointer) is gone.

I do not see that FreeBSD 11.x is doing this either. There must be a reason as to why it is so.  Can one of the gurus explain why it is so or whether I am wrong in my assumption.

Thank You

-Gopu




More information about the freebsd-net mailing list