[Xorp-hackers] FreeBSD: IP_ADD_MEMBERSHIP on IFF_POINTOPOINT problems

Pavlin Radoslavov pavlin@icir.org
Wed, 16 Jun 2004 17:35:59 -0700


> Has multicast group membership been an issue with FreeBSD and
> point-to-point interfaces in any of your testing?
> I'm trawling through the FreeBSD PRs which I currently own.
> 
> RIP in particular appears to be something which suffers from this,
> according to this problem report:
> http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/51927
> 
> The Rhyolite.com routed source tries to work around the problem
> in various ways; if MCAST_PPP_BUG is defined when compiled, it
> simply doesn't enable multicast for RIPv2 on IFF_POINTOPOINT
> interfaces.
> 
> As this applies to XORP: looking at comm_sock_join4() in
> libcomm/comm_sock.c, no such assumptions are made, it is a simple
> helper for IP_ADD_MEMBERSHIP, so I imagine this issue may bite.

Bruce,

I think XORP doesn't suffer from that problem for the simple
reason that we don't support unnumbered interfaces. I.e., each
interface must have a valid IP address, otherwise it won't be used
by any of our protocols.

Hence, in case of P2P links our IP_ADD_MEMBERSHIP simply uses the
local IP address on our side of the P2P link. After all, this is the
purpose of field "ip_mreq.imr_interface" (defined in netinet/in.h).

I read the above problem report, and one thing it talked about was
if several P2P interfaces share the same local IP address.
However, I believe this applies only for tunnel interfaces, and only
for the "outer" IP addresses of such P2P interfaces;
i.e., the "inner" IP addresses would be different.
Then, if RIP (or any other protocol) is running on that interface,
it would use the inner IP address which is unique, and
IP_ADD_MEMBERSHIP with that address would be fine.

However, in general, if a P2P interface has no IP address assigned,
and if you want your protocol to run over such unnumbered interface,
then the protocol itself (RIP, etc) should do the right thing by
not attempting to use IP_ADD_MEMBERSHIP on that interface.

In other words, I don't see a reason that the kernel needs to be
modified, because the problem is not there.

Indeed, in general it will be nicer if in case of IPv4 we can use
the interface index to specify the interface (similar to IPv6),
but woudn't be cleaner to use a separate API rather than hacking the
IP address values in the existing API.

Pavlin

P.S. BTW, I quickly tested the XORP RIP implementation with a tun0
interface created with openvpn, and it seems it can correctly
identify that interface and use it. The FEA itself when it reads the
interface information from the kernel also can identify properly the
inner IP address.

> 
> The patch proposed in the PR tries to match on the remote address
> of a PTP interface if the original ifp lookup fails. This would
> certainly be the case for an unnumbered interface.
> 
> NetBSD, on the other hand, allows multicast group memberships to
> be added by interface index:
> http://mail-index.netbsd.org/tech-net/2003/10/24/0005.html
> 
> Further research reveals that this is mandated by RFC 1724 section
> 3.3 (RIP Version 2 MIB Extension) which mandates the special casing
> of ip_multicast_if() within the BSD stack where 0.0.0.0/8 is concerned.
> 
> [After discussion with FreeBSD network junta, I'll commit something for
> this soon.]
> 
> Regards,
> BMS
> _______________________________________________
> Xorp-hackers mailing list
> Xorp-hackers@icir.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers