summaryrefslogtreecommitdiffstats
path: root/src/ipv6nd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-04-23 18:54:39 +0000
committerRoy Marples <roy@marples.name>2019-04-23 18:54:39 +0000
commitd49ade28548c9013ce3944949b6b7a3fbbcabadb (patch)
tree1d5ab31aef50bc3dfc9e2223932d9fb4d346ca4e /src/ipv6nd.c
parent17852a6ee23e8827f329e5ad0c08b6f969543d20 (diff)
downloaddhcpcd-d49ade28548c9013ce3944949b6b7a3fbbcabadb.tar.xz
sun: Bind IPv6ND socket to interface.
Just to be on the safe side as it is per interface ....
Diffstat (limited to 'src/ipv6nd.c')
-rw-r--r--src/ipv6nd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ipv6nd.c b/src/ipv6nd.c
index a0fd4185..e8a06182 100644
--- a/src/ipv6nd.c
+++ b/src/ipv6nd.c
@@ -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)
{