summaryrefslogtreecommitdiffstats
path: root/tests/sockaddr_str
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sockaddr_str')
-rw-r--r--tests/sockaddr_str/sockaddr_str_test.c239
-rw-r--r--tests/sockaddr_str/sockaddr_str_test.ok288
2 files changed, 527 insertions, 0 deletions
diff --git a/tests/sockaddr_str/sockaddr_str_test.c b/tests/sockaddr_str/sockaddr_str_test.c
new file mode 100644
index 00000000..d2e7944d
--- /dev/null
+++ b/tests/sockaddr_str/sockaddr_str_test.c
@@ -0,0 +1,239 @@
+/* tests for osmo_sockaddr_str API of libmsomcore */
+/*
+ * (C) 2019 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
+ *
+ * Author: neels@hofmeyr.de
+ *
+ * All Rights Reserved
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <osmocom/core/sockaddr_str.h>
+#include <osmocom/core/utils.h>
+#include <netinet/in.h>
+
+struct osmo_sockaddr_str oip_data[] = {
+ { .af = AF_INET, .ip = "1.2.3.4", .port = 5 },
+ { .af = AF_INET, .ip = "0.0.0.0", .port = 0 },
+ { .af = AF_INET, .ip = "255.255.255.255", .port = 65535 },
+ { .af = AF_INET, .ip = "0.0.0.256", .port = 1 },
+ { .af = AF_INET, .ip = "not an ip address", .port = 1 },
+ { .af = AF_INET6, .ip = "1:2:3::4", .port = 5 },
+ { .af = AF_INET6, .ip = "::", .port = 0 },
+ { .af = AF_INET6, .ip = "::1", .port = 0 },
+ { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 },
+ { .af = AF_INET6, .ip = "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", .port = 65535 },
+ { .af = AF_INET6, .ip = "::fffff", .port = 1 },
+ { .af = AF_INET6, .ip = "not an ip address", .port = 1 },
+
+ { .af = AF_INET6, .ip = "1.2.3.4", .port = 5 },
+ { .af = AF_INET, .ip = "1:2:3::4", .port = 5 },
+ { .af = AF_UNSPEC, .ip = "1.2.3.4", .port = 5 },
+ { .af = AF_INET, .ip = "", .port = 5 },
+ { .af = AF_INET6, .ip = "", .port = 5 },
+ { .af = AF_INET, .ip = "1.2.3.4", .port = 0 },
+ { .af = AF_INET, .ip = "1.2.3:4:5", .port = 0 },
+ { .af = AF_INET6, .ip = "::1:10.9.8.7", .port = 1 },
+};
+
+const char *af_name(int af)
+{
+ switch (af) {
+ case AF_INET:
+ return "AF_INET";
+ case AF_INET6:
+ return "AF_INET6";
+ case AF_UNSPEC:
+ return "AF_UNSPEC";
+ default:
+ return "?";
+ }
+}
+
+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)
+ return "rc == 0";
+ if (rc < 0)
+ return "rc < 0";
+ return "rc > 0";
+}
+
+void dump_oip(const struct osmo_sockaddr_str *oip)
+{
+ printf("{ .af = %s, .ip = %s, .port = %u }\n", af_name(oip->af), osmo_quote_str(oip->ip, -1), oip->port);
+}
+
+void sockaddr_str_test_conversions()
+{
+ int i;
+ char buf[1024];
+
+#define hexdump(what) \
+ osmo_hexdump_buf(buf, sizeof(buf), (void*)(&what), sizeof(what), "", false)
+
+ for (i = 0; i < ARRAY_SIZE(oip_data); i++) {
+ struct osmo_sockaddr_str *x = &oip_data[i];
+ int rc;
+ printf("\n\n");
+ dump_oip(x);
+
+ printf(" osmo_sockaddr_str_is_set() = %s\n", osmo_sockaddr_str_is_set(x) ? "true" : "false");
+
+ {
+ struct in_addr a = {};
+
+ rc = osmo_sockaddr_str_to_in_addr(x, &a);
+ printf(" osmo_sockaddr_str_to_in_addr() %s in_addr=%s\n", rc_name(rc), hexdump(a));
+
+ if (rc == 0) {
+ struct osmo_sockaddr_str back;
+ rc = osmo_sockaddr_str_from_in_addr(&back, &a, x->port);
+ printf(" -> osmo_sockaddr_str_from_in_addr() %s ", rc_name(rc));
+ dump_oip(&back);
+ if (memcmp(x, &back, sizeof(back)))
+ printf(" DIFFERS!\n");
+ }
+ }
+
+ {
+ struct in6_addr a = {};
+
+ rc = osmo_sockaddr_str_to_in6_addr(x, &a);
+ printf(" osmo_sockaddr_str_to_in6_addr() %s in6_addr=%s\n", rc_name(rc), hexdump(a));
+
+ if (rc == 0) {
+ struct osmo_sockaddr_str back;
+ rc = osmo_sockaddr_str_from_in6_addr(&back, &a, x->port);
+ printf(" -> osmo_sockaddr_str_from_in6_addr() %s ", rc_name(rc));
+ dump_oip(&back);
+ if (memcmp(x, &back, sizeof(back)))
+ printf(" DIFFERS!\n");
+ }
+ }
+
+ {
+ uint32_t a = 0;
+
+ rc = osmo_sockaddr_str_to_32(x, &a);
+ printf(" osmo_sockaddr_str_to_32() %s uint32_t=0x%x\n", rc_name(rc), a);
+
+ if (rc == 0) {
+ struct osmo_sockaddr_str back;
+ rc = osmo_sockaddr_str_from_32(&back, a, x->port);
+ printf(" -> osmo_sockaddr_str_from_32() %s ", rc_name(rc));
+ dump_oip(&back);
+ if (memcmp(x, &back, sizeof(back)))
+ printf(" DIFFERS!\n");
+ }
+ }
+
+ {
+ uint32_t a = 0;
+
+ rc = osmo_sockaddr_str_to_32n(x, &a);
+ printf(" osmo_sockaddr_str_to_32n() %s uint32_t=0x%x\n", rc_name(rc), a);
+
+ if (rc == 0) {
+ struct osmo_sockaddr_str back;
+ rc = osmo_sockaddr_str_from_32n(&back, a, x->port);
+ printf(" -> osmo_sockaddr_str_from_32n() %s ", rc_name(rc));
+ dump_oip(&back);
+ if (memcmp(x, &back, sizeof(back)))
+ printf(" DIFFERS!\n");
+ }
+ }
+
+ {
+ struct sockaddr_in a = {};
+
+ rc = osmo_sockaddr_str_to_sockaddr_in(x, &a);
+ printf(" osmo_sockaddr_str_to_sockaddr_in() %s sockaddr_in=%s\n", rc_name(rc), hexdump(a));
+
+ if (rc == 0) {
+ struct osmo_sockaddr_str back;
+ rc = osmo_sockaddr_str_from_sockaddr_in(&back, &a);
+ printf(" -> osmo_sockaddr_str_from_sockaddr_in() %s ", rc_name(rc));
+ dump_oip(&back);
+ if (memcmp(x, &back, sizeof(back)))
+ printf(" DIFFERS!\n");
+ }
+ }
+
+ {
+ struct sockaddr_in6 a = {};
+
+ rc = osmo_sockaddr_str_to_sockaddr_in6(x, &a);
+ printf(" osmo_sockaddr_str_to_sockaddr_in6() %s sockaddr_in6=%s\n", rc_name(rc), hexdump(a));
+
+ if (rc == 0) {
+ struct osmo_sockaddr_str back;
+ rc = osmo_sockaddr_str_from_sockaddr_in6(&back, &a);
+ printf(" -> osmo_sockaddr_str_from_sockaddr_in6() %s ", rc_name(rc));
+ dump_oip(&back);
+ if (memcmp(x, &back, sizeof(back)))
+ printf(" DIFFERS!\n");
+ }
+ }
+
+ {
+ struct sockaddr_storage a = {};
+
+ rc = osmo_sockaddr_str_to_sockaddr(x, &a);
+ printf(" osmo_sockaddr_str_to_sockaddr() %s sockaddr_storage=%s\n", rc_name(rc), hexdump(a));
+
+ if (rc == 0) {
+ struct osmo_sockaddr_str back;
+ rc = osmo_sockaddr_str_from_sockaddr(&back, &a);
+ printf(" -> osmo_sockaddr_str_from_sockaddr() %s ", rc_name(rc));
+ dump_oip(&back);
+ if (memcmp(x, &back, sizeof(back)))
+ printf(" DIFFERS!\n");
+ }
+ }
+
+ {
+ struct osmo_sockaddr_str from_str;
+ rc = osmo_sockaddr_str_from_str(&from_str, x->ip, x->port);
+ printf(" osmo_sockaddr_str_from_str() %s ", rc_name(rc));
+ dump_oip(&from_str);
+ if (rc == 0 && memcmp(x, &from_str, sizeof(from_str)))
+ printf(" DIFFERS!\n");
+ }
+ }
+
+}
+
+int main(int argc, char **argv)
+{
+ sockaddr_str_test_conversions();
+ return 0;
+}
+
diff --git a/tests/sockaddr_str/sockaddr_str_test.ok b/tests/sockaddr_str/sockaddr_str_test.ok
new file mode 100644
index 00000000..d69314d4
--- /dev/null
+++ b/tests/sockaddr_str/sockaddr_str_test.ok
@@ -0,0 +1,288 @@
+
+
+{ .af = AF_INET, .ip = "1.2.3.4", .port = 5 }
+ osmo_sockaddr_str_is_set() = 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_32() rc == 0 uint32_t=0x4030201
+ -> osmo_sockaddr_str_from_32() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 5 }
+ osmo_sockaddr_str_to_32n() rc == 0 uint32_t=0x1020304
+ -> osmo_sockaddr_str_from_32n() 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() 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 }
+
+
+{ .af = AF_INET, .ip = "0.0.0.0", .port = 0 }
+ osmo_sockaddr_str_is_set() = 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_32() rc == 0 uint32_t=0x0
+ -> osmo_sockaddr_str_from_32() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 0 }
+ osmo_sockaddr_str_to_32n() rc == 0 uint32_t=0x0
+ -> osmo_sockaddr_str_from_32n() 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() 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 }
+
+
+{ .af = AF_INET, .ip = "255.255.255.255", .port = 65535 }
+ osmo_sockaddr_str_is_set() = 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_32() rc == 0 uint32_t=0xffffffff
+ -> osmo_sockaddr_str_from_32() rc == 0 { .af = AF_INET, .ip = "255.255.255.255", .port = 65535 }
+ osmo_sockaddr_str_to_32n() rc == 0 uint32_t=0xffffffff
+ -> osmo_sockaddr_str_from_32n() 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() 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 }
+
+
+{ .af = AF_INET, .ip = "0.0.0.256", .port = 1 }
+ osmo_sockaddr_str_is_set() = true
+ 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ 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_INET, .ip = "0.0.0.256", .port = 1 }
+
+
+{ .af = AF_INET, .ip = "not an ip address", .port = 1 }
+ osmo_sockaddr_str_is_set() = true
+ 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ 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 }
+
+
+{ .af = AF_INET6, .ip = "1:2:3::4", .port = 5 }
+ osmo_sockaddr_str_is_set() = true
+ osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000
+ osmo_sockaddr_str_to_in6_addr() rc == 0 in6_addr=00010002000300000000000000000004
+ -> 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_sockaddr_in() rc < 0 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
+ -> osmo_sockaddr_str_from_sockaddr() rc == 0 { .af = AF_INET6, .ip = "1:2:3::4", .port = 5 }
+ osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET6, .ip = "1:2:3::4", .port = 5 }
+
+
+{ .af = AF_INET6, .ip = "::", .port = 0 }
+ osmo_sockaddr_str_is_set() = 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_from_in6_addr() rc == 0 { .af = AF_INET6, .ip = "::", .port = 0 }
+ osmo_sockaddr_str_to_32() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_sockaddr_in() rc < 0 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
+ -> osmo_sockaddr_str_from_sockaddr() rc == 0 { .af = AF_INET6, .ip = "::", .port = 0 }
+ osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET6, .ip = "::", .port = 0 }
+
+
+{ .af = AF_INET6, .ip = "::1", .port = 0 }
+ osmo_sockaddr_str_is_set() = false
+ osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000
+ osmo_sockaddr_str_to_in6_addr() rc == 0 in6_addr=00000000000000000000000000000001
+ -> osmo_sockaddr_str_from_in6_addr() rc == 0 { .af = AF_INET6, .ip = "::1", .port = 0 }
+ osmo_sockaddr_str_to_32() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_sockaddr_in() rc < 0 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
+ -> osmo_sockaddr_str_from_sockaddr() rc == 0 { .af = AF_INET6, .ip = "::1", .port = 0 }
+ osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET6, .ip = "::1", .port = 0 }
+
+
+{ .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 }
+ osmo_sockaddr_str_is_set() = true
+ osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000
+ osmo_sockaddr_str_to_in6_addr() rc == 0 in6_addr=ffffffffffffffffffffffffffffffff
+ -> 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_sockaddr_in() rc < 0 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
+ -> osmo_sockaddr_str_from_sockaddr() rc == 0 { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 }
+ osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 }
+
+
+{ .af = AF_INET6, .ip = "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", .port = 65535 }
+ osmo_sockaddr_str_is_set() = true
+ osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000
+ osmo_sockaddr_str_to_in6_addr() rc == 0 in6_addr=ffffffffffffffffffffffffffffffff
+ -> osmo_sockaddr_str_from_in6_addr() rc == 0 { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 }
+ DIFFERS!
+ osmo_sockaddr_str_to_32() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_sockaddr_in() rc < 0 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!
+ osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0a00ffff00000000ffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+ -> osmo_sockaddr_str_from_sockaddr() rc == 0 { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 }
+ DIFFERS!
+ osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET6, .ip = "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", .port = 65535 }
+
+
+{ .af = AF_INET6, .ip = "::fffff", .port = 1 }
+ osmo_sockaddr_str_is_set() = true
+ 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ 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_INET6, .ip = "::fffff", .port = 1 }
+
+
+{ .af = AF_INET6, .ip = "not an ip address", .port = 1 }
+ osmo_sockaddr_str_is_set() = true
+ 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ 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 }
+
+
+{ .af = AF_INET6, .ip = "1.2.3.4", .port = 5 }
+ osmo_sockaddr_str_is_set() = true
+ 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ 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_from_str() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 5 }
+ DIFFERS!
+
+
+{ .af = AF_INET, .ip = "1:2:3::4", .port = 5 }
+ osmo_sockaddr_str_is_set() = true
+ 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ 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_from_str() rc == 0 { .af = AF_INET6, .ip = "1:2:3::4", .port = 5 }
+ DIFFERS!
+
+
+{ .af = AF_UNSPEC, .ip = "1.2.3.4", .port = 5 }
+ osmo_sockaddr_str_is_set() = 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ 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_from_str() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 5 }
+ DIFFERS!
+
+
+{ .af = AF_INET, .ip = "", .port = 5 }
+ osmo_sockaddr_str_is_set() = 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ 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_from_str() rc < 0 { .af = AF_UNSPEC, .ip = "", .port = 5 }
+
+
+{ .af = AF_INET6, .ip = "", .port = 5 }
+ osmo_sockaddr_str_is_set() = 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ 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_from_str() rc < 0 { .af = AF_UNSPEC, .ip = "", .port = 5 }
+
+
+{ .af = AF_INET, .ip = "1.2.3.4", .port = 0 }
+ osmo_sockaddr_str_is_set() = 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_32() rc == 0 uint32_t=0x4030201
+ -> osmo_sockaddr_str_from_32() rc == 0 { .af = AF_INET, .ip = "1.2.3.4", .port = 0 }
+ osmo_sockaddr_str_to_32n() rc == 0 uint32_t=0x1020304
+ -> osmo_sockaddr_str_from_32n() 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() 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 }
+
+
+{ .af = AF_INET, .ip = "1.2.3:4:5", .port = 0 }
+ osmo_sockaddr_str_is_set() = 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 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ 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_from_str() rc == 0 { .af = AF_INET6, .ip = "1.2.3:4:5", .port = 0 }
+ DIFFERS!
+
+
+{ .af = AF_INET6, .ip = "::1:10.9.8.7", .port = 1 }
+ osmo_sockaddr_str_is_set() = true
+ osmo_sockaddr_str_to_in_addr() rc < 0 in_addr=00000000
+ osmo_sockaddr_str_to_in6_addr() rc == 0 in6_addr=0000000000000000000000010a090807
+ -> osmo_sockaddr_str_from_in6_addr() rc == 0 { .af = AF_INET6, .ip = "::1:a09:807", .port = 1 }
+ DIFFERS!
+ osmo_sockaddr_str_to_32() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_sockaddr_in() rc < 0 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!
+ osmo_sockaddr_str_to_sockaddr() rc == 0 sockaddr_storage=0a000001000000000000000000000000000000010a0908070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+ -> osmo_sockaddr_str_from_sockaddr() rc == 0 { .af = AF_INET6, .ip = "::1:a09:807", .port = 1 }
+ DIFFERS!
+ osmo_sockaddr_str_from_str() rc == 0 { .af = AF_INET6, .ip = "::1:10.9.8.7", .port = 1 }