!1146 [sync] PR-1128: add MCAST_MSFILTER in setsockopt for MLDv2 of IPv6

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2024-07-12 08:44:33 +00:00 committed by Gitee
commit a16e6b94d6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,44 @@
From b6e9527f073d81ee9a3aa186c86a6a4fc8ff6a0b Mon Sep 17 00:00:00 2001
From: wanfeng <wanfeng@kylinos.cn>
Date: Wed, 3 Jul 2024 17:01:53 +0800
Subject: [PATCH] add MCAST_MSFILTER in setsockopt for MLDv2 of IPv6
---
src/api/sockets.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 7a67650..9e6ba90 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -4124,6 +4124,27 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_
if (NETCONNTYPE_GROUPV6(netconn_type(sock->conn)) == NETCONN_RAW_IPV6) {
err = mcast_sock_block_unblock_source_group(&sock->conn->pcb.raw->ipmc, optname, (const struct group_source_req *)optval);
} else
+#endif /* LWIP_RAW */
+ {
+ done_socket(sock);
+ return ENOPROTOOPT;
+ }
+ break;
+ case MCAST_MSFILTER:
+ LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, optlen, struct group_filter);
+ if (((const struct group_filter *)optval)->gf_group.ss_family != AF_INET6) {
+ done_socket(sock);
+ return EINVAL;
+ }
+#if LWIP_UDP
+ if (NETCONNTYPE_GROUPV6(netconn_type(sock->conn)) == NETCONN_UDP_IPV6) {
+ err = mcast_sock_set_groupfilter(&sock->conn->pcb.udp->ipmc, optname, (const struct group_filter *)optval);
+ } else
+#endif /* LWIP_UDP */
+#if LWIP_RAW
+ if (NETCONNTYPE_GROUPV6(netconn_type(sock->conn)) == NETCONN_RAW_IPV6) {
+ err = mcast_sock_set_groupfilter(&sock->conn->pcb.raw->ipmc, optname, (const struct group_filter *)optval);
+ } else
#endif /* LWIP_RAW */
{
done_socket(sock);
--
2.25.1

View File

@ -4,7 +4,7 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip
Version: 2.2.0
Release: 36
Release: 37
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -155,6 +155,8 @@ Patch9139: 0140-add-IP_ADD_SOURCE_MEMBERSHIP-to-setsockopt-for-igmpv3.patch
Patch9140: 0141-Improve-size-of-multicast-specifications.patch
Patch9141: 0142-virtio-record-local_port-for-port_map-of-virtio.patch
Patch9142: 0143-add-MCAST_MSFILTER-to-setsockopt-for-IGMPv3.patch
Patch9143: 0144-add-MCAST_MSFILTER-in-setsockopt-for-MLDv2-of-IPv6.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
#Requires:
@ -183,6 +185,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Wed Jul 3 2024 wanfeng <wanfeng@kylinos.cn> - 2.2.0-37
- add MCAST_MSFILTER in setsockopt for MLDv2 of IPv6
* Fri Jun 28 2024 wanfeng <wanfeng@kylinos.cn> - 2.2.0-36
- add MCAST_MSFILTER to setsockopt for IGMPv3