New: sk_bound_dev_if should be set for a socket when using IP_MULITCAST_IF or IP_ADD_MEMBERSHIO
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]/
(switched to email. Please respond via emailed reply-to-all, not via the bugzilla web interface).
Quoted 40 lines · On Tue, 28 Jul 2009 03:42:38 GMT [email protected] wrote:
http://bugzilla.kernel.org/show_bug.cgi?id=13856
Summary:
sk_bound_dev_ifshould be set for a socket when using
IP_MULITCAST_IForIP_ADD_MEMBERSHIO
Product: Networking
Version: 2.5
Kernel Version: 2.6.27.7
Platform: All
OS/Version: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: IPV4
AssignedTo: [email protected]
ReportedBy: [email protected]
Regression: NoCurrently there is no way to tell which interface a multicast packet arrived on except by using a raw socket and issuing the
SO_BINDTODEVICEoption which forces thesk_bound_dev_iffor the socket to be set.Consider a multi-homed system where a service needs to listen for multicast SSDP messages on a number of interfaces. The system needs to know which interface a search message came in on in order to respond with the correct URL.
The service needs to join the multicast group on all interfaces. It must bind on
INADDR_ANYand then issue theIP_ADD_MEMBERSHIPcall.1. If it uses one socket and joins on all interfaces it will receive mulitcast from all interfaces but cannot tell which interface the message came in on
2. It it uses a socket per interface each bound on
INADDR_ANYand issuesIP_MULTICAST_IF. In this case any mulitcast socket, no matter what interface, will be forwarded to each socket becausesk_bound_dev_ifwas not set (i.e. 0) - seenet/ipv4/udp.c[udp_v4_mcast_next]Suggested solution is to set
sk_bound_dev_ifwhenIP_MULTICAST_IFis issued.
Quoted 5 lines
ReportedBy: [email protected]
Quoted 3 lines
Currently there is no way to tell which interface a multicast packet arrived on except by using a raw socket and issuing the
SO_BINDTODEVICEoption which forces thesk_bound_dev_iffor the socket to be set.
I thought the IP_PKTINFO cmsg was the usual way to do this.
--
John