]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
sun: Bind IPv6ND socket to interface.
authorRoy Marples <roy@marples.name>
Tue, 23 Apr 2019 18:54:39 +0000 (18:54 +0000)
committerRoy Marples <roy@marples.name>
Tue, 23 Apr 2019 18:54:39 +0000 (18:54 +0000)
Just to be on the safe side as it is per interface ....

src/ipv6nd.c

index a0fd41856a20fa87fef915d439ca58fdc16cd533..e8a0618267f19f249efd577dc64bfcd59edc373b 100644 (file)
@@ -242,6 +242,7 @@ ipv6nd_open(struct interface *ifp)
            .ipv6mr_interface = ifp->index
        };
        struct rs_state *state = RS_STATE(ifp);
+       uint_t ifindex = ifp->index;
 
        if (state->nd_fd != -1)
                return state->nd_fd;
@@ -250,6 +251,13 @@ ipv6nd_open(struct interface *ifp)
        if (s == -1)
                return -1;
 
+       if (setsockopt(s, IPPROTO_IPV6, IPV6_BOUND_IF,
+           &ifindex, sizeof(ifindex)) == -1)
+       {
+               close(s);
+               return -1;
+       }
+
        if (setsockopt(s, IPPROTO_IPV6, IPV6_JOIN_GROUP,
            &mreq, sizeof(mreq)) == -1)
        {