summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sockaddr_str.c14
-rw-r--r--tests/sockaddr_str/sockaddr_str_test.c6
-rw-r--r--tests/sockaddr_str/sockaddr_str_test.ok92
3 files changed, 58 insertions, 54 deletions
diff --git a/src/sockaddr_str.c b/src/sockaddr_str.c
index 5c548b40..304363d9 100644
--- a/src/sockaddr_str.c
+++ b/src/sockaddr_str.c
@@ -255,7 +255,7 @@ int osmo_sockaddr_str_from_in6_addr(struct osmo_sockaddr_str *sockaddr_str, cons
return 0;
}
-/*! Convert IPv4 address from 32bit host-byte-order to osmo_sockaddr_str, and set port.
+/*! Convert IPv4 address from 32bit network-byte-order to osmo_sockaddr_str, and set port.
* \param[out] sockaddr_str The instance to copy to.
* \param[in] addr 32bit IPv4 address data.
* \param[in] port Port number.
@@ -270,7 +270,8 @@ int osmo_sockaddr_str_from_32(struct osmo_sockaddr_str *sockaddr_str, uint32_t i
return osmo_sockaddr_str_from_in_addr(sockaddr_str, &addr, port);
}
-/*! Convert IPv4 address from 32bit network-byte-order to osmo_sockaddr_str, and set port.
+/*! Convert IPv4 address from 32bit host-byte-order to osmo_sockaddr_str, and set port.
+ * For legacy reasons, this function has a misleading 'n' in its name.
* \param[out] sockaddr_str The instance to copy to.
* \param[in] addr 32bit IPv4 address data.
* \param[in] port Port number.
@@ -376,9 +377,9 @@ int osmo_sockaddr_str_to_in6_addr(const struct osmo_sockaddr_str *sockaddr_str,
return 0;
}
-/*! Convert osmo_sockaddr_str address string to IPv4 address data in host-byte-order.
+/*! Convert osmo_sockaddr_str address string to IPv4 address data in network-byte-order.
* \param[in] sockaddr_str The instance to convert the IP of.
- * \param[out] dst IPv4 address data in 32bit host-byte-order format to write to.
+ * \param[out] dst IPv4 address data in 32bit network-byte-order format to write to.
* \return 0 on success, negative on error (e.g. invalid IPv4 address string).
*/
int osmo_sockaddr_str_to_32(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip)
@@ -396,9 +397,10 @@ int osmo_sockaddr_str_to_32(const struct osmo_sockaddr_str *sockaddr_str, uint32
return 0;
}
-/*! Convert osmo_sockaddr_str address string to IPv4 address data in network-byte-order.
+/*! Convert osmo_sockaddr_str address string to IPv4 address data in host-byte-order.
+ * For legacy reasons, this function has a misleading 'n' in its name.
* \param[in] sockaddr_str The instance to convert the IP of.
- * \param[out] dst IPv4 address data in 32bit network-byte-order format to write to.
+ * \param[out] dst IPv4 address data in 32bit host-byte-order format to write to.
* \return 0 on success, negative on error (e.g. invalid IPv4 address string).
*/
int osmo_sockaddr_str_to_32n(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip)
diff --git a/tests/sockaddr_str/sockaddr_str_test.c b/tests/sockaddr_str/sockaddr_str_test.c
index 7d8fe4f3..7e015ce7 100644
--- a/tests/sockaddr_str/sockaddr_str_test.c
+++ b/tests/sockaddr_str/sockaddr_str_test.c
@@ -149,7 +149,8 @@ void sockaddr_str_test_conversions()
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);
+ printf(" osmo_sockaddr_str_to_32() %s uint8_t[4]=[ %s]\n", rc_name(rc),
+ osmo_hexdump((void*)&a, sizeof(a)));
if (rc == 0) {
struct osmo_sockaddr_str back;
@@ -165,7 +166,8 @@ void sockaddr_str_test_conversions()
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);
+ printf(" osmo_sockaddr_str_to_32n() %s uint8_t[4]=[ %s]\n", rc_name(rc),
+ osmo_hexdump((void*)&a, sizeof(a)));
if (rc == 0) {
struct osmo_sockaddr_str back;
diff --git a/tests/sockaddr_str/sockaddr_str_test.ok b/tests/sockaddr_str/sockaddr_str_test.ok
index 31f630f7..33d9d7eb 100644
--- a/tests/sockaddr_str/sockaddr_str_test.ok
+++ b/tests/sockaddr_str/sockaddr_str_test.ok
@@ -7,9 +7,9 @@
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_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_32n() rc == 0 uint32_t=0x1020304
+ osmo_sockaddr_str_to_32n() rc == 0 uint8_t[4]=[ 04 03 02 01 ]
-> 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 }
@@ -26,9 +26,9 @@
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_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_32n() rc == 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc == 0 uint8_t[4]=[ 00 00 00 00 ]
-> 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 }
@@ -45,9 +45,9 @@
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_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_32n() rc == 0 uint32_t=0xffffffff
+ osmo_sockaddr_str_to_32n() rc == 0 uint8_t[4]=[ ff ff ff ff ]
-> 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 }
@@ -63,8 +63,8 @@
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 uint32_t=0x0
- osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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
@@ -77,8 +77,8 @@
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 uint32_t=0x0
- osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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
@@ -92,8 +92,8 @@
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_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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=0a000005000000000001000200030000000000000000000400000000
-> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "1:2:3::4", .port = 5 }
@@ -109,8 +109,8 @@
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_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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=0a000000000000000000000000000000000000000000000000000000
-> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::", .port = 0 }
@@ -126,8 +126,8 @@
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_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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=0a000000000000000000000000000000000000000000000100000000
-> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::1", .port = 0 }
@@ -143,8 +143,8 @@
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_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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=0a00ffff00000000ffffffffffffffffffffffffffffffff00000000
-> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 }
@@ -161,8 +161,8 @@
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_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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=0a00ffff00000000ffffffffffffffffffffffffffffffff00000000
-> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 }
@@ -179,8 +179,8 @@
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 uint32_t=0x0
- osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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
@@ -193,8 +193,8 @@
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 uint32_t=0x0
- osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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
@@ -207,8 +207,8 @@
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 uint32_t=0x0
- osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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
@@ -222,8 +222,8 @@
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 uint32_t=0x0
- osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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
@@ -237,8 +237,8 @@
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 uint32_t=0x0
- osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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
@@ -252,8 +252,8 @@
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 uint32_t=0x0
- osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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
@@ -266,8 +266,8 @@
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 uint32_t=0x0
- osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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
@@ -281,9 +281,9 @@
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_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_32n() rc == 0 uint32_t=0x1020304
+ osmo_sockaddr_str_to_32n() rc == 0 uint8_t[4]=[ 04 03 02 01 ]
-> 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 }
@@ -299,8 +299,8 @@
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 uint32_t=0x0
- osmo_sockaddr_str_to_32n() rc < 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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
@@ -316,8 +316,8 @@
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_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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=0a000001000000000000000000000000000000010a09080700000000
-> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::1:a09:807", .port = 1 }
@@ -335,9 +335,9 @@
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_32() rc == 0 uint32_t=0x0
+ 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_32n() rc == 0 uint32_t=0x0
+ osmo_sockaddr_str_to_32n() rc == 0 uint8_t[4]=[ 00 00 00 00 ]
-> osmo_sockaddr_str_from_32n() 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 }
@@ -354,8 +354,8 @@
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 = 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_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::", .port = 5 }
@@ -372,8 +372,8 @@
osmo_sockaddr_str_to_in6_addr() rc == 0 in6_addr=00000000000000000000000000000000
-> osmo_sockaddr_str_from_in6_addr() rc == 0 { .af = AF_INET6, .ip = "::", .port = 5 }
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_32() rc < 0 uint8_t[4]=[ 00 00 00 00 ]
+ osmo_sockaddr_str_to_32n() 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_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::", .port = 5 }