From 96795f0b6c4703fe6a184a29e9c3d16705e14002 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 15:59:22 +0200 Subject: [PATCH] tests: posix: headers: net: Add IPv6 join/leave group The IPV6_JOIN/LEAVE_GROUP corresponds to IPV6_ADD/DROP_MEMBERSHIP definitions so define the former and add tests for them. Signed-off-by: Jukka Rissanen --- include/zephyr/net/socket.h | 6 ++++++ tests/posix/headers/src/netinet_in_h.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index f1a937d4229..fec26c9ee98 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -1225,6 +1225,12 @@ struct ip_mreqn { /** Leave IPv6 multicast group. */ #define IPV6_DROP_MEMBERSHIP 21 +/** Join IPv6 multicast group. */ +#define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP + +/** Leave IPv6 multicast group. */ +#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP + /** * @brief Struct used when joining or leaving a IPv6 multicast group. */ diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index 61e2750239d..1e015a41f4c 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -63,8 +63,8 @@ ZTEST(posix_headers, test_netinet_in_h) zassert_equal(INET_ADDRSTRLEN, 16); zassert_equal(INET6_ADDRSTRLEN, 46); - /* zassert_not_equal(-1, IPV6_JOIN_GROUP); */ /* not implemented */ - /* zassert_not_equal(-1, IPV6_LEAVE_GROUP); */ /* not implemented */ + zassert_equal(IPV6_ADD_MEMBERSHIP, IPV6_JOIN_GROUP); + zassert_equal(IPV6_DROP_MEMBERSHIP, IPV6_LEAVE_GROUP); /* zassert_not_equal(-1, IPV6_MULTICAST_HOPS); */ /* not implemented */ /* zassert_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */ /* zassert_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */