mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 01:10:08 +01:00
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:
parent
2786a30a7c
commit
edfb4e578e
1 changed files with 16 additions and 0 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue