Add the socket option IPV6_MULTICAST_LOOP to prevent the interface from autoconfiguring using RA messages sent by itself.

This commit is contained in:
Wei Xing
2023-12-18 02:16:09 +08:00
committed by reubenhwk
parent f2de476455
commit 3c9d4917fe

View File

@@ -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) {