diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2019-11-11 19:20:42 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2019-11-24 19:59:35 +0100 |
commit | 951d32b817b58853cc928db19b7c544d88f29fc0 (patch) | |
tree | 3334874649e41b838ed806ca1ab4e25ee863b382 | |
parent | 06356fd9c3234574bd26d2f123acd334b4275f3c (diff) |
osmo_sockaddr_str: deprecate osmo_sockaddr_str_*_32n()
Follow up for patch I3cf150cc0cc06dd36039fbde091bc71b01697322
osmo_sockaddr_str_{from,to}_32n actually use host byte order. Deprecate these
and introduce a more accurately named version ending in h.
Change-Id: Ic7fc279bf3c741811cfc002538e28e8f8560e338
-rw-r--r-- | TODO-RELEASE | 4 | ||||
-rw-r--r-- | include/osmocom/core/sockaddr_str.h | 10 | ||||
-rw-r--r-- | src/sockaddr_str.c | 18 | ||||
-rw-r--r-- | tests/sockaddr_str/sockaddr_str_test.c | 8 | ||||
-rw-r--r-- | tests/sockaddr_str/sockaddr_str_test.ok | 56 |
5 files changed, 60 insertions, 36 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE index 692bdc18..be858aef 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -11,3 +11,7 @@ core osmo_tdef_get() change val_if_not_present arg from unsigned long to long core struct osmo_tdef fields min_val,max_val added, ABI break (arrays of structs used in programs) gsm API added osmo_gsm48_rfpowercap2powerclass() gb API added bssgp_bvc_ctx_free() +core osmo_sockaddr_str_from_32n(), + osmo_sockaddr_str_to_32n() Deprecate: named 'n' but use host byte order. +core osmo_sockaddr_str_from_32h(), + osmo_sockaddr_str_to_32h() New, use host byte order and are named appropriately. diff --git a/include/osmocom/core/sockaddr_str.h b/include/osmocom/core/sockaddr_str.h index d7a8cdf6..e42216a4 100644 --- a/include/osmocom/core/sockaddr_str.h +++ b/include/osmocom/core/sockaddr_str.h @@ -31,6 +31,7 @@ #include <stdint.h> #include <stdbool.h> #include <arpa/inet.h> +#include <osmocom/core/defs.h> struct in_addr; struct in6_addr; @@ -77,7 +78,7 @@ int osmo_sockaddr_str_from_str(struct osmo_sockaddr_str *sockaddr_str, const cha int osmo_sockaddr_str_from_in_addr(struct osmo_sockaddr_str *sockaddr_str, const struct in_addr *addr, uint16_t port); int osmo_sockaddr_str_from_in6_addr(struct osmo_sockaddr_str *sockaddr_str, const struct in6_addr *addr, uint16_t port); int osmo_sockaddr_str_from_32(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port); -int osmo_sockaddr_str_from_32n(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port); +int osmo_sockaddr_str_from_32h(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port); int osmo_sockaddr_str_from_sockaddr_in(struct osmo_sockaddr_str *sockaddr_str, const struct sockaddr_in *src); int osmo_sockaddr_str_from_sockaddr_in6(struct osmo_sockaddr_str *sockaddr_str, const struct sockaddr_in6 *src); int osmo_sockaddr_str_from_sockaddr(struct osmo_sockaddr_str *sockaddr_str, const struct sockaddr_storage *src); @@ -85,9 +86,14 @@ int osmo_sockaddr_str_from_sockaddr(struct osmo_sockaddr_str *sockaddr_str, cons int osmo_sockaddr_str_to_in_addr(const struct osmo_sockaddr_str *sockaddr_str, struct in_addr *dst); int osmo_sockaddr_str_to_in6_addr(const struct osmo_sockaddr_str *sockaddr_str, struct in6_addr *dst); int osmo_sockaddr_str_to_32(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip); -int osmo_sockaddr_str_to_32n(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip); +int osmo_sockaddr_str_to_32h(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip); int osmo_sockaddr_str_to_sockaddr_in(const struct osmo_sockaddr_str *sockaddr_str, struct sockaddr_in *dst); int osmo_sockaddr_str_to_sockaddr_in6(const struct osmo_sockaddr_str *sockaddr_str, struct sockaddr_in6 *dst); int osmo_sockaddr_str_to_sockaddr(const struct osmo_sockaddr_str *sockaddr_str, struct sockaddr_storage *dst); +int osmo_sockaddr_str_from_32n(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port) + OSMO_DEPRECATED("osmo_sockaddr_str_from_32n() actually uses *host* byte order. Use osmo_sockaddr_str_from_32h() instead"); +int osmo_sockaddr_str_to_32n(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip) + OSMO_DEPRECATED("osmo_sockaddr_str_to_32n() actually uses *host* byte order. Use osmo_sockaddr_str_to_32h() instead"); + /*! @} */ diff --git a/src/sockaddr_str.c b/src/sockaddr_str.c index 304363d9..c38a05cb 100644 --- a/src/sockaddr_str.c +++ b/src/sockaddr_str.c @@ -277,13 +277,20 @@ int osmo_sockaddr_str_from_32(struct osmo_sockaddr_str *sockaddr_str, uint32_t i * \param[in] port Port number. * \return 0 on success, negative on error. */ -int osmo_sockaddr_str_from_32n(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port) +int osmo_sockaddr_str_from_32h(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port) { if (!sockaddr_str) return -ENOSPC; return osmo_sockaddr_str_from_32(sockaddr_str, osmo_ntohl(ip), port); } +/*! DEPRECATED: the name suggests a conversion from network byte order, but actually converts from host byte order. Use + * osmo_sockaddr_str_from_32 for network byte order and osmo_sockaddr_str_from_32h for host byte order. */ +int osmo_sockaddr_str_from_32n(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port) +{ + return osmo_sockaddr_str_from_32h(sockaddr_str, ip, port); +} + /*! Convert IPv4 address and port to osmo_sockaddr_str. * \param[out] sockaddr_str The instance to copy to. * \param[in] src IPv4 address and port data. @@ -403,7 +410,7 @@ int osmo_sockaddr_str_to_32(const struct osmo_sockaddr_str *sockaddr_str, uint32 * \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) +int osmo_sockaddr_str_to_32h(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip) { int rc; uint32_t ip_h; @@ -418,6 +425,13 @@ int osmo_sockaddr_str_to_32n(const struct osmo_sockaddr_str *sockaddr_str, uint3 return 0; } +/*! DEPRECATED: the name suggests a conversion to network byte order, but actually converts to host byte order. Use + * osmo_sockaddr_str_to_32() for network byte order and osmo_sockaddr_str_to_32h() for host byte order. */ +int osmo_sockaddr_str_to_32n(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip) +{ + return osmo_sockaddr_str_to_32h(sockaddr_str, ip); +} + /*! Convert osmo_sockaddr_str address string and port to IPv4 address and port data. * \param[in] sockaddr_str The instance to convert the IP and port of. * \param[out] dst IPv4 address and port data to write to. diff --git a/tests/sockaddr_str/sockaddr_str_test.c b/tests/sockaddr_str/sockaddr_str_test.c index 7e015ce7..64a61043 100644 --- a/tests/sockaddr_str/sockaddr_str_test.c +++ b/tests/sockaddr_str/sockaddr_str_test.c @@ -165,14 +165,14 @@ void sockaddr_str_test_conversions() { uint32_t a = 0; - rc = osmo_sockaddr_str_to_32n(x, &a); - printf(" osmo_sockaddr_str_to_32n() %s uint8_t[4]=[ %s]\n", rc_name(rc), + rc = osmo_sockaddr_str_to_32h(x, &a); + printf(" osmo_sockaddr_str_to_32h() %s uint8_t[4]=[ %s]\n", rc_name(rc), osmo_hexdump((void*)&a, sizeof(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)); + rc = osmo_sockaddr_str_from_32h(&back, a, x->port); + printf(" -> osmo_sockaddr_str_from_32h() %s ", rc_name(rc)); dump_oip(&back); if (memcmp(x, &back, sizeof(back))) printf(" DIFFERS!\n"); diff --git a/tests/sockaddr_str/sockaddr_str_test.ok b/tests/sockaddr_str/sockaddr_str_test.ok index 33d9d7eb..910e9195 100644 --- a/tests/sockaddr_str/sockaddr_str_test.ok +++ b/tests/sockaddr_str/sockaddr_str_test.ok @@ -9,8 +9,8 @@ osmo_sockaddr_str_to_in6_addr() rc < 0 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_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_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 @@ -28,8 +28,8 @@ 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_from_32() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 0 } - 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_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 @@ -47,8 +47,8 @@ osmo_sockaddr_str_to_in6_addr() rc < 0 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_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_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 @@ -64,7 +64,7 @@ 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_32n() 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 @@ -78,7 +78,7 @@ 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_32n() 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 @@ -93,7 +93,7 @@ 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 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_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=0a000005000000000001000200030000000000000000000400000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "1:2:3::4", .port = 5 } @@ -110,7 +110,7 @@ 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 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_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=0a000000000000000000000000000000000000000000000000000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::", .port = 0 } @@ -127,7 +127,7 @@ 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 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_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=0a000000000000000000000000000000000000000000000100000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::1", .port = 0 } @@ -144,7 +144,7 @@ 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 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_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=0a00ffff00000000ffffffffffffffffffffffffffffffff00000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 } @@ -162,7 +162,7 @@ -> 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 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_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=0a00ffff00000000ffffffffffffffffffffffffffffffff00000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", .port = 65535 } @@ -180,7 +180,7 @@ 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_32n() 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 @@ -194,7 +194,7 @@ 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_32n() 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 @@ -208,7 +208,7 @@ 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_32n() 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 @@ -223,7 +223,7 @@ 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_32n() 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 @@ -238,7 +238,7 @@ 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_32n() 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 @@ -253,7 +253,7 @@ 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_32n() 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 @@ -267,7 +267,7 @@ 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_32n() 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 @@ -283,8 +283,8 @@ osmo_sockaddr_str_to_in6_addr() rc < 0 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_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_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 @@ -300,7 +300,7 @@ 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_32n() 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 @@ -317,7 +317,7 @@ -> 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 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_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=0a000001000000000000000000000000000000010a09080700000000 -> osmo_sockaddr_str_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::1:a09:807", .port = 1 } @@ -337,8 +337,8 @@ 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_from_32() rc == 0 { .af = AF_INET, .ip = "0.0.0.0", .port = 5 } - 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_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 @@ -355,7 +355,7 @@ 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 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_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_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::", .port = 5 } @@ -373,7 +373,7 @@ -> osmo_sockaddr_str_from_in6_addr() rc == 0 { .af = AF_INET6, .ip = "::", .port = 5 } DIFFERS! 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_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_from_sockaddr_in6() rc == 0 { .af = AF_INET6, .ip = "::", .port = 5 } |