platform/tests: add nmtst_inet6_from_string() helper

This returns a struct (not a pointer like nmtst_inet6_from_string_p()).
It is thus consistent with nmtst_inet4_from_string().
This commit is contained in:
Thomas Haller 2022-10-25 19:32:45 +02:00
parent 2786a30a7c
commit edfb4e578e
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -1604,6 +1604,22 @@ nmtst_inet6_from_string_p(const char *str)
return &addr;
}
static inline struct in6_addr
nmtst_inet6_from_string(const char *str)
{
struct in6_addr addr;
int success;
if (!str)
addr = in6addr_any;
else {
success = inet_pton(AF_INET6, str, &addr);
g_assert(success == 1);
}
return addr;
}
static inline gconstpointer
nmtst_inet_from_string(int addr_family, const char *str)
{