Subject: More sockets and link-local multicast questions
To: None <>
From: Andrew White <>
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 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
Socket sock_en0 joins mcast group on en0.  sock_en1 does the
same on en1.

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

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.


Andrew White