summaryrefslogtreecommitdiffstats
path: root/sysdep
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-04-14 13:21:02 +0200
committerMartin Mares <mj@ucw.cz>1999-04-14 13:21:02 +0200
commit36154beb705cdaf03f9ee050798d9e653ded6ca5 (patch)
tree0a22b3d175374f84f0f766bf794993bc09aaaeec /sysdep
parent9da4d143402efd16bec286e3723b42386b20968b (diff)
downloadbird-36154beb705cdaf03f9ee050798d9e653ded6ca5.tar
bird-36154beb705cdaf03f9ee050798d9e653ded6ca5.zip
Use SO_BINDTODEVICE if we're using old multicast API (i.e., struct ip_mreq
and not ip_mreqn). This should get multicasts on unnumbered PtP links work.
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/unix/io.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index d98972c..02de2fa 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -413,6 +413,16 @@ sk_open(sock *s)
ASSERT(s->iface);
mreq.imr_ifindex = s->iface->index;
set_inaddr(&mreq.imr_address, s->iface->ip);
+#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");
+ }
+#else
+#error Multicasts not supported on PtP devices /* FIXME: Solve it somehow? */
+#endif
#else
struct in_addr mreq;
struct ip_mreq mreq_add;