Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jun 2015 13:31:06 +0000
From:      Gopakumar Pillai <gpillai@vmware.com>
To:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   FreeBSD 8.x - ifa -> ifp refcount
Message-ID:  <D1944FA8.16931%gpillai@vmware.com>

next in thread | raw e-mail | index | archive | help

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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D1944FA8.16931%gpillai>