Subject: More sockets and link-local multicast questions
To: None <tech-net@netbsd.org>
From: Andrew White <awhite@arc.corp.mot.com>
List: tech-net
Date: 10/11/2001 11:40:22
I'm seeing some "features" in my programs using sockets and link-local
multicast, and would like some assistance.  The symptoms are identical on
NetBSD 1.5 and FreeBSD (i386), and almost identical on Darwin 1.3.7 (under
IPv4 only), so I expect the errors are my own.


The aim:

Pick a link-local multicast address (say 224.0.0.127) and port (say 9001). 
Listen on that address and port on each interface, and receive messages from
that interface.  Most important, associate the received message with the
interface without using the source address / routing table.

My current technique is:

Create one socket per interface (say 2: en0 and en1).
Bind (with REUSEPORT) each socket to 224.0.0.127.9001.
Socket sock_en0 joins mcast group 224.0.0.127 on en0.  sock_en1 does the
same on en1.

Problem: packets received on either en0 or en1 are delivered to both
sockets.

What is the correct way to do this?



In addition, I'm having IPv6 problems.

If I do the same as above using IPv6 sockets and the address ff02::301, the
address/port is installed in netstat but nothing is received at the
receiving application (both recvfrom and select block indefinitely).  Using
tcpdump (both src and dst machine), I have confirmed that the packets are on
the wire and correctly addressed.

I figure I must be missing something obvious, but it confuses me that
semantically identical code works under v4 and not under v6.  I even wrote
the most basic test harness I could think of and the packets do not appear.

Any suggestions?  I can send the test harness if required.


Thanks

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