Subject: IP4 multicast and interfaces?
To: None <tech-net@netbsd.org>
From: Andrew White <awhite@arc.corp.mot.com>
List: tech-net
Date: 10/08/2001 16:22:33
I'm using interface specific IP4 multicast and sockets under NetBSD 1.5
(i386).  When sending multicast packets from an unbound socket, the IPv4
source address is set to the source address of the interface for the default
route, not the source address of the interface that the packets are being
sent from.

eg:
en0 a.b.c.d
en1 e.f.g.h

Default route is a.b.c.1, out en0

Link local multicast packets (224.0.0.???) sent out en1 (using socket option
IP_MULTICAST_IF) use a source address of a.b.c.d, not e.f.g.h.  This is most
confusing for receiving devices.

FreeBSD 4.3 (i386) also displays this behaviour.  Darwin 1.3.7 (ppc) just
sends packets out the default interface regardless (with default source).

I would have expected to see packets choose a source address to match the
interface.  Is this a bug / feature, or are my expectations wrong?

Curiously enough, IPv6 on FreeBSD 4.3 binds the link local source address of
the default interface to outgoing packets on either interface (en0 or en1)! 
NetBSD does the same thing.  Considering the source address is invalid on
the link it is sent on (being a link-local address of a different link),
this can't be correct behaviour?


I can of course work-around by binding the socket to the IP address of the
interface and thus forcing a source address.

Thanks

-- 
Andrew White                Andrew.E.White@motorola.com