Subject: Multicast recv IF

From: Vijayanand C <[email-masked]>
Date: Mon, 28 May 2001 19:00:40 +0530

Hello All,

I am using BSD sockets to send and receive multicast datagrams for a
protocol(LDP). I have a few doubts on this.

1)Is it possible to have a different socket for each interface, though they
bind to the same Group address in the bind.(While setting the
IP_ADD_MEMBERSHIP option, the interface address is mentioned)
2)If we have a common socket for all interfaces bound to the same Group
Address, how can we find out the interface on which the datagram arrived.

Thanks in advance.

Regards,
Vijay

---

From: Radhakrishna Singuru <[email-masked]>
Date: Tue, 29 May 2001 08:54:29 +0530

Yes, for sending packets on a particular interface, you can use the setsockopt
call with IP_MULTICAST_IF option. For receive, you need to determine the
interface based on the source address.
thanks
radha

---

From: Vijayanand C <[email-masked]>
Date: Tue, 29 May 2001 10:58:28 +0530

Hello radha,
Sending is not a problem.

But receiving is.
> For receive, you need to determine the
Finding the incoming interface based on source IP address will not be always
correct, unless the routes are always symmetrical(This need not be true with
all links and interfaces).So this method may not yield the correct solution.

Regards,
Vijay

---

From: JINMEI Tatuya / 神明達哉 <[email-masked]>
Date: Wed, 30 May 2001 00:04:13 +0900

>>>>> On Mon, 28 May 2001 19:00:40 +0530, 
>>>>> Vijayanand C <[email-masked]> said:

> IP_ADD_MEMBERSHIP option, the interface address is mentioned)

Yes, it is.  But you should specify the SO_REUSEPORT socket option for
all the sockets in order to prevent the kernel from rejecting the
duplicated bind.  Also, since all the sockets will accept all packets
to the address regardless of the receiving interface, you should
filter irrelevant packets at the application level.

> Address, how can we find out the interface on which the datagram arrived.

As far as I know, there is no mechanism to tell the receiving
interface in BSD variants in this scenario.  (Just FYI, for IPv6
sockets, you can use the IPV6_(RECV)PKTINFO socket option for this
purpose.)

					JINMEI, Tatuya
					Communication Platform Lab.
					Corporate R&D Center, Toshiba Corp.
					[email-masked]