From 71f072c6e1d844ec57a388a5720ecae55e7b7810 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 15:47:33 +0200 Subject: [PATCH 1/8] tests: posix: headers: net: sin6_scope_id is supported The Posix documentation uses sin6_scope_id for scope id and we support that already. Signed-off-by: Jukka Rissanen --- tests/posix/headers/src/netinet_in_h.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index 78adfe6be82c1..cd96d5931ead2 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -38,8 +38,7 @@ ZTEST(posix_headers, test_netinet_in_h) /* not implemented */ /* zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_flowinfo)); */ zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr)); - /* not implemented */ - /* zassert_not_equal(-1, offsetof(struct sockaddr_in6, scope_id)); */ + zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id)); zassert_not_null(&in6addr_loopback); struct in6_addr any6 = IN6ADDR_ANY_INIT; From 291f745e4b052f1315aac06cd559e436da8b4233 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 15:49:58 +0200 Subject: [PATCH 2/8] tests: posix: headers: net: Add check for in6addr_any variable The in6addr_any is a global symbol that can be used when any address (all zero bits) is being referenced. Signed-off-by: Jukka Rissanen --- tests/posix/headers/src/netinet_in_h.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index cd96d5931ead2..61e2750239df2 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -40,6 +40,7 @@ ZTEST(posix_headers, test_netinet_in_h) zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr)); zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id)); + zassert_not_null(&in6addr_any); zassert_not_null(&in6addr_loopback); struct in6_addr any6 = IN6ADDR_ANY_INIT; struct in6_addr lo6 = IN6ADDR_LOOPBACK_INIT; From f81fd971f22d2736fb81767490d6e495a3fda294 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 15:59:22 +0200 Subject: [PATCH 3/8] 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 f1a937d42294d..fec26c9ee9879 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 61e2750239df2..1e015a41f4c65 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 */ From 7fa43789436cfff6f5f742295d4f4d805bb145ea Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 16:02:55 +0200 Subject: [PATCH 4/8] tests: posix: headers: net: Mark unicast/multicast hops supported Both the IPV6_UNICAST_HOPS and IPV6_MULTICAST_HOPS are supported so add tests for them. Signed-off-by: Jukka Rissanen --- tests/posix/headers/src/netinet_in_h.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index 1e015a41f4c65..6dba608521e2d 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -65,10 +65,10 @@ ZTEST(posix_headers, test_netinet_in_h) 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_HOPS); /* zassert_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */ /* zassert_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */ - /* zassert_not_equal(-1, IPV6_UNICAST_HOPS); */ /* not implemented */ + zassert_not_equal(-1, IPV6_UNICAST_HOPS); zassert_not_equal(-1, IPV6_V6ONLY); /* IN6_IS_ADDR_UNSPECIFIED(&any6); */ /* not implemented */ From a9c940a0e2fe5f02fe35a80c162ba935f217fdcb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 16:05:32 +0200 Subject: [PATCH 5/8] tests: posix: headers: net: Add INADDR_BROADCAST definition Add INADDR_BROADCAST definition and a test for it. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_ip.h | 3 +++ tests/posix/headers/src/netinet_in_h.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/net_ip.h b/include/zephyr/net/net_ip.h index 0963bdd69bc31..499d5a4f3131d 100644 --- a/include/zephyr/net/net_ip.h +++ b/include/zephyr/net/net_ip.h @@ -438,6 +438,9 @@ extern const struct in6_addr in6addr_loopback; /** IPv4 any address */ #define INADDR_ANY 0 +/** IPv4 broadcast address */ +#define INADDR_BROADCAST 0xffffffff + /** IPv4 address initializer */ #define INADDR_ANY_INIT { { { INADDR_ANY } } } diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index 6dba608521e2d..f860484b58c25 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -58,7 +58,7 @@ ZTEST(posix_headers, test_netinet_in_h) zassert_not_equal(-1, IPPROTO_UDP); zassert_not_equal(-1, INADDR_ANY); - /* zassert_not_equal(-1, INADDR_BROADCAST); */ /* not implemented */ + zassert_equal(0xffffffff, INADDR_BROADCAST); zassert_equal(INET_ADDRSTRLEN, 16); zassert_equal(INET6_ADDRSTRLEN, 46); From 63b4eb194001c2d2a5efb8a04c5bc108275c7a0f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 16:58:37 +0200 Subject: [PATCH 6/8] tests: posix: headers: net: Add various IPv6 address check macros Add these Posix specified IPv6 address checking macros IN6_IS_ADDR_UNSPECIFIED IN6_IS_ADDR_LOOPBACK IN6_IS_ADDR_MULTICAST IN6_IS_ADDR_LINKLOCAL IN6_IS_ADDR_SITELOCAL IN6_IS_ADDR_V4MAPPED IN6_IS_ADDR_MC_NODELOCAL IN6_IS_ADDR_MC_LINKLOCAL IN6_IS_ADDR_MC_SITELOCAL IN6_IS_ADDR_MC_ORGLOCAL IN6_IS_ADDR_MC_GLOBAL and tests for them. Signed-off-by: Jukka Rissanen --- include/zephyr/net/socket.h | 40 ++++++++++++++++++++++++++ tests/posix/headers/src/netinet_in_h.c | 39 ++++++++++++++++++------- 2 files changed, 68 insertions(+), 11 deletions(-) diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index fec26c9ee9879..fb1865b1296a5 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -1295,6 +1295,46 @@ struct in6_pktinfo { #define SOMAXCONN 128 /** @} */ +/** + * @name Macros for checking special IPv6 addresses. + * @{ + */ +/** Check unspecified IPv6 address. */ +#define IN6_IS_ADDR_UNSPECIFIED(addr) \ + net_ipv6_addr_cmp(net_ipv6_unspecified_address(), addr) + +/** Check loopback IPv6 address. */ +#define IN6_IS_ADDR_LOOPBACK(addr) net_ipv6_is_addr_loopback(addr) + +/** Check IPv6 multicast address */ +#define IN6_IS_ADDR_MULTICAST(addr) net_ipv6_is_addr_mcast(addr) + +/** Check IPv6 link local address */ +#define IN6_IS_ADDR_LINKLOCAL(addr) net_ipv6_is_ll_addr(addr) + +/** Check IPv6 site local address */ +#define IN6_IS_ADDR_SITELOCAL(addr) net_ipv6_is_sl_addr(addr) + +/** Check IPv6 v4 mapped address */ +#define IN6_IS_ADDR_V4MAPPED(addr) net_ipv6_addr_is_v4_mapped(addr) + +/** Check IPv6 multicast global address */ +#define IN6_IS_ADDR_MC_GLOBAL(addr) net_ipv6_is_addr_mcast_global(addr) + +/** Check IPv6 multicast node local address */ +#define IN6_IS_ADDR_MC_NODELOCAL(addr) net_ipv6_is_addr_mcast_iface(addr) + +/** Check IPv6 multicast link local address */ +#define IN6_IS_ADDR_MC_LINKLOCAL(addr) net_ipv6_is_addr_mcast_link(addr) + +/** Check IPv6 multicast site local address */ +#define IN6_IS_ADDR_MC_SITELOCAL(addr) net_ipv6_is_addr_mcast_site(addr) + +/** Check IPv6 multicast organization local address */ +#define IN6_IS_ADDR_MC_ORGLOCAL(addr) net_ipv6_is_addr_mcast_org(addr) + +/** @} */ + /** @cond INTERNAL_HIDDEN */ /** * @brief Registration information for a given BSD socket family. diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index f860484b58c25..e3bd53cf1e67c 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -45,6 +45,23 @@ ZTEST(posix_headers, test_netinet_in_h) struct in6_addr any6 = IN6ADDR_ANY_INIT; struct in6_addr lo6 = IN6ADDR_LOOPBACK_INIT; + struct in6_addr mcast6 = { { { 0xff, 0 } } }; + struct in6_addr ll6 = { { { 0xfe, 0x80, 0x01, 0x02, + 0, 0, 0, 0, 0, 0x01 } } }; + struct in6_addr sl6 = { { { 0xfe, 0xc0, 0, 0x01, 0x02 } } }; + struct in6_addr v4mapped = { { { 0, 0, 0, 0, 0, 0, 0, 0, + 0xff, 0xff, 0xff, 0xff, 0xc0, 0, 0x02, 0x01 } } }; + struct in6_addr mcnl6 = { { { 0xff, 0x01, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; + struct in6_addr mcll6 = { { { 0xff, 0x02, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; + struct in6_addr mcsl6 = { { { 0xff, 0x05, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; + struct in6_addr mcol6 = { { { 0xff, 0x08, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; + struct in6_addr mcg6 = { { { 0xff, 0x0e, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; + /* not implemented */ /* zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); */ /* not implemented */ @@ -71,18 +88,18 @@ ZTEST(posix_headers, test_netinet_in_h) zassert_not_equal(-1, IPV6_UNICAST_HOPS); zassert_not_equal(-1, IPV6_V6ONLY); - /* IN6_IS_ADDR_UNSPECIFIED(&any6); */ /* not implemented */ - /* IN6_IS_ADDR_LOOPBACK(&lo6); */ /* not implemented */ + zassert_true(IN6_IS_ADDR_UNSPECIFIED(&any6)); + zassert_true(IN6_IS_ADDR_LOOPBACK(&lo6)); - /* IN6_IS_ADDR_MULTICAST(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_LINKLOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_SITELOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_V4MAPPED(&lo6); */ /* not implemented */ + zassert_true(IN6_IS_ADDR_MULTICAST(&mcast6)); + zassert_true(IN6_IS_ADDR_LINKLOCAL(&ll6)); + zassert_true(IN6_IS_ADDR_SITELOCAL(&sl6)); + zassert_true(IN6_IS_ADDR_V4MAPPED(&v4mapped)); /* IN6_IS_ADDR_V4COMPAT(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_MC_NODELOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_MC_LINKLOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_MC_SITELOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_MC_ORGLOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_MC_GLOBAL(&lo6); */ /* not implemented */ + zassert_true(IN6_IS_ADDR_MC_NODELOCAL(&mcnl6)); + zassert_true(IN6_IS_ADDR_MC_LINKLOCAL(&mcll6)); + zassert_true(IN6_IS_ADDR_MC_SITELOCAL(&mcsl6)); + zassert_true(IN6_IS_ADDR_MC_ORGLOCAL(&mcol6)); + zassert_true(IN6_IS_ADDR_MC_GLOBAL(&mcg6)); } #pragma GCC diagnostic pop From ef80c0416c6421bfe18884a80477b05e9fc0899d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 17:16:49 +0200 Subject: [PATCH 7/8] tests: posix: headers: net: Add test for ipv6_mreq The "struct ipv6_mreq" is supported so enable the tests for it. Signed-off-by: Jukka Rissanen --- tests/posix/headers/src/netinet_in_h.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index e3bd53cf1e67c..25cceb6aa97df 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -62,10 +62,8 @@ ZTEST(posix_headers, test_netinet_in_h) struct in6_addr mcg6 = { { { 0xff, 0x0e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; - /* not implemented */ - /* zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); */ - /* not implemented */ - /* zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_interface)); */ + zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); + zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_ifindex)); zassert_not_equal(-1, IPPROTO_IP); zassert_not_equal(-1, IPPROTO_IPV6); From d3e9754ca4eba556db3d6f0b96b63f7b9e7f6426 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 11 Nov 2024 13:57:04 +0200 Subject: [PATCH 8/8] tests: posix: headers: net: Convert to use zexpect Use zexpect instead of zassert so that the failed tests do not stop the test execution but we run all the tests. Signed-off-by: Jukka Rissanen --- tests/posix/headers/src/netinet_in_h.c | 102 ++++++++++++------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index 25cceb6aa97df..141e2eb69fcf5 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -21,27 +21,27 @@ */ ZTEST(posix_headers, test_netinet_in_h) { - zassert_equal(sizeof(in_port_t), sizeof(uint16_t)); - zassert_equal(sizeof(in_addr_t), sizeof(uint32_t)); + zexpect_equal(sizeof(in_port_t), sizeof(uint16_t)); + zexpect_equal(sizeof(in_addr_t), sizeof(uint32_t)); - zassert_not_equal(-1, offsetof(struct in_addr, s_addr)); + zexpect_not_equal(-1, offsetof(struct in_addr, s_addr)); - zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_family)); - zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_port)); - zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_addr)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_family)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_port)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_addr)); - zassert_not_equal(-1, offsetof(struct in6_addr, s6_addr)); - zassert_equal(sizeof(((struct in6_addr *)NULL)->s6_addr), 16 * sizeof(uint8_t)); + zexpect_not_equal(-1, offsetof(struct in6_addr, s6_addr)); + zexpect_equal(sizeof(((struct in6_addr *)NULL)->s6_addr), 16 * sizeof(uint8_t)); - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_family)); - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_port)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_family)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_port)); /* not implemented */ - /* zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_flowinfo)); */ - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr)); - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id)); + /* zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_flowinfo)); */ + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id)); - zassert_not_null(&in6addr_any); - zassert_not_null(&in6addr_loopback); + zexpect_not_null(&in6addr_any); + zexpect_not_null(&in6addr_loopback); struct in6_addr any6 = IN6ADDR_ANY_INIT; struct in6_addr lo6 = IN6ADDR_LOOPBACK_INIT; @@ -62,42 +62,42 @@ ZTEST(posix_headers, test_netinet_in_h) struct in6_addr mcg6 = { { { 0xff, 0x0e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; - zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); - zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_ifindex)); - - zassert_not_equal(-1, IPPROTO_IP); - zassert_not_equal(-1, IPPROTO_IPV6); - zassert_not_equal(-1, IPPROTO_ICMP); - zassert_not_equal(-1, IPPROTO_RAW); - zassert_not_equal(-1, IPPROTO_TCP); - zassert_not_equal(-1, IPPROTO_UDP); - - zassert_not_equal(-1, INADDR_ANY); - zassert_equal(0xffffffff, INADDR_BROADCAST); - - zassert_equal(INET_ADDRSTRLEN, 16); - zassert_equal(INET6_ADDRSTRLEN, 46); - - zassert_equal(IPV6_ADD_MEMBERSHIP, IPV6_JOIN_GROUP); - zassert_equal(IPV6_DROP_MEMBERSHIP, IPV6_LEAVE_GROUP); - zassert_not_equal(-1, IPV6_MULTICAST_HOPS); - /* zassert_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */ - /* zassert_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */ - zassert_not_equal(-1, IPV6_UNICAST_HOPS); - zassert_not_equal(-1, IPV6_V6ONLY); - - zassert_true(IN6_IS_ADDR_UNSPECIFIED(&any6)); - zassert_true(IN6_IS_ADDR_LOOPBACK(&lo6)); - - zassert_true(IN6_IS_ADDR_MULTICAST(&mcast6)); - zassert_true(IN6_IS_ADDR_LINKLOCAL(&ll6)); - zassert_true(IN6_IS_ADDR_SITELOCAL(&sl6)); - zassert_true(IN6_IS_ADDR_V4MAPPED(&v4mapped)); + zexpect_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); + zexpect_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_ifindex)); + + zexpect_not_equal(-1, IPPROTO_IP); + zexpect_not_equal(-1, IPPROTO_IPV6); + zexpect_not_equal(-1, IPPROTO_ICMP); + zexpect_not_equal(-1, IPPROTO_RAW); + zexpect_not_equal(-1, IPPROTO_TCP); + zexpect_not_equal(-1, IPPROTO_UDP); + + zexpect_not_equal(-1, INADDR_ANY); + zexpect_equal(0xffffffff, INADDR_BROADCAST); + + zexpect_equal(INET_ADDRSTRLEN, 16); + zexpect_equal(INET6_ADDRSTRLEN, 46); + + zexpect_equal(IPV6_ADD_MEMBERSHIP, IPV6_JOIN_GROUP); + zexpect_equal(IPV6_DROP_MEMBERSHIP, IPV6_LEAVE_GROUP); + zexpect_not_equal(-1, IPV6_MULTICAST_HOPS); + /* zexpect_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */ + /* zexpect_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */ + zexpect_not_equal(-1, IPV6_UNICAST_HOPS); + zexpect_not_equal(-1, IPV6_V6ONLY); + + zexpect_true(IN6_IS_ADDR_UNSPECIFIED(&any6)); + zexpect_true(IN6_IS_ADDR_LOOPBACK(&lo6)); + + zexpect_true(IN6_IS_ADDR_MULTICAST(&mcast6)); + zexpect_true(IN6_IS_ADDR_LINKLOCAL(&ll6)); + zexpect_true(IN6_IS_ADDR_SITELOCAL(&sl6)); + zexpect_true(IN6_IS_ADDR_V4MAPPED(&v4mapped)); /* IN6_IS_ADDR_V4COMPAT(&lo6); */ /* not implemented */ - zassert_true(IN6_IS_ADDR_MC_NODELOCAL(&mcnl6)); - zassert_true(IN6_IS_ADDR_MC_LINKLOCAL(&mcll6)); - zassert_true(IN6_IS_ADDR_MC_SITELOCAL(&mcsl6)); - zassert_true(IN6_IS_ADDR_MC_ORGLOCAL(&mcol6)); - zassert_true(IN6_IS_ADDR_MC_GLOBAL(&mcg6)); + zexpect_true(IN6_IS_ADDR_MC_NODELOCAL(&mcnl6)); + zexpect_true(IN6_IS_ADDR_MC_LINKLOCAL(&mcll6)); + zexpect_true(IN6_IS_ADDR_MC_SITELOCAL(&mcsl6)); + zexpect_true(IN6_IS_ADDR_MC_ORGLOCAL(&mcol6)); + zexpect_true(IN6_IS_ADDR_MC_GLOBAL(&mcg6)); } #pragma GCC diagnostic pop