diff --git a/src/core/nm-test-utils-core.h b/src/core/nm-test-utils-core.h index 467f9bb272..0ea41ba4bd 100644 --- a/src/core/nm-test-utils-core.h +++ b/src/core/nm-test-utils-core.h @@ -72,8 +72,8 @@ nmtst_platform_ip6_address(const char *address, const char *peer_address, guint g_assert(plen <= 128); memset(&addr, 0, sizeof(addr)); - addr.address = *nmtst_inet6_from_string(address); - addr.peer_address = *nmtst_inet6_from_string(peer_address); + addr.address = *nmtst_inet6_from_string_p(address); + addr.peer_address = *nmtst_inet6_from_string_p(peer_address); addr.plen = plen; return &addr; @@ -148,10 +148,10 @@ nmtst_platform_ip6_route(const char *network, guint plen, const char *gateway, c nm_assert(plen <= 128); memset(&route, 0, sizeof(route)); - route.network = *nmtst_inet6_from_string(network); + route.network = *nmtst_inet6_from_string_p(network); route.plen = plen; - route.gateway = *nmtst_inet6_from_string(gateway); - route.pref_src = *nmtst_inet6_from_string(pref_src); + route.gateway = *nmtst_inet6_from_string_p(gateway); + route.pref_src = *nmtst_inet6_from_string_p(pref_src); return &route; } diff --git a/src/core/platform/nm-fake-platform.c b/src/core/platform/nm-fake-platform.c index 49aa07e0d1..269fca6635 100644 --- a/src/core/platform/nm-fake-platform.c +++ b/src/core/platform/nm-fake-platform.c @@ -271,7 +271,7 @@ link_add_pre(NMPlatform *platform, g_assert(address_len == 0); device->obj = o; - device->ip6_lladdr = *nmtst_inet6_from_string(ip6_lladdr); + device->ip6_lladdr = *nmtst_inet6_from_string_p(ip6_lladdr); return device; } diff --git a/src/core/platform/tests/test-link.c b/src/core/platform/tests/test-link.c index 5e13ec13f3..ad2bee2c4b 100644 --- a/src/core/platform/tests/test-link.c +++ b/src/core/platform/tests/test-link.c @@ -1203,7 +1203,7 @@ _test_wireguard_change(NMPlatform *platform, int ifindex, int test_mode) .in6 = { .sin6_family = AF_INET6, - .sin6_addr = *nmtst_inet6_from_string( + .sin6_addr = *nmtst_inet6_from_string_p( nm_sprintf_buf(s_addr, "a:b:c:e::1:%d", i)), .sin6_port = htons(16000 + i), }, @@ -1225,7 +1225,7 @@ _test_wireguard_change(NMPlatform *platform, int ifindex, int test_mode) nm_sprintf_buf(s_addr, "10.%u.%u.0", i, i_allowed_ips)); aip->mask = 32 - (i_allowed_ips % 8); } else { - aip->addr.addr6 = *nmtst_inet6_from_string( + aip->addr.addr6 = *nmtst_inet6_from_string_p( nm_sprintf_buf(s_addr, "a:d:f:%02x:%02x::", i, i_allowed_ips)); aip->mask = 128 - (i_allowed_ips % 10); } @@ -1412,8 +1412,8 @@ test_software_detect(gconstpointer user_data) switch (test_data->test_mode) { case 0: - lnk_ip6tnl.local = *nmtst_inet6_from_string("fd01::15"); - lnk_ip6tnl.remote = *nmtst_inet6_from_string("fd01::16"); + lnk_ip6tnl.local = *nmtst_inet6_from_string_p("fd01::15"); + lnk_ip6tnl.remote = *nmtst_inet6_from_string_p("fd01::16"); lnk_ip6tnl.parent_ifindex = ifindex_parent; lnk_ip6tnl.tclass = 20; lnk_ip6tnl.encap_limit = 6; @@ -1421,8 +1421,8 @@ test_software_detect(gconstpointer user_data) lnk_ip6tnl.proto = IPPROTO_IPV6; break; case 1: - lnk_ip6tnl.local = *nmtst_inet6_from_string("fd01::17"); - lnk_ip6tnl.remote = *nmtst_inet6_from_string("fd01::18"); + lnk_ip6tnl.local = *nmtst_inet6_from_string_p("fd01::17"); + lnk_ip6tnl.remote = *nmtst_inet6_from_string_p("fd01::18"); lnk_ip6tnl.parent_ifindex = ifindex_parent; lnk_ip6tnl.tclass = 0; lnk_ip6tnl.encap_limit = 0; @@ -1452,8 +1452,8 @@ test_software_detect(gconstpointer user_data) gracefully_skip = nmp_utils_modprobe(NULL, TRUE, "ip6_gre", NULL) != 0; } - lnk_ip6tnl.local = *nmtst_inet6_from_string("fd01::42"); - lnk_ip6tnl.remote = *nmtst_inet6_from_string("fd01::aaaa"); + lnk_ip6tnl.local = *nmtst_inet6_from_string_p("fd01::42"); + lnk_ip6tnl.remote = *nmtst_inet6_from_string_p("fd01::aaaa"); lnk_ip6tnl.parent_ifindex = ifindex_parent; lnk_ip6tnl.tclass = 21; lnk_ip6tnl.flow_label = 1338; @@ -1479,8 +1479,8 @@ test_software_detect(gconstpointer user_data) gracefully_skip = nmp_utils_modprobe(NULL, TRUE, "ip6_gre", NULL) != 0; } - lnk_ip6tnl.local = *nmtst_inet6_from_string("fe80::abcd"); - lnk_ip6tnl.remote = *nmtst_inet6_from_string("fc01::bbbb"); + lnk_ip6tnl.local = *nmtst_inet6_from_string_p("fe80::abcd"); + lnk_ip6tnl.remote = *nmtst_inet6_from_string_p("fc01::bbbb"); lnk_ip6tnl.parent_ifindex = ifindex_parent; lnk_ip6tnl.ttl = 10; lnk_ip6tnl.tclass = 22; @@ -1608,8 +1608,8 @@ test_software_detect(gconstpointer user_data) case 1: lnk_vxlan.parent_ifindex = nm_platform_link_get_ifindex(NM_PLATFORM_GET, PARENT_NAME); lnk_vxlan.id = 11214423; - lnk_vxlan.local6 = *nmtst_inet6_from_string("1:2:3:4:334:23::23"); - lnk_vxlan.group6 = *nmtst_inet6_from_string("ff0e::115"); + lnk_vxlan.local6 = *nmtst_inet6_from_string_p("1:2:3:4:334:23::23"); + lnk_vxlan.group6 = *nmtst_inet6_from_string_p("ff0e::115"); lnk_vxlan.ttl = 32; lnk_vxlan.dst_port = 57412; lnk_vxlan.src_port_min = 1000; diff --git a/src/core/platform/tests/test-route.c b/src/core/platform/tests/test-route.c index f007d2bb77..3b3a3298f8 100644 --- a/src/core/platform/tests/test-route.c +++ b/src/core/platform/tests/test-route.c @@ -746,7 +746,7 @@ test_ip6_route_get(void) nmtstp_wait_for_signal(NM_PLATFORM_GET, 10); if (nmtstp_ip6_route_get(NM_PLATFORM_GET, ifindex, - nmtst_inet6_from_string("fd01:abcd::"), + nmtst_inet6_from_string_p("fd01:abcd::"), 64, NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6, NULL, @@ -754,7 +754,7 @@ test_ip6_route_get(void) break; }); - a = nmtst_inet6_from_string("fd01:abcd::42"); + a = nmtst_inet6_from_string_p("fd01:abcd::42"); result = nm_platform_ip_route_get(NM_PLATFORM_GET, AF_INET6, a, @@ -796,7 +796,7 @@ test_ip6_route_options(gconstpointer test_data) rts_add[rts_n++] = ((NMPlatformIP6Route){ .ifindex = IFINDEX, .rt_source = NM_IP_CONFIG_SOURCE_USER, - .network = *nmtst_inet6_from_string("2001:db8:a:b:0:0:0:0"), + .network = *nmtst_inet6_from_string_p("2001:db8:a:b:0:0:0:0"), .plen = 64, .gateway = in6addr_any, .metric = 1024, @@ -811,7 +811,7 @@ test_ip6_route_options(gconstpointer test_data) case 2: addr[addr_n++] = ((NMPlatformIP6Address){ .ifindex = IFINDEX, - .address = *nmtst_inet6_from_string("2000::2"), + .address = *nmtst_inet6_from_string_p("2000::2"), .plen = 128, .peer_address = in6addr_any, .lifetime = NM_PLATFORM_LIFETIME_PERMANENT, @@ -821,17 +821,17 @@ test_ip6_route_options(gconstpointer test_data) rts_add[rts_n++] = ((NMPlatformIP6Route){ .ifindex = IFINDEX, .rt_source = NM_IP_CONFIG_SOURCE_USER, - .network = *nmtst_inet6_from_string("1010::1"), + .network = *nmtst_inet6_from_string_p("1010::1"), .plen = 128, .gateway = in6addr_any, .metric = 256, - .pref_src = *nmtst_inet6_from_string("2000::2"), + .pref_src = *nmtst_inet6_from_string_p("2000::2"), }); break; case 3: addr[addr_n++] = ((NMPlatformIP6Address){ .ifindex = IFINDEX, - .address = *nmtst_inet6_from_string("2001:db8:8086::5"), + .address = *nmtst_inet6_from_string_p("2001:db8:8086::5"), .plen = 128, .peer_address = in6addr_any, .lifetime = NM_PLATFORM_LIFETIME_PERMANENT, @@ -841,7 +841,7 @@ test_ip6_route_options(gconstpointer test_data) rts_add[rts_n++] = ((NMPlatformIP6Route){ .ifindex = IFINDEX, .rt_source = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER), - .network = *nmtst_inet6_from_string("2001:db8:8086::"), + .network = *nmtst_inet6_from_string_p("2001:db8:8086::"), .plen = 110, .metric = 10021, .mss = 0, @@ -849,9 +849,9 @@ test_ip6_route_options(gconstpointer test_data) rts_add[rts_n++] = ((NMPlatformIP6Route){ .ifindex = IFINDEX, .rt_source = nmp_utils_ip_config_source_round_trip_rtprot(NM_IP_CONFIG_SOURCE_USER), - .network = *nmtst_inet6_from_string("2001:db8:abad:c0de::"), + .network = *nmtst_inet6_from_string_p("2001:db8:abad:c0de::"), .plen = 64, - .gateway = *nmtst_inet6_from_string("2001:db8:8086::1"), + .gateway = *nmtst_inet6_from_string_p("2001:db8:8086::1"), .metric = 21, .mss = 0, }); @@ -1330,7 +1330,7 @@ _rule_create_random(NMPlatform *platform) p_addr->addr4 = nmtst_inet4_from_string(nm_sprintf_buf(saddr, "192.192.5.%u", (~p) % 256u)); else - p_addr->addr6 = *nmtst_inet6_from_string( + p_addr->addr6 = *nmtst_inet6_from_string_p( nm_sprintf_buf(saddr, "1:2:3:4::f:%02x", (~p) % 256u)); } else if ((p % 3u) == 1) nmtst_rand_buf(NULL, p_addr, addr_size); diff --git a/src/core/tests/test-core.c b/src/core/tests/test-core.c index 07309518f1..7c29c6fcad 100644 --- a/src/core/tests/test-core.c +++ b/src/core/tests/test-core.c @@ -152,8 +152,8 @@ test_logging_error(void) static void _test_same_prefix(const char *a1, const char *a2, guint8 plen) { - struct in6_addr a = *nmtst_inet6_from_string(a1); - struct in6_addr b = *nmtst_inet6_from_string(a2); + struct in6_addr a = *nmtst_inet6_from_string_p(a1); + struct in6_addr b = *nmtst_inet6_from_string_p(a2); g_assert(nm_ip6_addr_same_prefix(&a, &b, plen)); } diff --git a/src/core/tests/test-l3cfg.c b/src/core/tests/test-l3cfg.c index 29ccb27e24..652aa8b6e5 100644 --- a/src/core/tests/test-l3cfg.c +++ b/src/core/tests/test-l3cfg.c @@ -418,7 +418,7 @@ test_l3cfg(gconstpointer test_data) nm_l3_config_data_add_address_6( l3cd, - NM_PLATFORM_IP6_ADDRESS_INIT(.address = *nmtst_inet6_from_string("1:2:3:4::45"), + NM_PLATFORM_IP6_ADDRESS_INIT(.address = *nmtst_inet6_from_string_p("1:2:3:4::45"), .plen = 64, )); if (nmtst_get_rand_one_case_in(2)) @@ -985,7 +985,7 @@ test_l3_ipv6ll(gconstpointer test_data) nmtstp_ip6_address_add(tdata->f->platform, -1, tdata->f->ifindex1, - *nmtst_inet6_from_string(_LLADDR_TEST1), + *nmtst_inet6_from_string_p(_LLADDR_TEST1), 64, in6addr_any, NM_PLATFORM_LIFETIME_PERMANENT, diff --git a/src/libnm-core-impl/tests/test-general.c b/src/libnm-core-impl/tests/test-general.c index 6a85fe4c79..fa2a3823c9 100644 --- a/src/libnm-core-impl/tests/test-general.c +++ b/src/libnm-core-impl/tests/test-general.c @@ -10430,7 +10430,7 @@ static void test_nm_ip_addr_zero(void) { in_addr_t a4 = nmtst_inet4_from_string("0.0.0.0"); - struct in6_addr a6 = *nmtst_inet6_from_string("::"); + struct in6_addr a6 = *nmtst_inet6_from_string_p("::"); char buf[NM_INET_ADDRSTRLEN]; NMIPAddr a = NM_IP_ADDR_INIT; diff --git a/src/libnm-glib-aux/nm-test-utils.h b/src/libnm-glib-aux/nm-test-utils.h index 6b4ed18916..bda021ba1e 100644 --- a/src/libnm-glib-aux/nm-test-utils.h +++ b/src/libnm-glib-aux/nm-test-utils.h @@ -1589,7 +1589,7 @@ nmtst_inet4_from_string(const char *str) } static inline const struct in6_addr * -nmtst_inet6_from_string(const char *str) +nmtst_inet6_from_string_p(const char *str) { static _nm_thread_local struct in6_addr addr; int success; @@ -1614,7 +1614,7 @@ nmtst_inet_from_string(int addr_family, const char *str) return &a; } if (addr_family == AF_INET6) - return nmtst_inet6_from_string(str); + return nmtst_inet6_from_string_p(str); g_assert_not_reached(); return NULL; @@ -1673,7 +1673,7 @@ _nmtst_assert_ip6_address(const char *file, if (!addr) addr = &any; - if (memcmp(nmtst_inet6_from_string(str_expected), addr, sizeof(*addr)) != 0) { + if (memcmp(nmtst_inet6_from_string_p(str_expected), addr, sizeof(*addr)) != 0) { char buf[100]; g_error("%s:%d: Unexpected IPv6 address: expected %s, got %s",