From cd7de91e2270dfc60f547d4d7e8bbba13d3f372c Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Thu, 25 Jan 2024 04:38:54 +0700 Subject: [PATCH] tests/sockaddr_str: fix dead code, print some errno values This fixes a -Wunused-function warning thrown by clang. Change-Id: I45e9044f80e1f634c811e729f4314ec9bcf6a9ad --- tests/sockaddr_str/sockaddr_str_test.c | 19 ++- tests/sockaddr_str/sockaddr_str_test.ok | 150 ++++++++++++------------ 2 files changed, 82 insertions(+), 87 deletions(-) diff --git a/tests/sockaddr_str/sockaddr_str_test.c b/tests/sockaddr_str/sockaddr_str_test.c index 541c3a153..676068cf1 100644 --- a/tests/sockaddr_str/sockaddr_str_test.c +++ b/tests/sockaddr_str/sockaddr_str_test.c @@ -68,21 +68,16 @@ const char *af_name(int af) } } -static const struct value_string err_names[] = { - { -EINVAL, "-EINVAL" }, - {} -}; - -static inline const char *err_name(int err) -{ return get_value_string(err_names, err); } - static inline const char *rc_name(int rc) { - if (!rc) + switch (rc) { + case -EINVAL: + return "rc == -EINVAL"; + case 0: return "rc == 0"; - if (rc < 0) - return "rc < 0"; - return "rc > 0"; + default: + return rc < 0 ? "rc < 0" : "rc > 0"; + } } void dump_oip(const struct osmo_sockaddr_str *oip) diff --git a/tests/sockaddr_str/sockaddr_str_test.ok b/tests/sockaddr_str/sockaddr_str_test.ok index 910e91954..e24d7cbc4 100644 --- a/tests/sockaddr_str/sockaddr_str_test.ok +++ b/tests/sockaddr_str/sockaddr_str_test.ok @@ -6,14 +6,14 @@ osmo_sockaddr_str_is_nonzero() = true osmo_sockaddr_str_to_in_addr() rc == 0 in_addr=01020304 -> osmo_sockaddr_str_from_in_addr() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 5 } - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 osmo_sockaddr_str_to_32() rc == 0 uint8_t[4]=[ 01 02 03 04 ] -> osmo_sockaddr_str_from_32() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 5 } osmo_sockaddr_str_to_32h() rc == 0 uint8_t[4]=[ 04 03 02 01 ] -> osmo_sockaddr_str_from_32h() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 5 } osmo_sockaddr_str_to_sockaddr_in() rc == 0 sockaddr_in=02000005010203040000000000000000 -> osmo_sockaddr_str_from_sockaddr_in() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 5 } - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=00000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=00000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0200000501020304000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -> osmo_sockaddr_str_from_sockaddr() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 5 } osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 5 } @@ -25,14 +25,14 @@ osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc == 0 in_addr=00000000 -> osmo_sockaddr_str_from_in_addr() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 0 } - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 osmo_sockaddr_str_to_32() rc == 0 uint8_t[4]=[ 00 00 00 00 ] -> osmo_sockaddr_str_from_32() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 0 } osmo_sockaddr_str_to_32h() rc == 0 uint8_t[4]=[ 00 00 00 00 ] -> osmo_sockaddr_str_from_32h() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 0 } osmo_sockaddr_str_to_sockaddr_in() rc == 0 sockaddr_in=02000000000000000000000000000000 -> osmo_sockaddr_str_from_sockaddr_in() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 0 } - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=00000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=00000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -> osmo_sockaddr_str_from_sockaddr() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 0 } osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 0 } @@ -44,14 +44,14 @@ osmo_sockaddr_str_is_nonzero() = true osmo_sockaddr_str_to_in_addr() rc == 0 in_addr=ffffffff -> osmo_sockaddr_str_from_in_addr() rc == 0 { .af = AF_INET, .ip = "255.255.255.255", .port = 65535 } - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 osmo_sockaddr_str_to_32() rc == 0 uint8_t[4]=[ ff ff ff ff ] -> osmo_sockaddr_str_from_32() rc == 0 { .af = AF_INET, .ip = "255.255.255.255", .port = 65535 } osmo_sockaddr_str_to_32h() rc == 0 uint8_t[4]=[ ff ff ff ff ] -> osmo_sockaddr_str_from_32h() rc == 0 { .af = AF_INET, .ip = "255.255.255.255", .port = 65535 } osmo_sockaddr_str_to_sockaddr_in() rc == 0 sockaddr_in=0200ffffffffffff0000000000000000 -> osmo_sockaddr_str_from_sockaddr_in() rc == 0 { .af = AF_INET, .ip = "255.255.255.255", .port = 65535 } - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=00000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=00000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0200ffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -> osmo_sockaddr_str_from_sockaddr() rc == 0 { .af = AF_INET, .ip = "255.255.255.255", .port = 65535 } osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET, .ip = "255.255.255.255", .port = 65535 } @@ -61,13 +61,13 @@ OSMO_SOCKADDR_STR_FMT: '0.0.0.256:1' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false - osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 - osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=02000001000000000000000000000000 - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=00000000000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr() rc < 0 sockaddr_storage=0200000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_in_addr() rc == -EINVAL in_addr=00000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_32() rc == -EINVAL uint8_t[4]=[ 00 00 00 00 ] + osmo_sockaddr_str_to_32h() rc == -EINVAL uint8_t[4]=[ 00 00 00 00 ] + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=02000001000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=00000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr() rc == -EINVAL sockaddr_storage=0200000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET, .ip = "0.0.0.256", .port = 1 } @@ -75,14 +75,14 @@ OSMO_SOCKADDR_STR_FMT: 'not an ip address:1' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false - osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 - osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=02000001000000000000000000000000 - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=00000000000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr() rc < 0 sockaddr_storage=0200000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_from_str() rc < 0 { .af = AF_UNSPEC, .ip = "not an ip address", .port = 1 } + osmo_sockaddr_str_to_in_addr() rc == -EINVAL in_addr=00000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_32() rc == -EINVAL uint8_t[4]=[ 00 00 00 00 ] + osmo_sockaddr_str_to_32h() rc == -EINVAL uint8_t[4]=[ 00 00 00 00 ] + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=02000001000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=00000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr() rc == -EINVAL sockaddr_storage=0200000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_from_str() rc == -EINVAL { .af = AF_UNSPEC, .ip = "not an ip address", .port = 1 } { .af = AF_INET6, .ip = "1:2:3::4", .port = 5 } @@ -94,7 +94,7 @@ -> osmo_sockaddr_str_from_in6_addr() rc == 0 { .af = AF_INET6, .ip = "1:2:3::4", .port = 5 } osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr_in6() rc == 0 sockaddr_in6=0a000005000000000001000200030000000000000000000400000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "1:2:3::4", .port = 5 } osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0a00000500000000000100020003000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -111,7 +111,7 @@ -> osmo_sockaddr_str_from_in6_addr() rc == 0 { .af = AF_INET6, .ip = "::", .port = 0 } osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr_in6() rc == 0 sockaddr_in6=0a000000000000000000000000000000000000000000000000000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::", .port = 0 } osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -128,7 +128,7 @@ -> osmo_sockaddr_str_from_in6_addr() rc == 0 { .af = AF_INET6, .ip = "::1", .port = 0 } osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr_in6() rc == 0 sockaddr_in6=0a000000000000000000000000000000000000000000000100000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::1", .port = 0 } osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0a00000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -145,7 +145,7 @@ -> osmo_sockaddr_str_from_in6_addr() rc == 0 { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 } osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr_in6() rc == 0 sockaddr_in6=0a00ffff00000000ffffffffffffffffffffffffffffffff00000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 } osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0a00ffff00000000ffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -163,7 +163,7 @@ DIFFERS! osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr_in6() rc == 0 sockaddr_in6=0a00ffff00000000ffffffffffffffffffffffffffffffff00000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 } DIFFERS! @@ -178,12 +178,12 @@ osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=0a000001000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr() rc < 0 sockaddr_storage=0a00000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=0a000001000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr() rc == -EINVAL sockaddr_storage=0a00000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET6, .ip = "::fffff", .port = 1 } @@ -192,13 +192,13 @@ osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=0a000001000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr() rc < 0 sockaddr_storage=0a00000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_from_str() rc < 0 { .af = AF_UNSPEC, .ip = "not an ip address", .port = 1 } + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=0a000001000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr() rc == -EINVAL sockaddr_storage=0a00000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_from_str() rc == -EINVAL { .af = AF_UNSPEC, .ip = "not an ip address", .port = 1 } { .af = AF_INET6, .ip = "1.2.3.4", .port = 5 } @@ -206,12 +206,12 @@ osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=0a000005000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr() rc < 0 sockaddr_storage=0a00000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=0a000005000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr() rc == -EINVAL sockaddr_storage=0a00000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 5 } DIFFERS! @@ -220,13 +220,13 @@ OSMO_SOCKADDR_STR_FMT: '1:2:3::4:5' osmo_sockaddr_str_is_set() = true osmo_sockaddr_str_is_nonzero() = false - osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 - osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=02000005000000000000000000000000 - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=00000000000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr() rc < 0 sockaddr_storage=0200000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_in_addr() rc == -EINVAL in_addr=00000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_32() rc == -EINVAL uint8_t[4]=[ 00 00 00 00 ] + osmo_sockaddr_str_to_32h() rc == -EINVAL uint8_t[4]=[ 00 00 00 00 ] + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=02000005000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=00000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr() rc == -EINVAL sockaddr_storage=0200000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET6, .ip = "1:2:3::4", .port = 5 } DIFFERS! @@ -236,12 +236,12 @@ osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=00000000000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr() rc < 0 sockaddr_storage=0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=00000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr() rc == -EINVAL sockaddr_storage=0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 5 } DIFFERS! @@ -250,13 +250,13 @@ OSMO_SOCKADDR_STR_FMT: ':5' osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false - osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 - osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=02000005000000000000000000000000 - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=00000000000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr() rc < 0 sockaddr_storage=0200000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_in_addr() rc == -EINVAL in_addr=00000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_32() rc == -EINVAL uint8_t[4]=[ 00 00 00 00 ] + osmo_sockaddr_str_to_32h() rc == -EINVAL uint8_t[4]=[ 00 00 00 00 ] + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=02000005000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=00000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr() rc == -EINVAL sockaddr_storage=0200000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_from_str() rc < 0 { .af = AF_UNSPEC, .ip = "", .port = 5 } @@ -265,12 +265,12 @@ osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=0a000005000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr() rc < 0 sockaddr_storage=0a00000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=0a000005000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr() rc == -EINVAL sockaddr_storage=0a00000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_from_str() rc < 0 { .af = AF_UNSPEC, .ip = "", .port = 5 } @@ -280,14 +280,14 @@ osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc == 0 in_addr=01020304 -> osmo_sockaddr_str_from_in_addr() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 0 } - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 osmo_sockaddr_str_to_32() rc == 0 uint8_t[4]=[ 01 02 03 04 ] -> osmo_sockaddr_str_from_32() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 0 } osmo_sockaddr_str_to_32h() rc == 0 uint8_t[4]=[ 04 03 02 01 ] -> osmo_sockaddr_str_from_32h() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 0 } osmo_sockaddr_str_to_sockaddr_in() rc == 0 sockaddr_in=02000000010203040000000000000000 -> osmo_sockaddr_str_from_sockaddr_in() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 0 } - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=00000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=00000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0200000001020304000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -> osmo_sockaddr_str_from_sockaddr() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 0 } osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 0 } @@ -297,13 +297,13 @@ OSMO_SOCKADDR_STR_FMT: '1.2.3:4:5:0' osmo_sockaddr_str_is_set() = false osmo_sockaddr_str_is_nonzero() = false - osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000 - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 - osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=02000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=00000000000000000000000000000000000000000000000000000000 - osmo_sockaddr_str_to_sockaddr() rc < 0 sockaddr_storage=0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_in_addr() rc == -EINVAL in_addr=00000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_32() rc == -EINVAL uint8_t[4]=[ 00 00 00 00 ] + osmo_sockaddr_str_to_32h() rc == -EINVAL uint8_t[4]=[ 00 00 00 00 ] + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=02000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=00000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr() rc == -EINVAL sockaddr_storage=0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET6, .ip = "1.2.3:4:5", .port = 0 } DIFFERS! @@ -318,7 +318,7 @@ DIFFERS! osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr_in6() rc == 0 sockaddr_in6=0a000001000000000000000000000000000000010a09080700000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::1:a09:807", .port = 1 } DIFFERS! @@ -334,14 +334,14 @@ osmo_sockaddr_str_is_nonzero() = false osmo_sockaddr_str_to_in_addr() rc == 0 in_addr=00000000 -> osmo_sockaddr_str_from_in_addr() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 5 } - osmo_sockaddr_str_to_in6_addr() rc < 0 in6_addr=00000000000000000000000000000000 + osmo_sockaddr_str_to_in6_addr() rc == -EINVAL in6_addr=00000000000000000000000000000000 osmo_sockaddr_str_to_32() rc == 0 uint8_t[4]=[ 00 00 00 00 ] -> osmo_sockaddr_str_from_32() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 5 } osmo_sockaddr_str_to_32h() rc == 0 uint8_t[4]=[ 00 00 00 00 ] -> osmo_sockaddr_str_from_32h() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 5 } osmo_sockaddr_str_to_sockaddr_in() rc == 0 sockaddr_in=02000005000000000000000000000000 -> osmo_sockaddr_str_from_sockaddr_in() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 5 } - osmo_sockaddr_str_to_sockaddr_in6() rc < 0 sockaddr_in6=00000000000000000000000000000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in6() rc == -EINVAL sockaddr_in6=00000000000000000000000000000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0200000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -> osmo_sockaddr_str_from_sockaddr() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 5 } osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 5 } @@ -356,7 +356,7 @@ -> osmo_sockaddr_str_from_in6_addr() rc == 0 { .af = AF_INET6, .ip = "::", .port = 5 } osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr_in6() rc == 0 sockaddr_in6=0a000005000000000000000000000000000000000000000000000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::", .port = 5 } osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0a00000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -374,7 +374,7 @@ DIFFERS! osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ] osmo_sockaddr_str_to_32h() rc < 0 uint8_t[4]=[ 00 00 00 00 ] - osmo_sockaddr_str_to_sockaddr_in() rc < 0 sockaddr_in=00000000000000000000000000000000 + osmo_sockaddr_str_to_sockaddr_in() rc == -EINVAL sockaddr_in=00000000000000000000000000000000 osmo_sockaddr_str_to_sockaddr_in6() rc == 0 sockaddr_in6=0a000005000000000000000000000000000000000000000000000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::", .port = 5 } DIFFERS!