Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Apr 2007 07:22:44 +0100
From:      "Bruce M. Simpson" <bms@incunabulum.net>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, Gleb Smirnoff <glebius@FreeBSD.org>, "Bruce M. Simpson" <bms@FreeBSD.org>, cvs-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: cvs commit: src/sys/contrib/pf/net if_pfsync.c
Message-ID:  <462DA234.9070000@incunabulum.net>
In-Reply-To: <20070423123711.I26224@fledge.watson.org>
References:  <200704140101.l3E11kum000736@repoman.freebsd.org> <20070423095356.GB2742@FreeBSD.org> <462C8FFB.7030309@FreeBSD.org> <20070423123711.I26224@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Robert Watson wrote:
> Part of the issue here is that kernel consumers aren't the only 
> sources of multicast address registrations -- for example, user 
> applications can register them directly using ioctls.  Kernel 
> consumers should be given every opportunity to unregister addresses 
> themselves (via event handlers on tear-down) before they are ripped 
> out, but if they're still there when it comes time to free the 
> interface, the stack should clean them up.

The code as it currently stands mostly captures these semantics.

Userland can only join IPv4 groups on a socket, therefore those 
allocations are already tracked, and garbage collected with the socket.

For link layer groups, userland may currently join only once, because 
there is no other way of tracking multiple allocations -- the socket 
ioctl used for this can't return an opaque handle without changing the 
ABI. This is a rarely used feature, so this change in semantics seems OK.

The code Glebius is referring to is a case where the event handler, used 
to detect that the member interface of a pfsync instance was detached 
from the rest of the system, runs only after netinet itself has been 
detached from the interface, but just before the interface is actually 
removed. Therefore, netinet has already cleaned up after itself and 
freed the pfsync group memberships, the detach handler need do nothing.

If we made the attachment and detachment of protocol domains explicit in 
the network stack, then the whole would be cleaner. However, this would 
be a very wide ranging architectural change, far more so than the 
introduction of reference counting to in_multi.

Regards,
BMS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?462DA234.9070000>