!21 [sync] PR-20: Backport:Add the socket option IPV6_MULTICAST_LOOP to prevent the interface from autoconfiguring using RA messages sent by itself.

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2024-12-02 01:20:51 +00:00 committed by Gitee
commit a6b4a5eade
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,31 @@
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) {

View File

@ -1,6 +1,6 @@
Name: radvd
Version: 2.19
Release: 2
Release: 3
Summary: Router ADVertisement Daemon for IPv6
License: BSD with advertising
URL: http://www.litech.org/radvd/
@ -9,6 +9,7 @@ Source1: radvd-tmpfs.conf
Source2: radvd.service
Patch6000: backport-add-IPV6_DROP_MEMBERSHIP-to-clean-up-resources-when-.patch
Patch6001: backport-add-the-socket-option-IPV6_MULTICAST_LOOP.patch
BuildRequires: gcc bison flex flex-static pkgconfig check-devel systemd
Requires(pre): shadow-utils
@ -90,6 +91,12 @@ exit 0
%{_mandir}/*/*
%changelog
* Fri Oct 11 2024 lifeifei <lifeifei@kylinos.cn> - 2.19-3
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:Add the socket option IPV6_MULTICAST_LOOP to prevent the interface from autoconfiguring using RA messages sent by itself.
* Tue Jun 28 2022 Aichun Li <liaichun@huawei.com> - 2.19-2
- Type:bugfix
- Id:NA