Skip to content

Commit

Permalink
Add the socket option IPV6_MULTICAST_LOOP to prevent the interface f…
Browse files Browse the repository at this point in the history
…rom autoconfiguring using RA messages sent by itself.
  • Loading branch information
Wei Xing authored and reubenhwk committed Sep 8, 2024
1 parent f2de476 commit 3c9d491
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ int open_icmpv6_socket(void)
flog(LOG_ERR, "setsockopt(IPV6_MULTICAST_HOPS): %s", strerror(errno));
return -1;
}

err = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (int[]){0}, sizeof(int));
if (err < 0) {
flog(LOG_ERR, "setsockopt(IPV6_MULTICAST_LOOP): %s", strerror(errno));
return -1;
}

#ifdef IPV6_RECVHOPLIMIT
err = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, (int[]){1}, sizeof(int));
if (err < 0) {
Expand Down

0 comments on commit 3c9d491

Please sign in to comment.