Multicasts once again: When using SO_BINDTODEVICE, don't specify IP address
of the interface.
This commit is contained in:
parent
1b50a1e4be
commit
4c5e5e3a1c
1 changed files with 2 additions and 1 deletions
|
@ -422,16 +422,17 @@ sk_open(sock *s)
|
|||
struct ip_mreq mreq_add;
|
||||
ASSERT(s->iface);
|
||||
set_inaddr(&mreq, s->iface->ip);
|
||||
mreq_add.imr_interface = mreq;
|
||||
#ifdef SO_BINDTODEVICE
|
||||
{
|
||||
struct ifreq ifr;
|
||||
strcpy(ifr.ifr_name, s->iface->name);
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) < 0)
|
||||
ERR("SO_BINDTODEVICE");
|
||||
mreq_add.imr_interface.s_addr = INADDR_ANY;
|
||||
}
|
||||
#else
|
||||
#error Multicasts not supported on PtP devices /* FIXME: Solve it somehow? */
|
||||
mreq_add.imr_interface = mreq;
|
||||
#endif
|
||||
#endif
|
||||
set_inaddr(&mreq_add.imr_multiaddr, s->daddr);
|
||||
|
|
Loading…
Reference in a new issue