]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Use SO_BINDTODEVICE if we're using old multicast API (i.e., struct ip_mreq
authorMartin Mares <mj@ucw.cz>
Wed, 14 Apr 1999 11:21:02 +0000 (11:21 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 14 Apr 1999 11:21:02 +0000 (11:21 +0000)
and not ip_mreqn). This should get multicasts on unnumbered PtP links work.

sysdep/unix/io.c

index d98972c700cd424354e59e084603ce87ab916405..02de2fa75601af308eef1d2934ef3e471b7c22e2 100644 (file)
@@ -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;