32 lines
1.0 KiB
Diff
32 lines
1.0 KiB
Diff
|
|
From bc8f31629d3d6eaaf273781d0b4c83e81bebe0eb Mon Sep 17 00:00:00 2001
|
||
|
|
From: Wei Xing <skyxwwalker@gmail.com>
|
||
|
|
Date: Mon, 18 Dec 2023 02:16:09 +0800
|
||
|
|
Subject: [PATCH] Add the socket option IPV6_MULTICAST_LOOP to prevent the
|
||
|
|
interface from autoconfiguring using RA messages sent by itself.
|
||
|
|
|
||
|
|
Reference:https://github.com/radvd-project/radvd/commit/bc8f31629d3d6eaaf273781d0b4c83e81bebe0eb
|
||
|
|
Conflict:NA
|
||
|
|
|
||
|
|
---
|
||
|
|
socket.c | 7 +++++++
|
||
|
|
1 file changed, 7 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/socket.c b/socket.c
|
||
|
|
index 849ed744..547fe939 100644
|
||
|
|
--- a/socket.c
|
||
|
|
+++ b/socket.c
|
||
|
|
@@ -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) {
|