From 3f4586532ffb8db2136bbb4ef906fd21d17d5bd2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 29 Mar 2022 22:45:26 +0200 Subject: [PATCH 01/23] glib-aux: add nm_utils_get_monotonic_timestamp_sec_cached() helper --- src/libnm-glib-aux/nm-time-utils.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libnm-glib-aux/nm-time-utils.h b/src/libnm-glib-aux/nm-time-utils.h index 3c3e935f8d..461d6845fb 100644 --- a/src/libnm-glib-aux/nm-time-utils.h +++ b/src/libnm-glib-aux/nm-time-utils.h @@ -41,6 +41,12 @@ nm_utils_get_monotonic_timestamp_msec_cached(gint64 *cache_now) return (*cache_now) ?: (*cache_now = nm_utils_get_monotonic_timestamp_msec()); } +static inline gint32 +nm_utils_get_monotonic_timestamp_sec_cached(gint32 *cache_now) +{ + return (*cache_now) ?: (*cache_now = nm_utils_get_monotonic_timestamp_sec()); +} + gint64 nm_utils_clock_gettime_nsec(clockid_t clockid); gint64 nm_utils_clock_gettime_msec(clockid_t clockid); From fcb4033a81a12c53d5f31ad1a435bc791c03a603 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 25 Mar 2022 20:33:24 +0100 Subject: [PATCH 02/23] platform: add logging statements to nm_platform_ip_address_sync() for printf() debugging The code is disabled at compile time. It's only useful for printf debugging to modify the source to get more logging. --- src/libnm-platform/nm-platform.c | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index 21a29004a8..85ccde782c 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -3987,6 +3987,7 @@ nm_platform_ip_address_sync(NMPlatform *self, const gint32 now = nm_utils_get_monotonic_timestamp_sec(); const int IS_IPv4 = NM_IS_IPv4(addr_family); NMPLookup lookup; + const gboolean EXTRA_LOGGING = FALSE; gs_unref_hashtable GHashTable *known_addresses_idx = NULL; gs_unref_ptrarray GPtrArray *plat_addresses = NULL; gboolean success; @@ -3997,6 +3998,39 @@ nm_platform_ip_address_sync(NMPlatform *self, _CHECK_SELF(self, klass, FALSE); + /* Disabled. Enable this for printf debugging. */ + if (EXTRA_LOGGING) { + char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf1[50]; + + _LOG3T("IPv%c address sync on %d (%u addresses, %u to prune)", + nm_utils_addr_family_to_char(addr_family), + ifindex, + nm_g_ptr_array_len(known_addresses), + nm_g_ptr_array_len(addresses_prune)); + for (i = 0; known_addresses && i < known_addresses->len; i++) { + _LOG3T(" address#%u: %s%s", + i, + nmp_object_to_string(known_addresses->pdata[i], + NMP_OBJECT_TO_STRING_ALL, + sbuf, + sizeof(sbuf)), + IS_IPv4 ? "" + : nm_sprintf_buf(sbuf1, + " (scope %d)", + (int) ip6_address_scope(NMP_OBJECT_CAST_IP6_ADDRESS( + known_addresses->pdata[i])))); + } + for (i = 0; addresses_prune && i < addresses_prune->len; i++) { + _LOG3T(" prune #%u: %s", + i, + nmp_object_to_string(addresses_prune->pdata[i], + NMP_OBJECT_TO_STRING_ALL, + sbuf, + sizeof(sbuf))); + } + } + /* @known_addresses (IPv4) are in decreasing priority order (highest priority addresses first). * @known_addresses (IPv6) are in increasing priority order (highest priority addresses last) (we will sort them by scope next). */ @@ -4047,6 +4081,25 @@ nm_platform_ip_address_sync(NMPlatform *self, NULL, NULL); + if (EXTRA_LOGGING && plat_addresses) { + for (i = 0; i < plat_addresses->len; i++) { + char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf1[50]; + + _LOG3T(" platform#%u: %s%s", + i, + nmp_object_to_string(plat_addresses->pdata[i], + NMP_OBJECT_TO_STRING_ALL, + sbuf, + sizeof(sbuf)), + IS_IPv4 ? "" + : nm_sprintf_buf(sbuf1, + " (scope %d)", + (int) ip6_address_scope(NMP_OBJECT_CAST_IP6_ADDRESS( + plat_addresses->pdata[i])))); + } + } + if (nm_g_ptr_array_len(plat_addresses) > 0) { /* Delete addresses that interfere with our intended order. */ if (IS_IPv4) { From 6bc9b73c5550b1dad722ef77952df187875ebbd9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Mar 2022 21:19:21 +0200 Subject: [PATCH 03/23] platform: allocate result array when needed in nm_platform_ip_{address,route}_get_prune_list() It is rather unlikely, that we call this function with no existing routes/addresses. Hence, usually this does not safe an allocation of the GPtrArray. However, it's slightly less code and makes more sense this way (instead of checking afterwards, whether the array is empty and destroy it). --- src/libnm-platform/nm-platform.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index 85ccde782c..6b1b395cbc 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -4431,7 +4431,7 @@ nm_platform_ip_address_get_prune_list(NMPlatform *self, const int IS_IPv4 = NM_IS_IPv4(addr_family); const NMDedupMultiHeadEntry *head_entry; NMPLookup lookup; - GPtrArray *result; + GPtrArray *result = NULL; CList *iter; nmp_lookup_init_object(&lookup, NMP_OBJECT_TYPE_IP_ADDRESS(NM_IS_IPv4(addr_family)), ifindex); @@ -4441,8 +4441,6 @@ nm_platform_ip_address_get_prune_list(NMPlatform *self, if (!head_entry) return NULL; - result = g_ptr_array_new_full(head_entry->len, (GDestroyNotify) nmp_object_unref); - c_list_for_each (iter, &head_entry->lst_entries_head) { const NMPObject *obj = c_list_entry(iter, NMDedupMultiEntry, lst_entries)->obj; @@ -4452,13 +4450,12 @@ nm_platform_ip_address_get_prune_list(NMPlatform *self, continue; } + if (!result) + result = g_ptr_array_new_full(head_entry->len, (GDestroyNotify) nmp_object_unref); + g_ptr_array_add(result, (gpointer) nmp_object_ref(obj)); } - if (result->len == 0) { - g_ptr_array_unref(result); - return NULL; - } return result; } @@ -4469,7 +4466,7 @@ nm_platform_ip_route_get_prune_list(NMPlatform *self, NMIPRouteTableSyncMode route_table_sync) { NMPLookup lookup; - GPtrArray *routes_prune; + GPtrArray *routes_prune = NULL; const NMDedupMultiHeadEntry *head_entry; CList *iter; NMPlatformIP4Route rt_local4; @@ -4501,8 +4498,6 @@ nm_platform_ip_route_get_prune_list(NMPlatform *self, rt_local6.plen = 0; rt_mcast6.plen = 0; - routes_prune = g_ptr_array_new_full(head_entry->len, (GDestroyNotify) nm_dedup_multi_obj_unref); - c_list_for_each (iter, &head_entry->lst_entries_head) { const NMPObject *obj = c_list_entry(iter, NMDedupMultiEntry, lst_entries)->obj; const NMPlatformIPXRoute *rt = NMP_OBJECT_CAST_IPX_ROUTE(obj); @@ -4640,13 +4635,14 @@ nm_platform_ip_route_get_prune_list(NMPlatform *self, break; } + if (!routes_prune) { + routes_prune = + g_ptr_array_new_full(head_entry->len, (GDestroyNotify) nm_dedup_multi_obj_unref); + } + g_ptr_array_add(routes_prune, (gpointer) nmp_object_ref(obj)); } - if (routes_prune->len == 0) { - g_ptr_array_unref(routes_prune); - return NULL; - } return routes_prune; } From 305f11069fa2960b8a734ebf14f2f803b9d6283d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Mar 2022 21:36:16 +0200 Subject: [PATCH 04/23] platform: add ascending/descending functions for ip6_address_scope_cmp*() It seems easier to read, than passing a boolean parameter. --- src/libnm-platform/nm-platform.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index 6b1b395cbc..61e18b077e 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -3941,21 +3941,19 @@ ip6_address_scope(const NMPlatformIP6Address *a) } static int -ip6_address_scope_cmp(gconstpointer p_a, gconstpointer p_b, gpointer increasing) +ip6_address_scope_cmp_ascending(gconstpointer p_a, gconstpointer p_b, gpointer unused) { - const NMPlatformIP6Address *a; - const NMPlatformIP6Address *b; - - if (!increasing) - NM_SWAP(&p_a, &p_b); - - a = NMP_OBJECT_CAST_IP6_ADDRESS(*(const NMPObject *const *) p_a); - b = NMP_OBJECT_CAST_IP6_ADDRESS(*(const NMPObject *const *) p_b); - - NM_CMP_DIRECT(ip6_address_scope(a), ip6_address_scope(b)); + NM_CMP_DIRECT(ip6_address_scope(NMP_OBJECT_CAST_IP6_ADDRESS(*(const NMPObject *const *) p_a)), + ip6_address_scope(NMP_OBJECT_CAST_IP6_ADDRESS(*(const NMPObject *const *) p_b))); return 0; } +static int +ip6_address_scope_cmp_descending(gconstpointer p_a, gconstpointer p_b, gpointer unused) +{ + return ip6_address_scope_cmp_ascending(p_b, p_a, NULL); +} + /** * nm_platform_ip_address_sync: * @self: platform instance @@ -4040,9 +4038,7 @@ nm_platform_ip_address_sync(NMPlatform *self, * unnecessary change the order of addresses with different scopes. */ if (!IS_IPv4) { if (known_addresses) - g_ptr_array_sort_with_data(known_addresses, - ip6_address_scope_cmp, - GINT_TO_POINTER(TRUE)); + g_ptr_array_sort_with_data(known_addresses, ip6_address_scope_cmp_ascending, NULL); } if (!_addr_array_clean_expired(addr_family, @@ -4211,9 +4207,7 @@ nm_platform_ip_address_sync(NMPlatform *self, /* For IPv6, we only compare addresses per-scope. Addresses in different * scopes don't have a defined order. */ - g_ptr_array_sort_with_data(plat_addresses, - ip6_address_scope_cmp, - GINT_TO_POINTER(FALSE)); + g_ptr_array_sort_with_data(plat_addresses, ip6_address_scope_cmp_descending, NULL); known_addresses_len = nm_g_ptr_array_len(known_addresses); From de9f174d51162ee32b648342eb841d8f77dc2d01 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 29 Mar 2022 12:32:16 +0200 Subject: [PATCH 05/23] platform: make "idx" argument in _addr_array_clean_expired() mandatory There is only one caller of _addr_array_clean_expired(), and it always provides the "idx" pointer. --- src/libnm-platform/nm-platform.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index 61e18b077e..afe66c4b4e 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -3741,14 +3741,13 @@ _addr_array_clean_expired(int addr_family, if (!nmp_utils_lifetime_get(a->timestamp, a->lifetime, a->preferred, now, NULL)) goto clear_and_next; - if (idx) { - if (G_UNLIKELY(!*idx)) { - *idx = g_hash_table_new((GHashFunc) nmp_object_id_hash, - (GEqualFunc) nmp_object_id_equal); - } - if (!g_hash_table_add(*idx, (gpointer) NMP_OBJECT_UP_CAST(a))) - nm_assert_not_reached(); + if (G_UNLIKELY(!*idx)) { + *idx = + g_hash_table_new((GHashFunc) nmp_object_id_hash, (GEqualFunc) nmp_object_id_equal); } + if (!g_hash_table_add(*idx, (gpointer) NMP_OBJECT_UP_CAST(a))) + nm_assert_not_reached(); + any_addrs = TRUE; continue; From 31299473cda16b61a565aad60d5bc1b93610c101 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 29 Mar 2022 17:00:56 +0200 Subject: [PATCH 06/23] platform: rename local variable in nm_platform_ip_address_sync() --- src/libnm-platform/nm-platform.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index afe66c4b4e..ba4d04d77b 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -4312,18 +4312,18 @@ next_plat:; * priority. */ for (i_know = 0; i_know < known_addresses->len; i_know++) { + const NMPObject *known_obj; const NMPlatformIPXAddress *known_address; - const NMPObject *o; guint32 lifetime; guint32 preferred; - o = known_addresses->pdata[i_know]; - if (!o) + known_obj = known_addresses->pdata[i_know]; + if (!known_obj) continue; - nm_assert(NMP_OBJECT_GET_TYPE(o) == NMP_OBJECT_TYPE_IP_ADDRESS(IS_IPv4)); + nm_assert(NMP_OBJECT_GET_TYPE(known_obj) == NMP_OBJECT_TYPE_IP_ADDRESS(IS_IPv4)); - known_address = NMP_OBJECT_CAST_IPX_ADDRESS(o); + known_address = NMP_OBJECT_CAST_IPX_ADDRESS(known_obj); lifetime = nmp_utils_lifetime_get(known_address->ax.timestamp, known_address->ax.lifetime, From 3bd5d2bca9bba663004287e402613de32bb62bae Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 29 Mar 2022 17:18:44 +0200 Subject: [PATCH 07/23] platform: avoid duplicated code in _nmp_object_stackinit_from_type() --- src/libnm-platform/nmp-object.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/libnm-platform/nmp-object.c b/src/libnm-platform/nmp-object.c index d518e6e589..c5a936e5ed 100644 --- a/src/libnm-platform/nmp-object.c +++ b/src/libnm-platform/nmp-object.c @@ -799,7 +799,7 @@ nmp_object_new_link(int ifindex) /*****************************************************************************/ -static void +static NMPObject * _nmp_object_stackinit_from_class(NMPObject *obj, const NMPClass *klass) { nm_assert(obj); @@ -812,25 +812,13 @@ _nmp_object_stackinit_from_class(NMPObject *obj, const NMPClass *klass) ._ref_count = NM_OBJ_REF_COUNT_STACKINIT, }, }; + return obj; } static NMPObject * _nmp_object_stackinit_from_type(NMPObject *obj, NMPObjectType obj_type) { - const NMPClass *klass; - - nm_assert(obj); - klass = nmp_class_from_type(obj_type); - nm_assert(klass); - - *obj = (NMPObject){ - .parent = - { - .klass = (const NMDedupMultiObjClass *) klass, - ._ref_count = NM_OBJ_REF_COUNT_STACKINIT, - }, - }; - return obj; + return _nmp_object_stackinit_from_class(obj, nmp_class_from_type(obj_type)); } const NMPObject * From deb37401e95d4ea0025e406424c8da7c10bc9712 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 29 Mar 2022 22:45:56 +0200 Subject: [PATCH 08/23] platform: make "now" timestamp an in/out parameter to nmp_utils_lifetime_get() nmp_utils_lifetime_get() calculates the lifetime of addresses, and it bases the result on a "now" timestamp. If you have two addresses and calculate their expiry, then we want to base it on top of the same "now" timestamp, meaning, we should only call nm_utils_get_monotonic_timestamp_sec() once. This is also a performance optimization. But much more importantly, when we make a comparison at a certain moment, we need that all sides have the same understanding of the current timestamp. But nmp_utils_lifetime_get() does not always require the now timestamp. And the caller doesn't know, whether it will need it (short of knowing how nmp_utils_lifetime_get() is implemented). So, make the now parameter an in/out argument. If we pass in an already valid now timestamp, use that. Otherwise, fetch the current time and also return it. --- src/core/ndisc/nm-ndisc.c | 3 ++- src/libnm-platform/nm-platform-utils.c | 12 +++++++----- src/libnm-platform/nm-platform-utils.h | 2 +- src/libnm-platform/nm-platform.c | 13 +++++++------ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/core/ndisc/nm-ndisc.c b/src/core/ndisc/nm-ndisc.c index 969eacfaba..04b673e51d 100644 --- a/src/core/ndisc/nm-ndisc.c +++ b/src/core/ndisc/nm-ndisc.c @@ -996,6 +996,7 @@ nm_ndisc_set_config(NMNDisc *ndisc, const NML3ConfigData *l3cd) const NMPObject *obj; guint len; guint i; + gint32 fake_now = NM_NDISC_EXPIRY_BASE_TIMESTAMP / 1000; nm_assert(NM_IS_NDISC(ndisc)); nm_assert(nm_ndisc_get_node_type(ndisc) == NM_NDISC_NODE_TYPE_ROUTER); @@ -1018,7 +1019,7 @@ nm_ndisc_set_config(NMNDisc *ndisc, const NML3ConfigData *l3cd) lifetime = nmp_utils_lifetime_get(addr->timestamp, addr->lifetime, addr->preferred, - NM_NDISC_EXPIRY_BASE_TIMESTAMP / 1000, + &fake_now, &preferred); if (!lifetime) continue; diff --git a/src/libnm-platform/nm-platform-utils.c b/src/libnm-platform/nm-platform-utils.c index 9ad030df76..bebc53a851 100644 --- a/src/libnm-platform/nm-platform-utils.c +++ b/src/libnm-platform/nm-platform-utils.c @@ -2132,12 +2132,15 @@ guint32 nmp_utils_lifetime_get(guint32 timestamp, guint32 lifetime, guint32 preferred, - gint32 now, + gint32 *cached_now, guint32 *out_preferred) { - guint32 t_lifetime, t_preferred; + guint32 t_lifetime; + guint32 t_preferred; + gint32 now; - nm_assert(now >= 0); + nm_assert(cached_now); + nm_assert(*cached_now >= 0); if (timestamp == 0 && lifetime == 0) { /* We treat lifetime==0 && timestamp==0 addresses as permanent addresses to allow easy @@ -2150,8 +2153,7 @@ nmp_utils_lifetime_get(guint32 timestamp, return NM_PLATFORM_LIFETIME_PERMANENT; } - if (now <= 0) - now = nm_utils_get_monotonic_timestamp_sec(); + now = nm_utils_get_monotonic_timestamp_sec_cached(cached_now); t_lifetime = nmp_utils_lifetime_rebase_relative_time_on_now(timestamp, lifetime, now); if (!t_lifetime) { diff --git a/src/libnm-platform/nm-platform-utils.h b/src/libnm-platform/nm-platform-utils.h index a9ccebb3e2..9f17da4886 100644 --- a/src/libnm-platform/nm-platform-utils.h +++ b/src/libnm-platform/nm-platform-utils.h @@ -86,7 +86,7 @@ nmp_utils_lifetime_rebase_relative_time_on_now(guint32 timestamp, guint32 durati guint32 nmp_utils_lifetime_get(guint32 timestamp, guint32 lifetime, guint32 preferred, - gint32 now, + gint32 *cached_now, guint32 *out_preferred); int nmp_utils_modprobe(GError **error, gboolean suppress_error_logging, const char *arg1, ...) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index ba4d04d77b..459b911367 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -3696,7 +3696,7 @@ static gboolean _addr_array_clean_expired(int addr_family, int ifindex, GPtrArray *array, - guint32 now, + gint32 *cached_now, GHashTable **idx) { guint i; @@ -3704,7 +3704,8 @@ _addr_array_clean_expired(int addr_family, nm_assert_addr_family(addr_family); nm_assert(ifindex > 0); - nm_assert(now > 0); + nm_assert(cached_now); + nm_assert(*cached_now >= 0); if (!array) return FALSE; @@ -3738,7 +3739,7 @@ _addr_array_clean_expired(int addr_family, goto clear_and_next; } - if (!nmp_utils_lifetime_get(a->timestamp, a->lifetime, a->preferred, now, NULL)) + if (!nmp_utils_lifetime_get(a->timestamp, a->lifetime, a->preferred, cached_now, NULL)) goto clear_and_next; if (G_UNLIKELY(!*idx)) { @@ -3981,7 +3982,7 @@ nm_platform_ip_address_sync(NMPlatform *self, GPtrArray *known_addresses, GPtrArray *addresses_prune) { - const gint32 now = nm_utils_get_monotonic_timestamp_sec(); + gint32 now = 0; const int IS_IPv4 = NM_IS_IPv4(addr_family); NMPLookup lookup; const gboolean EXTRA_LOGGING = FALSE; @@ -4043,7 +4044,7 @@ nm_platform_ip_address_sync(NMPlatform *self, if (!_addr_array_clean_expired(addr_family, ifindex, known_addresses, - now, + &now, &known_addresses_idx)) known_addresses = NULL; @@ -4328,7 +4329,7 @@ next_plat:; lifetime = nmp_utils_lifetime_get(known_address->ax.timestamp, known_address->ax.lifetime, known_address->ax.preferred, - now, + &now, &preferred); nm_assert(lifetime > 0); From 7c92663f8d79375c78f6917d4c6e005d7accf2a6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 29 Mar 2022 18:21:49 +0200 Subject: [PATCH 09/23] platform: make NMPlatformVTableAddress struct smaller and pack NMPObjectType --- src/libnm-platform/nm-platform.h | 6 +++--- src/libnm-platform/nmp-base.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h index c6d6d6917a..93b644a3d8 100644 --- a/src/libnm-platform/nm-platform.h +++ b/src/libnm-platform/nm-platform.h @@ -776,10 +776,10 @@ typedef struct { #undef __NMPlatformObjWithIfindex_COMMON typedef struct { - gboolean is_ip4; + bool is_ip4; + gint8 addr_family; + guint8 sizeof_route; NMPObjectType obj_type; - int addr_family; - gsize sizeof_route; int (*route_cmp)(const NMPlatformIPXRoute *a, const NMPlatformIPXRoute *b, NMPlatformIPRouteCmpType cmp_type); diff --git a/src/libnm-platform/nmp-base.h b/src/libnm-platform/nmp-base.h index a80fd4d389..4863168855 100644 --- a/src/libnm-platform/nmp-base.h +++ b/src/libnm-platform/nmp-base.h @@ -110,7 +110,7 @@ typedef struct _NMPlatformIP6Route NMPlatformIP6Route; typedef struct _NMPlatformLink NMPlatformLink; typedef struct _NMPObject NMPObject; -typedef enum { +typedef enum _nm_packed { NMP_OBJECT_TYPE_UNKNOWN, NMP_OBJECT_TYPE_LINK, From ef1b60c061f85b60329d37d62dc81683ff56f4b7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 29 Mar 2022 18:20:31 +0200 Subject: [PATCH 10/23] platform: add semantic comparison for IP addresses and add "nm_platform_vtable_address" We already have a comparison of NMPlatformIPXAddress with the modes "full" and "id". The former is needed to fully compare two addresses, the latter as identity for tracking addresses in the cache. In NetworkManager we also use the NMPlatformIP[46]Address structure to track the addresses we want to configure. When we add them in kernel, we will later see them in the platform cache. However, some fields will be slightly different. For example, "addr_source" address will always be "kernel", because that one is not a field we configure in kernel. Also, the "n_ifa_flags" probably differ (getting "permanent" and "secondary" flags). Add a compare function that can ignore such differences. Also add nm_platform_vtable_address for accessing the IPv4 and IPv6 methods generically (based on an "IS_IPv4" variable). --- src/libnm-platform/nm-platform.c | 165 +++++++++++++++++++++++++------ src/libnm-platform/nm-platform.h | 49 ++++++++- src/libnm-platform/nmp-object.c | 82 +++++++-------- 3 files changed, 224 insertions(+), 72 deletions(-) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index 459b911367..a6e925162c 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -7937,6 +7937,25 @@ _address_pretty_sort_get_prio_6(const struct in6_addr *addr) return 6; } +static int +_address_cmp_expiry(const NMPlatformIPAddress *a, const NMPlatformIPAddress *b) +{ + guint32 lifetime_a; + guint32 lifetime_b; + guint32 preferred_a; + guint32 preferred_b; + gint32 now = 0; + + lifetime_a = + nmp_utils_lifetime_get(a->timestamp, a->lifetime, a->preferred, &now, &preferred_a); + lifetime_b = + nmp_utils_lifetime_get(b->timestamp, b->lifetime, b->preferred, &now, &preferred_b); + + NM_CMP_DIRECT(lifetime_a, lifetime_b); + NM_CMP_DIRECT(preferred_a, preferred_b); + return 0; +} + int nm_platform_ip6_address_pretty_sort_cmp(const NMPlatformIP6Address *a1, const NMPlatformIP6Address *a2, @@ -8016,26 +8035,55 @@ nm_platform_ip4_address_hash_update(const NMPlatformIP4Address *obj, NMHashState } int -nm_platform_ip4_address_cmp(const NMPlatformIP4Address *a, const NMPlatformIP4Address *b) +nm_platform_ip4_address_cmp(const NMPlatformIP4Address *a, + const NMPlatformIP4Address *b, + NMPlatformIPAddressCmpType cmp_type) { NM_CMP_SELF(a, b); + NM_CMP_FIELD(a, b, ifindex); - NM_CMP_FIELD(a, b, address); NM_CMP_FIELD(a, b, plen); - NM_CMP_FIELD(a, b, peer_address); - NM_CMP_FIELD_UNSAFE(a, b, use_ip4_broadcast_address); - if (a->use_ip4_broadcast_address) - NM_CMP_FIELD(a, b, broadcast_address); - NM_CMP_FIELD(a, b, addr_source); - NM_CMP_FIELD(a, b, timestamp); - NM_CMP_FIELD(a, b, lifetime); - NM_CMP_FIELD(a, b, preferred); - NM_CMP_FIELD(a, b, n_ifa_flags); - NM_CMP_FIELD_STR(a, b, label); - NM_CMP_FIELD_UNSAFE(a, b, a_acd_not_ready); - NM_CMP_FIELD_UNSAFE(a, b, a_assume_config_once); - NM_CMP_FIELD_UNSAFE(a, b, a_force_commit); - return 0; + NM_CMP_FIELD(a, b, address); + + switch (cmp_type) { + case NM_PLATFORM_IP_ADDRESS_CMP_TYPE_ID: + /* for IPv4 addresses, you can add the same local address with differing peer-address + * (IFA_ADDRESS), provided that their net-part differs. */ + NM_CMP_DIRECT_IN4ADDR_SAME_PREFIX(a->peer_address, b->peer_address, a->plen); + return 0; + case NM_PLATFORM_IP_ADDRESS_CMP_TYPE_SEMANTICALLY: + case NM_PLATFORM_IP_ADDRESS_CMP_TYPE_FULL: + NM_CMP_FIELD(a, b, peer_address); + NM_CMP_FIELD_STR(a, b, label); + if (cmp_type == NM_PLATFORM_IP_ADDRESS_CMP_TYPE_SEMANTICALLY) { + NM_CMP_RETURN(_address_cmp_expiry((const NMPlatformIPAddress *) a, + (const NMPlatformIPAddress *) b)); + + /* Most flags are set by kernel. We only compare the ones that + * NetworkManager actively sets. + * + * NM actively only sets IFA_F_NOPREFIXROUTE (and IFA_F_MANAGETEMPADDR for IPv6), + * where nm_platform_ip_address_sync() always sets IFA_F_NOPREFIXROUTE. + * There are thus no flags to compare for IPv4. */ + + NM_CMP_DIRECT(nm_platform_ip4_broadcast_address_from_addr(a), + nm_platform_ip4_broadcast_address_from_addr(b)); + } else { + NM_CMP_FIELD(a, b, timestamp); + NM_CMP_FIELD(a, b, lifetime); + NM_CMP_FIELD(a, b, preferred); + NM_CMP_FIELD(a, b, n_ifa_flags); + NM_CMP_FIELD(a, b, addr_source); + NM_CMP_FIELD_UNSAFE(a, b, use_ip4_broadcast_address); + if (a->use_ip4_broadcast_address) + NM_CMP_FIELD(a, b, broadcast_address); + NM_CMP_FIELD_UNSAFE(a, b, a_acd_not_ready); + NM_CMP_FIELD_UNSAFE(a, b, a_assume_config_once); + NM_CMP_FIELD_UNSAFE(a, b, a_force_commit); + } + return 0; + } + return nm_assert_unreachable_val(0); } void @@ -8056,25 +8104,51 @@ nm_platform_ip6_address_hash_update(const NMPlatformIP6Address *obj, NMHashState } int -nm_platform_ip6_address_cmp(const NMPlatformIP6Address *a, const NMPlatformIP6Address *b) +nm_platform_ip6_address_cmp(const NMPlatformIP6Address *a, + const NMPlatformIP6Address *b, + NMPlatformIPAddressCmpType cmp_type) { const struct in6_addr *p_a, *p_b; NM_CMP_SELF(a, b); + NM_CMP_FIELD(a, b, ifindex); - NM_CMP_FIELD_MEMCMP(a, b, address); - NM_CMP_FIELD(a, b, plen); - p_a = nm_platform_ip6_address_get_peer(a); - p_b = nm_platform_ip6_address_get_peer(b); - NM_CMP_DIRECT_MEMCMP(p_a, p_b, sizeof(*p_a)); - NM_CMP_FIELD(a, b, addr_source); - NM_CMP_FIELD(a, b, timestamp); - NM_CMP_FIELD(a, b, lifetime); - NM_CMP_FIELD(a, b, preferred); - NM_CMP_FIELD(a, b, n_ifa_flags); - NM_CMP_FIELD_UNSAFE(a, b, a_assume_config_once); - NM_CMP_FIELD_UNSAFE(a, b, a_force_commit); - return 0; + NM_CMP_FIELD_IN6ADDR(a, b, address); + + switch (cmp_type) { + case NM_PLATFORM_IP_ADDRESS_CMP_TYPE_ID: + /* for IPv6 addresses, the prefix length is not part of the primary identifier. */ + return 0; + case NM_PLATFORM_IP_ADDRESS_CMP_TYPE_SEMANTICALLY: + case NM_PLATFORM_IP_ADDRESS_CMP_TYPE_FULL: + NM_CMP_FIELD(a, b, plen); + p_a = nm_platform_ip6_address_get_peer(a); + p_b = nm_platform_ip6_address_get_peer(b); + NM_CMP_DIRECT_MEMCMP(p_a, p_b, sizeof(*p_a)); + if (cmp_type == NM_PLATFORM_IP_ADDRESS_CMP_TYPE_SEMANTICALLY) { + NM_CMP_RETURN(_address_cmp_expiry((const NMPlatformIPAddress *) a, + (const NMPlatformIPAddress *) b)); + + /* Most flags are set by kernel. We only compare the ones that + * NetworkManager actively sets. + * + * NM actively only sets IFA_F_NOPREFIXROUTE and IFA_F_MANAGETEMPADDR, + * where nm_platform_ip_address_sync() always sets IFA_F_NOPREFIXROUTE. + * We thus only care about IFA_F_MANAGETEMPADDR. */ + NM_CMP_DIRECT(a->n_ifa_flags & IFA_F_MANAGETEMPADDR, + b->n_ifa_flags & IFA_F_MANAGETEMPADDR); + } else { + NM_CMP_FIELD(a, b, timestamp); + NM_CMP_FIELD(a, b, lifetime); + NM_CMP_FIELD(a, b, preferred); + NM_CMP_FIELD(a, b, n_ifa_flags); + NM_CMP_FIELD(a, b, addr_source); + NM_CMP_FIELD_UNSAFE(a, b, a_assume_config_once); + NM_CMP_FIELD_UNSAFE(a, b, a_force_commit); + } + return 0; + } + return nm_assert_unreachable_val(0); } void @@ -9030,6 +9104,37 @@ nm_platform_netns_push(NMPlatform *self, NMPNetns **netns) /*****************************************************************************/ +const _NMPlatformVTableAddressUnion nm_platform_vtable_address = { + .v4 = + { + .is_ip4 = TRUE, + .obj_type = NMP_OBJECT_TYPE_IP4_ADDRESS, + .addr_family = AF_INET, + .sizeof_address = sizeof(NMPlatformIP4Address), + .address_cmp = + (int (*)(const NMPlatformIPXAddress *a, + const NMPlatformIPXAddress *b, + NMPlatformIPAddressCmpType cmp_type)) nm_platform_ip4_address_cmp, + .address_to_string = (const char *(*) (const NMPlatformIPXAddress *address, + char *buf, + gsize len)) nm_platform_ip4_address_to_string, + }, + .v6 = + { + .is_ip4 = FALSE, + .obj_type = NMP_OBJECT_TYPE_IP6_ADDRESS, + .addr_family = AF_INET6, + .sizeof_address = sizeof(NMPlatformIP6Address), + .address_cmp = + (int (*)(const NMPlatformIPXAddress *a, + const NMPlatformIPXAddress *b, + NMPlatformIPAddressCmpType cmp_type)) nm_platform_ip6_address_cmp, + .address_to_string = (const char *(*) (const NMPlatformIPXAddress *address, + char *buf, + gsize len)) nm_platform_ip6_address_to_string, + }, +}; + const _NMPlatformVTableRouteUnion nm_platform_vtable_route = { .v4 = { diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h index 93b644a3d8..111fbfc208 100644 --- a/src/libnm-platform/nm-platform.h +++ b/src/libnm-platform/nm-platform.h @@ -94,6 +94,14 @@ typedef enum { NMP_NLM_FLAG_TEST = NMP_NLM_FLAG_F_EXCL, } NMPNlmFlags; +typedef enum { + NM_PLATFORM_IP_ADDRESS_CMP_TYPE_ID, + + NM_PLATFORM_IP_ADDRESS_CMP_TYPE_SEMANTICALLY, + + NM_PLATFORM_IP_ADDRESS_CMP_TYPE_FULL, +} NMPlatformIPAddressCmpType; + typedef enum { /* compare fields which kernel considers as similar routes. * It is a looser comparisong then NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID @@ -775,6 +783,27 @@ typedef struct { #undef __NMPlatformObjWithIfindex_COMMON +typedef struct { + bool is_ip4; + NMPObjectType obj_type; + gint8 addr_family; + guint8 sizeof_address; + int (*address_cmp)(const NMPlatformIPXAddress *a, + const NMPlatformIPXAddress *b, + NMPlatformIPAddressCmpType cmp_type); + const char *(*address_to_string)(const NMPlatformIPXAddress *address, char *buf, gsize len); +} NMPlatformVTableAddress; + +typedef union { + struct { + NMPlatformVTableAddress v6; + NMPlatformVTableAddress v4; + }; + NMPlatformVTableAddress vx[2]; +} _NMPlatformVTableAddressUnion; + +extern const _NMPlatformVTableAddressUnion nm_platform_vtable_address; + typedef struct { bool is_ip4; gint8 addr_family; @@ -2343,8 +2372,24 @@ int nm_platform_lnk_vlan_cmp(const NMPlatformLnkVlan *a, const NMPlatformLnkVlan int nm_platform_lnk_vrf_cmp(const NMPlatformLnkVrf *a, const NMPlatformLnkVrf *b); int nm_platform_lnk_vxlan_cmp(const NMPlatformLnkVxlan *a, const NMPlatformLnkVxlan *b); int nm_platform_lnk_wireguard_cmp(const NMPlatformLnkWireGuard *a, const NMPlatformLnkWireGuard *b); -int nm_platform_ip4_address_cmp(const NMPlatformIP4Address *a, const NMPlatformIP4Address *b); -int nm_platform_ip6_address_cmp(const NMPlatformIP6Address *a, const NMPlatformIP6Address *b); +int nm_platform_ip4_address_cmp(const NMPlatformIP4Address *a, + const NMPlatformIP4Address *b, + NMPlatformIPAddressCmpType cmp_type); +int nm_platform_ip6_address_cmp(const NMPlatformIP6Address *a, + const NMPlatformIP6Address *b, + NMPlatformIPAddressCmpType cmp_type); + +static inline int +nm_platform_ip4_address_cmp_full(const NMPlatformIP4Address *a, const NMPlatformIP4Address *b) +{ + return nm_platform_ip4_address_cmp(a, b, NM_PLATFORM_IP_ADDRESS_CMP_TYPE_FULL); +} + +static inline int +nm_platform_ip6_address_cmp_full(const NMPlatformIP6Address *a, const NMPlatformIP6Address *b) +{ + return nm_platform_ip6_address_cmp(a, b, NM_PLATFORM_IP_ADDRESS_CMP_TYPE_FULL); +} int nm_platform_ip4_address_pretty_sort_cmp(const NMPlatformIP4Address *a1, const NMPlatformIP4Address *a2); diff --git a/src/libnm-platform/nmp-object.c b/src/libnm-platform/nmp-object.c index c5a936e5ed..2ae25c2137 100644 --- a/src/libnm-platform/nmp-object.c +++ b/src/libnm-platform/nmp-object.c @@ -1511,20 +1511,21 @@ nmp_object_id_cmp(const NMPObject *obj1, const NMPObject *obj2) _vt_cmd_plobj_id_cmp(link, NMPlatformLink, { NM_CMP_FIELD(obj1, obj2, ifindex); }); -_vt_cmd_plobj_id_cmp(ip4_address, NMPlatformIP4Address, { - NM_CMP_FIELD(obj1, obj2, ifindex); - NM_CMP_FIELD(obj1, obj2, plen); - NM_CMP_FIELD(obj1, obj2, address); - /* for IPv4 addresses, you can add the same local address with differing peer-address - * (IFA_ADDRESS), provided that their net-part differs. */ - NM_CMP_DIRECT_IN4ADDR_SAME_PREFIX(obj1->peer_address, obj2->peer_address, obj1->plen); -}); +static int +_vt_cmd_plobj_id_cmp_ip4_address(const NMPlatformObject *obj1, const NMPlatformObject *obj2) +{ + return nm_platform_ip4_address_cmp((const NMPlatformIP4Address *) obj1, + (const NMPlatformIP4Address *) obj2, + NM_PLATFORM_IP_ADDRESS_CMP_TYPE_ID); +} -_vt_cmd_plobj_id_cmp(ip6_address, NMPlatformIP6Address, { - NM_CMP_FIELD(obj1, obj2, ifindex); - /* for IPv6 addresses, the prefix length is not part of the primary identifier. */ - NM_CMP_FIELD_IN6ADDR(obj1, obj2, address); -}); +static int +_vt_cmd_plobj_id_cmp_ip6_address(const NMPlatformObject *obj1, const NMPlatformObject *obj2) +{ + return nm_platform_ip6_address_cmp((const NMPlatformIP6Address *) obj1, + (const NMPlatformIP6Address *) obj2, + NM_PLATFORM_IP_ADDRESS_CMP_TYPE_ID); +} _vt_cmd_plobj_id_cmp(qdisc, NMPlatformQdisc, { NM_CMP_FIELD(obj1, obj2, ifindex); @@ -1539,24 +1540,24 @@ _vt_cmd_plobj_id_cmp(tfilter, NMPlatformTfilter, { static int _vt_cmd_plobj_id_cmp_ip4_route(const NMPlatformObject *obj1, const NMPlatformObject *obj2) { - return nm_platform_ip4_route_cmp((NMPlatformIP4Route *) obj1, - (NMPlatformIP4Route *) obj2, + return nm_platform_ip4_route_cmp((const NMPlatformIP4Route *) obj1, + (const NMPlatformIP4Route *) obj2, NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID); } static int _vt_cmd_plobj_id_cmp_ip6_route(const NMPlatformObject *obj1, const NMPlatformObject *obj2) { - return nm_platform_ip6_route_cmp((NMPlatformIP6Route *) obj1, - (NMPlatformIP6Route *) obj2, + return nm_platform_ip6_route_cmp((const NMPlatformIP6Route *) obj1, + (const NMPlatformIP6Route *) obj2, NM_PLATFORM_IP_ROUTE_CMP_TYPE_ID); } static int _vt_cmd_plobj_id_cmp_routing_rule(const NMPlatformObject *obj1, const NMPlatformObject *obj2) { - return nm_platform_routing_rule_cmp((NMPlatformRoutingRule *) obj1, - (NMPlatformRoutingRule *) obj2, + return nm_platform_routing_rule_cmp((const NMPlatformRoutingRule *) obj1, + (const NMPlatformRoutingRule *) obj2, NM_PLATFORM_ROUTING_RULE_CMP_TYPE_ID); } @@ -3146,28 +3147,29 @@ const NMPClass _nmp_classes[NMP_OBJECT_TYPE_MAX] = { .cmd_plobj_to_string_id = _vt_cmd_plobj_to_string_id_ip4_address, .cmd_plobj_to_string = (CmdPlobjToStringFunc) nm_platform_ip4_address_to_string, .cmd_plobj_hash_update = (CmdPlobjHashUpdateFunc) nm_platform_ip4_address_hash_update, - .cmd_plobj_cmp = (CmdPlobjCmpFunc) nm_platform_ip4_address_cmp, + .cmd_plobj_cmp = (CmdPlobjCmpFunc) nm_platform_ip4_address_cmp_full, + }, + [NMP_OBJECT_TYPE_IP6_ADDRESS - 1] = + { + .parent = DEDUP_MULTI_OBJ_CLASS_INIT(), + .obj_type = NMP_OBJECT_TYPE_IP6_ADDRESS, + .sizeof_data = sizeof(NMPObjectIP6Address), + .sizeof_public = sizeof(NMPlatformIP6Address), + .obj_type_name = "ip6-address", + .addr_family = AF_INET6, + .rtm_gettype = RTM_GETADDR, + .signal_type_id = NM_PLATFORM_SIGNAL_ID_IP6_ADDRESS, + .signal_type = NM_PLATFORM_SIGNAL_IP6_ADDRESS_CHANGED, + .supported_cache_ids = _supported_cache_ids_ipx_address, + .cmd_obj_is_alive = _vt_cmd_obj_is_alive_ipx_address, + .cmd_plobj_id_copy = _vt_cmd_plobj_id_copy_ip6_address, + .cmd_plobj_id_cmp = _vt_cmd_plobj_id_cmp_ip6_address, + .cmd_plobj_id_hash_update = _vt_cmd_plobj_id_hash_update_ip6_address, + .cmd_plobj_to_string_id = _vt_cmd_plobj_to_string_id_ip6_address, + .cmd_plobj_to_string = (CmdPlobjToStringFunc) nm_platform_ip6_address_to_string, + .cmd_plobj_hash_update = (CmdPlobjHashUpdateFunc) nm_platform_ip6_address_hash_update, + .cmd_plobj_cmp = (CmdPlobjCmpFunc) nm_platform_ip6_address_cmp_full, }, - [NMP_OBJECT_TYPE_IP6_ADDRESS - - 1] = {.parent = DEDUP_MULTI_OBJ_CLASS_INIT(), - .obj_type = NMP_OBJECT_TYPE_IP6_ADDRESS, - .sizeof_data = sizeof(NMPObjectIP6Address), - .sizeof_public = sizeof(NMPlatformIP6Address), - .obj_type_name = "ip6-address", - .addr_family = AF_INET6, - .rtm_gettype = RTM_GETADDR, - .signal_type_id = NM_PLATFORM_SIGNAL_ID_IP6_ADDRESS, - .signal_type = NM_PLATFORM_SIGNAL_IP6_ADDRESS_CHANGED, - .supported_cache_ids = _supported_cache_ids_ipx_address, - .cmd_obj_is_alive = _vt_cmd_obj_is_alive_ipx_address, - .cmd_plobj_id_copy = _vt_cmd_plobj_id_copy_ip6_address, - .cmd_plobj_id_cmp = _vt_cmd_plobj_id_cmp_ip6_address, - .cmd_plobj_id_hash_update = _vt_cmd_plobj_id_hash_update_ip6_address, - .cmd_plobj_to_string_id = _vt_cmd_plobj_to_string_id_ip6_address, - .cmd_plobj_to_string = (CmdPlobjToStringFunc) nm_platform_ip6_address_to_string, - .cmd_plobj_hash_update = - (CmdPlobjHashUpdateFunc) nm_platform_ip6_address_hash_update, - .cmd_plobj_cmp = (CmdPlobjCmpFunc) nm_platform_ip6_address_cmp}, [NMP_OBJECT_TYPE_IP4_ROUTE - 1] = { .parent = DEDUP_MULTI_OBJ_CLASS_INIT(), From a81521221421784741532cff43531de9a0924476 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 29 Mar 2022 17:14:33 +0200 Subject: [PATCH 11/23] platform: add nm_platform_ip_address_get() helper --- src/libnm-platform/nm-platform.c | 35 ++++++++++++++++++++++++++++++++ src/libnm-platform/nm-platform.h | 5 +++++ 2 files changed, 40 insertions(+) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index a6e925162c..558bb869e3 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -3656,6 +3656,41 @@ nm_platform_ip6_address_delete(NMPlatform *self, int ifindex, struct in6_addr ad return klass->ip6_address_delete(self, ifindex, address, plen); } +const NMPObject * +nm_platform_ip_address_get(NMPlatform *self, + int addr_family, + int ifindex, + gconstpointer /* (NMPlatformIPAddress *) */ needle) +{ + const NMPlatformIPXAddress *addr; + NMPObject obj_id; + const NMPObject *obj; + + nm_assert(NM_IS_PLATFORM(self)); + nm_assert_addr_family(addr_family); + nm_assert(needle); + + addr = needle; + + if (ifindex <= 0) { + /* We allow the caller to override the ifindex. */ + ifindex = addr->ax.ifindex; + } + + if (NM_IS_IPv4(addr_family)) { + nmp_object_stackinit_id_ip4_address(&obj_id, + ifindex, + addr->a4.address, + addr->a4.plen, + addr->a4.peer_address); + } else + nmp_object_stackinit_id_ip6_address(&obj_id, ifindex, &addr->a6.address); + + obj = nmp_cache_lookup_obj(nm_platform_get_cache(self), &obj_id); + nm_assert(!obj || nmp_object_is_visible(obj)); + return obj; +} + const NMPlatformIP4Address * nm_platform_ip4_address_get(NMPlatform *self, int ifindex, diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h index 111fbfc208..1329c90e61 100644 --- a/src/libnm-platform/nm-platform.h +++ b/src/libnm-platform/nm-platform.h @@ -2099,6 +2099,11 @@ gboolean nm_platform_wpan_set_channel(NMPlatform *self, int ifindex, guint8 page void nm_platform_ip4_address_set_addr(NMPlatformIP4Address *addr, in_addr_t address, guint8 plen); const struct in6_addr *nm_platform_ip6_address_get_peer(const NMPlatformIP6Address *addr); +const NMPObject *nm_platform_ip_address_get(NMPlatform *self, + int addr_family, + int ifindex, + gconstpointer /* (NMPlatformIPAddress *) */ needle); + const NMPlatformIP4Address *nm_platform_ip4_address_get(NMPlatform *self, int ifindex, in_addr_t address, From 528a63d9cc4da678482e05de3c41dfdfe649dcfe Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 29 Mar 2022 17:23:52 +0200 Subject: [PATCH 12/23] platform: avoid unnecessary configuration of IP address in nm_platform_ip_address_sync() We call sync many times. Often there is nothing to update. Check the cache first, before (re) adding it. Note that many addresses have a limited lifetime, that is, a lifetime that keeps counting down with seconds granularity. For those (common) cases we will only avoid the call to kernel if there are two syncs within less than a second. --- src/libnm-platform/nm-platform.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index 558bb869e3..95c2e5b460 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -4348,6 +4348,7 @@ next_plat:; * priority. */ for (i_know = 0; i_know < known_addresses->len; i_know++) { + const NMPObject *plat_obj; const NMPObject *known_obj; const NMPlatformIPXAddress *known_address; guint32 lifetime; @@ -4368,6 +4369,23 @@ next_plat:; &preferred); nm_assert(lifetime > 0); + plat_obj = nm_platform_ip_address_get(self, addr_family, ifindex, known_address); + if (plat_obj + && nm_platform_vtable_address.vx[IS_IPv4].address_cmp( + known_address, + NMP_OBJECT_CAST_IPX_ADDRESS(plat_obj), + NM_PLATFORM_IP_ADDRESS_CMP_TYPE_SEMANTICALLY) + == 0) { + char sbuf[sizeof(_nm_utils_to_string_buffer)]; + + /* The object is already added. Skip update. */ + _LOG3t( + "address: skip updating IPv%c address: %s", + nm_utils_addr_family_to_char(addr_family), + nmp_object_to_string(known_obj, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); + continue; + } + if (IS_IPv4) { if (!nm_platform_ip4_address_add( self, From 36e709c021bfa459933ca65bf6c22a1ebff4d541 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 30 Mar 2022 09:22:55 +0200 Subject: [PATCH 13/23] all: add "NM_UTILS_TO_STRING_BUFFER_SIZE" macro I want to get rid of "_nm_utils_to_string_buffer" (or at least, limit and control its use). Currently it's used all over the place only to get the size of it. Add a define instead. --- src/libnm-glib-aux/nm-shared-utils.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libnm-glib-aux/nm-shared-utils.h b/src/libnm-glib-aux/nm-shared-utils.h index d0c7434b3c..b9b16950fa 100644 --- a/src/libnm-glib-aux/nm-shared-utils.h +++ b/src/libnm-glib-aux/nm-shared-utils.h @@ -1047,7 +1047,9 @@ int _nm_utils_ascii_str_to_bool(const char *str, int default_value); /*****************************************************************************/ -extern _nm_thread_local char _nm_utils_to_string_buffer[2096]; +#define NM_UTILS_TO_STRING_BUFFER_SIZE 2096 + +extern _nm_thread_local char _nm_utils_to_string_buffer[NM_UTILS_TO_STRING_BUFFER_SIZE]; void nm_utils_to_string_buffer_init(char **buf, gsize *len); gboolean nm_utils_to_string_buffer_init_null(gconstpointer obj, char **buf, gsize *len); From 02a8d21e4e8732ae1d4e1ad86815da681cac2393 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 30 Mar 2022 09:23:54 +0200 Subject: [PATCH 14/23] all: use "NM_UTILS_TO_STRING_BUFFER_SIZE" macro --- src/core/devices/nm-device.c | 2 +- src/core/devices/wwan/nm-modem-broadband.c | 2 +- src/core/devices/wwan/nm-modem-ofono.c | 2 +- src/core/nm-l3-config-data.c | 2 +- src/core/nm-l3cfg.c | 14 +++++++------- src/core/nm-test-utils-core.h | 4 ++-- src/core/platform/tests/test-common.c | 2 +- src/core/tests/test-l3cfg.c | 2 +- src/libnm-glib-aux/nm-shared-utils.c | 2 +- src/libnm-platform/nm-linux-platform.c | 4 ++-- src/libnm-platform/nm-platform.c | 12 ++++++------ src/libnm-platform/nmp-object.c | 6 +++--- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index 84c1a08e8e..f554ccfd25 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -10448,7 +10448,7 @@ void nm_device_use_ip6_subnet(NMDevice *self, const NMPlatformIP6Address *subnet) { nm_auto_unref_l3cd_init NML3ConfigData *l3cd = NULL; - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; NMPlatformIP6Address address; l3cd = nm_device_create_l3_config_data(self, NM_IP_CONFIG_SOURCE_SHARED); diff --git a/src/core/devices/wwan/nm-modem-broadband.c b/src/core/devices/wwan/nm-modem-broadband.c index b585652e5d..cbf30f565c 100644 --- a/src/core/devices/wwan/nm-modem-broadband.c +++ b/src/core/devices/wwan/nm-modem-broadband.c @@ -957,7 +957,7 @@ stage3_ip_config_start(NMModem *modem, int addr_family, NMModemIPMethod ip_metho const int IS_IPv4 = NM_IS_IPv4(addr_family); NMModemBroadband *self = NM_MODEM_BROADBAND(modem); nm_auto_unref_l3cd_init NML3ConfigData *l3cd = NULL; - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; gs_free_error GError *error = NULL; const char *data_port; const char *address_string; diff --git a/src/core/devices/wwan/nm-modem-ofono.c b/src/core/devices/wwan/nm-modem-ofono.c index cac90d3242..0db3004656 100644 --- a/src/core/devices/wwan/nm-modem-ofono.c +++ b/src/core/devices/wwan/nm-modem-ofono.c @@ -734,7 +734,7 @@ handle_settings(GVariant *v_dict, gpointer user_data) { NMModemOfono *self = NM_MODEM_OFONO(user_data); NMModemOfonoPrivate *priv = NM_MODEM_OFONO_GET_PRIVATE(self); - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; NMPlatformIP4Address address; gboolean ret = FALSE; const char *interface; diff --git a/src/core/nm-l3-config-data.c b/src/core/nm-l3-config-data.c index 03593ea28c..c732840e31 100644 --- a/src/core/nm-l3-config-data.c +++ b/src/core/nm-l3-config-data.c @@ -349,7 +349,7 @@ nm_l3_config_data_log(const NML3ConfigData *self, NMLogLevel log_level, NMLogDomain log_domain) { - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; char sbuf_addr[NM_UTILS_INET_ADDRSTRLEN]; int IS_IPv4; guint i; diff --git a/src/core/nm-l3cfg.c b/src/core/nm-l3cfg.c index e178b10907..e6a7858c44 100644 --- a/src/core/nm-l3cfg.c +++ b/src/core/nm-l3cfg.c @@ -585,7 +585,7 @@ _l3_config_notify_data_to_string(const NML3ConfigNotifyData *notify_data, void _nm_l3cfg_emit_signal_notify(NML3Cfg *self, const NML3ConfigNotifyData *notify_data) { - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; nm_assert(notify_data); nm_assert(_NM_INT_NOT_NEGATIVE(notify_data->notify_type)); @@ -885,7 +885,7 @@ _obj_state_data_update(ObjStateData *obj_state, const NMPObject *obj) static void _obj_states_externally_removed_track(NML3Cfg *self, const NMPObject *obj, gboolean in_platform) { - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; ObjStateData *obj_state; nm_assert(NM_IS_L3CFG(self)); @@ -946,7 +946,7 @@ _obj_states_update_all(NML3Cfg *self) NMP_OBJECT_TYPE_IP4_ROUTE, NMP_OBJECT_TYPE_IP6_ROUTE, }; - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; ObjStateData *obj_state; int i; gboolean any_dirty = FALSE; @@ -1037,7 +1037,7 @@ typedef struct { static gboolean _obj_states_sync_filter(NML3Cfg *self, const NMPObject *obj, NML3CfgCommitType commit_type) { - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; NMPObjectType obj_type; ObjStateData *obj_state; @@ -1152,7 +1152,7 @@ _obj_state_zombie_lst_get_prune_lists(NML3Cfg *self, const int IS_IPv4 = NM_IS_IPv4(addr_family); const NMPObjectType obj_type_route = NMP_OBJECT_TYPE_IP_ROUTE(IS_IPv4); const NMPObjectType obj_type_address = NMP_OBJECT_TYPE_IP_ADDRESS(IS_IPv4); - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; ObjStateData *obj_state; ObjStateData *obj_state_safe; @@ -1198,7 +1198,7 @@ _obj_state_zombie_lst_get_prune_lists(NML3Cfg *self, static void _obj_state_zombie_lst_prune_all(NML3Cfg *self, int addr_family) { - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; ObjStateData *obj_state; ObjStateData *obj_state_safe; @@ -3857,7 +3857,7 @@ _routes_temporary_not_available_update(NML3Cfg *self, for (i = 0; i < routes_temporary_not_available_arr->len; i++) { const NMPObject *o = routes_temporary_not_available_arr->pdata[i]; - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; nm_assert(NMP_OBJECT_GET_TYPE(o) == NMP_OBJECT_TYPE_IP_ROUTE(NM_IS_IPv4(addr_family))); diff --git a/src/core/nm-test-utils-core.h b/src/core/nm-test-utils-core.h index 6f571972b8..c036e94bae 100644 --- a/src/core/nm-test-utils-core.h +++ b/src/core/nm-test-utils-core.h @@ -211,7 +211,7 @@ nmtst_platform_ip4_routes_equal(const NMPlatformIP4Route *a, for (i = 0; i < len; i++) { if (nm_platform_ip4_route_cmp_full(&a[i], &b[i]) != 0) { - char buf[sizeof(_nm_utils_to_string_buffer)]; + char buf[NM_UTILS_TO_STRING_BUFFER_SIZE]; g_error("Error comparing IPv4 route[%lu]: %s vs %s", (unsigned long) i, @@ -280,7 +280,7 @@ nmtst_platform_ip6_routes_equal(const NMPlatformIP6Route *a, for (i = 0; i < len; i++) { if (nm_platform_ip6_route_cmp_full(&a[i], &b[i]) != 0) { - char buf[sizeof(_nm_utils_to_string_buffer)]; + char buf[NM_UTILS_TO_STRING_BUFFER_SIZE]; g_error("Error comparing IPv6 route[%lu]: %s vs %s", (unsigned long) i, diff --git a/src/core/platform/tests/test-common.c b/src/core/platform/tests/test-common.c index 2137b8781c..d7fed22087 100644 --- a/src/core/platform/tests/test-common.c +++ b/src/core/platform/tests/test-common.c @@ -239,7 +239,7 @@ _nmtstp_platform_ip_addresses_assert(const char *filename, } } if ((IS_IPv4 ? force_exact_4 : force_exact_6) && nm_g_ptr_array_len(plat_addrs) > 0) { - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("%s:%d: %u IPv%c addresses found on ifindex %d that should not be there (one " diff --git a/src/core/tests/test-l3cfg.c b/src/core/tests/test-l3cfg.c index 5501079ec4..5106203ca6 100644 --- a/src/core/tests/test-l3cfg.c +++ b/src/core/tests/test-l3cfg.c @@ -956,7 +956,7 @@ test_l3_ipv6ll(gconstpointer test_data) .steps_done = FALSE, }; TestL3IPv6LLData *const tdata = &tdata_stack; - char sbuf1[sizeof(_nm_utils_to_string_buffer)]; + char sbuf1[NM_UTILS_TO_STRING_BUFFER_SIZE]; int r; _LOGD("test start (/l3-ipv6ll/%d)", TEST_IDX); diff --git a/src/libnm-glib-aux/nm-shared-utils.c b/src/libnm-glib-aux/nm-shared-utils.c index 7c93615ed8..3255368971 100644 --- a/src/libnm-glib-aux/nm-shared-utils.c +++ b/src/libnm-glib-aux/nm-shared-utils.c @@ -870,7 +870,7 @@ nm_utils_to_string_buffer_init(char **buf, gsize *len) { if (!*buf) { *buf = _nm_utils_to_string_buffer; - *len = sizeof(_nm_utils_to_string_buffer); + *len = NM_UTILS_TO_STRING_BUFFER_SIZE; } } diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c index 76e99d8513..6727294a65 100644 --- a/src/libnm-platform/nm-linux-platform.c +++ b/src/libnm-platform/nm-linux-platform.c @@ -6393,8 +6393,8 @@ cache_on_change(NMPlatform *platform, const NMPObject *obj_new) { const NMPClass *klass; - char str_buf[sizeof(_nm_utils_to_string_buffer)]; - char str_buf2[sizeof(_nm_utils_to_string_buffer)]; + char str_buf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + char str_buf2[NM_UTILS_TO_STRING_BUFFER_SIZE]; NMPCache *cache = nm_platform_get_cache(platform); ASSERT_nmp_cache_ops(cache, cache_op, obj_old, obj_new); diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index 95c2e5b460..c2db6e6b67 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -4033,7 +4033,7 @@ nm_platform_ip_address_sync(NMPlatform *self, /* Disabled. Enable this for printf debugging. */ if (EXTRA_LOGGING) { - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; char sbuf1[50]; _LOG3T("IPv%c address sync on %d (%u addresses, %u to prune)", @@ -4114,7 +4114,7 @@ nm_platform_ip_address_sync(NMPlatform *self, if (EXTRA_LOGGING && plat_addresses) { for (i = 0; i < plat_addresses->len; i++) { - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; char sbuf1[50]; _LOG3T(" platform#%u: %s%s", @@ -4376,7 +4376,7 @@ next_plat:; NMP_OBJECT_CAST_IPX_ADDRESS(plat_obj), NM_PLATFORM_IP_ADDRESS_CMP_TYPE_SEMANTICALLY) == 0) { - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; /* The object is already added. Skip update. */ _LOG3t( @@ -4726,8 +4726,8 @@ nm_platform_ip_route_sync(NMPlatform *self, guint i; int i_type; gboolean success = TRUE; - char sbuf1[sizeof(_nm_utils_to_string_buffer)]; - char sbuf2[sizeof(_nm_utils_to_string_buffer)]; + char sbuf1[NM_UTILS_TO_STRING_BUFFER_SIZE]; + char sbuf2[NM_UTILS_TO_STRING_BUFFER_SIZE]; nm_assert(NM_IS_PLATFORM(self)); nm_assert(ifindex > 0); @@ -5074,7 +5074,7 @@ nm_platform_ip_route_normalize(int addr_family, NMPlatformIPRoute *route) static int _ip_route_add(NMPlatform *self, NMPNlmFlags flags, int addr_family, gconstpointer route) { - char sbuf[sizeof(_nm_utils_to_string_buffer)]; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; int ifindex; _CHECK_SELF(self, klass, FALSE); diff --git a/src/libnm-platform/nmp-object.c b/src/libnm-platform/nmp-object.c index 2ae25c2137..6c177b4c26 100644 --- a/src/libnm-platform/nmp-object.c +++ b/src/libnm-platform/nmp-object.c @@ -889,7 +889,7 @@ nmp_object_to_string(const NMPObject *obj, gsize buf_size) { const NMPClass *klass; - char buf2[sizeof(_nm_utils_to_string_buffer)]; + char buf2[NM_UTILS_TO_STRING_BUFFER_SIZE]; if (!nm_utils_to_string_buffer_init_null(obj, &buf, &buf_size)) return buf; @@ -980,7 +980,7 @@ _vt_cmd_obj_to_string_lnk_vlan(const NMPObject *obj, gsize buf_size) { const NMPClass *klass; - char buf2[sizeof(_nm_utils_to_string_buffer)]; + char buf2[NM_UTILS_TO_STRING_BUFFER_SIZE]; char *b; gsize l; @@ -1044,7 +1044,7 @@ _vt_cmd_obj_to_string_lnk_wireguard(const NMPObject *obj, gsize buf_size) { const NMPClass *klass; - char buf2[sizeof(_nm_utils_to_string_buffer)]; + char buf2[NM_UTILS_TO_STRING_BUFFER_SIZE]; char *b; guint i; From b87afac8e8b8fe93a07da9eb6cc69bc0673b67bb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 30 Mar 2022 08:47:34 +0200 Subject: [PATCH 15/23] all: avoid using global string buffer for to-string methods These string functions allow to omit the string buffer. This is for convenience, to use a global (thread-local) buffer. I think that is error prone and we should drop that "convenience" feature. At various places, pass a stack allocated buffer. --- src/core/dhcp/nm-dhcp-utils.c | 3 +- src/core/dnsmasq/nm-dnsmasq-manager.c | 5 +- src/core/nm-config.c | 7 ++- src/core/nm-test-utils-core.h | 14 +++-- src/core/platform/tests/test-route.c | 21 ++++--- src/libnm-platform/nm-linux-platform.c | 18 +++--- src/libnm-platform/nm-platform.c | 87 ++++++++++++++++++-------- src/libnm-platform/nmp-route-manager.c | 25 +++++--- 8 files changed, 118 insertions(+), 62 deletions(-) diff --git a/src/core/dhcp/nm-dhcp-utils.c b/src/core/dhcp/nm-dhcp-utils.c index a5916de839..0d061d8070 100644 --- a/src/core/dhcp/nm-dhcp-utils.c +++ b/src/core/dhcp/nm-dhcp-utils.c @@ -297,6 +297,7 @@ process_classful_routes(const char *iface, GHashTable *options, NML3ConfigData * } for (s = searches; *s; s += 2) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; NMPlatformIP4Route route; guint32 rt_addr, rt_route; @@ -338,7 +339,7 @@ process_classful_routes(const char *iface, GHashTable *options, NML3ConfigData * _LOG2I(LOGD_DHCP, iface, " static route %s", - nm_platform_ip4_route_to_string(&route, NULL, 0)); + nm_platform_ip4_route_to_string(&route, sbuf, sizeof(sbuf))); } } diff --git a/src/core/dnsmasq/nm-dnsmasq-manager.c b/src/core/dnsmasq/nm-dnsmasq-manager.c index c272a743af..be463da3e8 100644 --- a/src/core/dnsmasq/nm-dnsmasq-manager.c +++ b/src/core/dnsmasq/nm-dnsmasq-manager.c @@ -67,9 +67,12 @@ dm_watch_cb(GPid pid, int status, gpointer user_data) guint err; if (WIFEXITED(status)) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + err = WEXITSTATUS(status); if (err != 0) { - _LOGW("dnsmasq exited with error: %s", nm_utils_dnsmasq_status_to_string(err, NULL, 0)); + _LOGW("dnsmasq exited with error: %s", + nm_utils_dnsmasq_status_to_string(err, sbuf, sizeof(sbuf))); } } else if (WIFSTOPPED(status)) { _LOGW("dnsmasq stopped unexpectedly with signal %d", WSTOPSIG(status)); diff --git a/src/core/nm-config.c b/src/core/nm-config.c index 60a2f1df53..ea1c2ab300 100644 --- a/src/core/nm-config.c +++ b/src/core/nm-config.c @@ -2870,6 +2870,7 @@ _set_config_data(NMConfig *self, NMConfigData *new_data, NMConfigChangeFlags rel NMConfigData *old_data = priv->config_data; NMConfigChangeFlags changes, changes_diff; gboolean had_new_data = !!new_data; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; nm_assert(reload_flags); nm_assert(!NM_FLAGS_ANY(reload_flags, ~NM_CONFIG_CHANGE_CAUSES)); @@ -2901,15 +2902,15 @@ _set_config_data(NMConfig *self, NMConfigData *new_data, NMConfigChangeFlags rel if (new_data) { _LOGI("signal: %s (%s)", - nm_config_change_flags_to_string(changes, NULL, 0), + nm_config_change_flags_to_string(changes, sbuf, sizeof(sbuf)), nm_config_data_get_config_description(new_data)); nm_config_data_log(new_data, "CONFIG: ", " ", priv->no_auto_default_file, NULL); priv->config_data = new_data; } else if (had_new_data) _LOGI("signal: %s (no changes from disk)", - nm_config_change_flags_to_string(changes, NULL, 0)); + nm_config_change_flags_to_string(changes, sbuf, sizeof(sbuf))); else - _LOGI("signal: %s", nm_config_change_flags_to_string(changes, NULL, 0)); + _LOGI("signal: %s", nm_config_change_flags_to_string(changes, sbuf, sizeof(sbuf))); g_signal_emit(self, signals[SIGNAL_CONFIG_CHANGED], 0, new_data ?: old_data, changes, old_data); if (new_data) g_object_unref(old_data); diff --git a/src/core/nm-test-utils-core.h b/src/core/nm-test-utils-core.h index c036e94bae..467f9bb272 100644 --- a/src/core/nm-test-utils-core.h +++ b/src/core/nm-test-utils-core.h @@ -211,12 +211,13 @@ nmtst_platform_ip4_routes_equal(const NMPlatformIP4Route *a, for (i = 0; i < len; i++) { if (nm_platform_ip4_route_cmp_full(&a[i], &b[i]) != 0) { - char buf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + char buf1[NM_UTILS_TO_STRING_BUFFER_SIZE]; + char buf2[NM_UTILS_TO_STRING_BUFFER_SIZE]; g_error("Error comparing IPv4 route[%lu]: %s vs %s", (unsigned long) i, - nm_platform_ip4_route_to_string(&a[i], NULL, 0), - nm_platform_ip4_route_to_string(&b[i], buf, sizeof(buf))); + nm_platform_ip4_route_to_string(&a[i], buf1, sizeof(buf1)), + nm_platform_ip4_route_to_string(&b[i], buf2, sizeof(buf2))); g_assert_not_reached(); } } @@ -280,12 +281,13 @@ nmtst_platform_ip6_routes_equal(const NMPlatformIP6Route *a, for (i = 0; i < len; i++) { if (nm_platform_ip6_route_cmp_full(&a[i], &b[i]) != 0) { - char buf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + char buf1[NM_UTILS_TO_STRING_BUFFER_SIZE]; + char buf2[NM_UTILS_TO_STRING_BUFFER_SIZE]; g_error("Error comparing IPv6 route[%lu]: %s vs %s", (unsigned long) i, - nm_platform_ip6_route_to_string(&a[i], NULL, 0), - nm_platform_ip6_route_to_string(&b[i], buf, sizeof(buf))); + nm_platform_ip6_route_to_string(&a[i], buf1, sizeof(buf1)), + nm_platform_ip6_route_to_string(&b[i], buf2, sizeof(buf2))); g_assert_not_reached(); } } diff --git a/src/core/platform/tests/test-route.c b/src/core/platform/tests/test-route.c index e39b17e2cb..2d39cb3789 100644 --- a/src/core/platform/tests/test-route.c +++ b/src/core/platform/tests/test-route.c @@ -1535,6 +1535,7 @@ _rule_fuzzy_equal(const NMPObject *obj, const NMPObject *obj_comp, int op_type) static void test_rule(gconstpointer test_data) { + char sbuf1[NM_UTILS_TO_STRING_BUFFER_SIZE]; const int TEST_IDX = GPOINTER_TO_INT(test_data); const gboolean TEST_SYNC = (TEST_IDX == 4); gs_unref_ptrarray GPtrArray *objs = NULL; @@ -1763,7 +1764,7 @@ again: g_print(">>> failing... errno=%d, rule=%s\n", r, - nmp_object_to_string(obj, NMP_OBJECT_TO_STRING_ALL, NULL, 0)); + nmp_object_to_string(obj, NMP_OBJECT_TO_STRING_ALL, sbuf1, sizeof(sbuf1))); nmp_lookup_init_obj_type(&lookup, NMP_OBJECT_TYPE_ROUTING_RULE); head_entry = nm_platform_lookup(platform, &lookup); @@ -1775,9 +1776,10 @@ again: && NMP_OBJECT_CAST_ROUTING_RULE(o)->priority == NMP_OBJECT_CAST_ROUTING_RULE(obj)->priority) ch = '*'; - g_print(">>> existing rule: %c %s\n", - ch, - nmp_object_to_string(o, NMP_OBJECT_TO_STRING_ALL, NULL, 0)); + g_print( + ">>> existing rule: %c %s\n", + ch, + nmp_object_to_string(o, NMP_OBJECT_TO_STRING_ALL, sbuf1, sizeof(sbuf1))); } nmtstp_run_command_check("ip rule"); @@ -1836,11 +1838,14 @@ again: if (!_rule_fuzzy_equal(obj, objs->pdata[k], RTM_DELRULE)) { g_print(">>> failing...\n"); - g_print(">>> no fuzzy match between: %s\n", - nmp_object_to_string(obj, NMP_OBJECT_TO_STRING_ALL, NULL, 0)); g_print( - ">>> and: %s\n", - nmp_object_to_string(objs->pdata[k], NMP_OBJECT_TO_STRING_ALL, NULL, 0)); + ">>> no fuzzy match between: %s\n", + nmp_object_to_string(obj, NMP_OBJECT_TO_STRING_ALL, sbuf1, sizeof(sbuf1))); + g_print(">>> and: %s\n", + nmp_object_to_string(objs->pdata[k], + NMP_OBJECT_TO_STRING_ALL, + sbuf1, + sizeof(sbuf1))); g_assert_not_reached(); } diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c index 6727294a65..40cb439692 100644 --- a/src/libnm-platform/nm-linux-platform.c +++ b/src/libnm-platform/nm-linux-platform.c @@ -6342,6 +6342,7 @@ cache_prune_one_type(NMPlatform *platform, const NMPLookup *lookup) nm_dedup_multi_iter_init(&iter, nmp_cache_lookup(cache, lookup)); while (nm_dedup_multi_iter_next(&iter)) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; const NMDedupMultiEntry *main_entry; /* we only track the dirty flag for the OBJECT-TYPE index. That means, @@ -6353,7 +6354,7 @@ cache_prune_one_type(NMPlatform *platform, const NMPLookup *lookup) obj = main_entry->obj; _LOGt("cache-prune: prune %s", - nmp_object_to_string(obj, NMP_OBJECT_TO_STRING_ALL, NULL, 0)); + nmp_object_to_string(obj, NMP_OBJECT_TO_STRING_ALL, sbuf, sizeof(sbuf))); { nm_auto_nmpobj const NMPObject *obj_old = NULL; @@ -7026,6 +7027,7 @@ event_seq_check(NMPlatform *platform, static void event_valid_msg(NMPlatform *platform, struct nl_msg *msg, gboolean handle_events) { + char sbuf1[NM_UTILS_TO_STRING_BUFFER_SIZE]; NMLinuxPlatformPrivate *priv; nm_auto_nmpobj NMPObject *obj = NULL; NMPCacheOpsType cache_op; @@ -7082,8 +7084,8 @@ event_valid_msg(NMPlatform *platform, struct nl_msg *msg, gboolean handle_events is_dump ? ", in-dump" : "", nmp_object_to_string(obj, is_del ? NMP_OBJECT_TO_STRING_ID : NMP_OBJECT_TO_STRING_PUBLIC, - NULL, - 0)); + sbuf1, + sizeof(sbuf1))); while (TRUE) { nm_auto_nmpobj const NMPObject *obj_old = NULL; @@ -7309,6 +7311,7 @@ do_add_addrroute(NMPlatform *platform, struct nl_msg *nlmsg, gboolean suppress_netlink_failure) { + char sbuf1[NM_UTILS_TO_STRING_BUFFER_SIZE]; WaitForNlResponseResult seq_result = WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN; gs_free char *errmsg = NULL; int nle; @@ -7331,7 +7334,7 @@ do_add_addrroute(NMPlatform *platform, if (nle < 0) { _LOGE("do-add-%s[%s]: failure sending netlink request \"%s\" (%d)", NMP_OBJECT_GET_CLASS(obj_id)->obj_type_name, - nmp_object_to_string(obj_id, NMP_OBJECT_TO_STRING_ID, NULL, 0), + nmp_object_to_string(obj_id, NMP_OBJECT_TO_STRING_ID, sbuf1, sizeof(sbuf1)), nm_strerror(nle), -nle); return -NME_PL_NETLINK; @@ -7347,7 +7350,7 @@ do_add_addrroute(NMPlatform *platform, : LOGL_WARN, "do-add-%s[%s]: %s", NMP_OBJECT_GET_CLASS(obj_id)->obj_type_name, - nmp_object_to_string(obj_id, NMP_OBJECT_TO_STRING_ID, NULL, 0), + nmp_object_to_string(obj_id, NMP_OBJECT_TO_STRING_ID, sbuf1, sizeof(sbuf1)), wait_for_nl_response_to_string(seq_result, errmsg, s_buf, sizeof(s_buf))); if (NMP_OBJECT_GET_TYPE(obj_id) == NMP_OBJECT_TYPE_IP6_ADDRESS) { @@ -7368,6 +7371,7 @@ do_add_addrroute(NMPlatform *platform, static gboolean do_delete_object(NMPlatform *platform, const NMPObject *obj_id, struct nl_msg *nlmsg) { + char sbuf1[NM_UTILS_TO_STRING_BUFFER_SIZE]; WaitForNlResponseResult seq_result = WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN; gs_free char *errmsg = NULL; int nle; @@ -7386,7 +7390,7 @@ do_delete_object(NMPlatform *platform, const NMPObject *obj_id, struct nl_msg *n if (nle < 0) { _LOGE("do-delete-%s[%s]: failure sending netlink request \"%s\" (%d)", NMP_OBJECT_GET_CLASS(obj_id)->obj_type_name, - nmp_object_to_string(obj_id, NMP_OBJECT_TO_STRING_ID, NULL, 0), + nmp_object_to_string(obj_id, NMP_OBJECT_TO_STRING_ID, sbuf1, sizeof(sbuf1)), nm_strerror(nle), -nle); return FALSE; @@ -7418,7 +7422,7 @@ do_delete_object(NMPlatform *platform, const NMPObject *obj_id, struct nl_msg *n _NMLOG(success ? LOGL_DEBUG : LOGL_WARN, "do-delete-%s[%s]: %s%s", NMP_OBJECT_GET_CLASS(obj_id)->obj_type_name, - nmp_object_to_string(obj_id, NMP_OBJECT_TO_STRING_ID, NULL, 0), + nmp_object_to_string(obj_id, NMP_OBJECT_TO_STRING_ID, sbuf1, sizeof(sbuf1)), wait_for_nl_response_to_string(seq_result, errmsg, s_buf, sizeof(s_buf)), log_detail); diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index c2db6e6b67..42966aced9 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -1875,9 +1875,10 @@ nm_platform_link_set_sriov_vfs(NMPlatform *self, int ifindex, const NMPlatformVF _LOG3D("link: setting VFs"); for (i = 0; vfs[i]; i++) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; const NMPlatformVF *vf = vfs[i]; - _LOG3D("link: VF %s", nm_platform_vf_to_string(vf, NULL, 0)); + _LOG3D("link: VF %s", nm_platform_vf_to_string(vf, sbuf, sizeof(sbuf))); } return klass->link_set_sriov_vfs(self, ifindex, vfs); @@ -1899,9 +1900,11 @@ nm_platform_link_set_bridge_vlans(NMPlatform *self, on_master ? "master" : "self"); if (vlans) { for (i = 0; vlans[i]; i++) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; const NMPlatformBridgeVlan *vlan = vlans[i]; - _LOG3D("link: bridge VLAN %s", nm_platform_bridge_vlan_to_string(vlan, NULL, 0)); + _LOG3D("link: bridge VLAN %s", + nm_platform_bridge_vlan_to_string(vlan, sbuf, sizeof(sbuf))); } } @@ -3543,6 +3546,7 @@ nm_platform_ip4_address_add(NMPlatform *self, FALSE); if (_LOGD_ENABLED()) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; NMPlatformIP4Address addr; addr = (NMPlatformIP4Address){ @@ -3561,7 +3565,7 @@ nm_platform_ip4_address_add(NMPlatform *self, g_strlcpy(addr.label, label, sizeof(addr.label)); _LOG3D("address: adding or updating IPv4 address: %s", - nm_platform_ip4_address_to_string(&addr, NULL, 0)); + nm_platform_ip4_address_to_string(&addr, sbuf, sizeof(sbuf))); } return klass->ip4_address_add(self, ifindex, @@ -3593,6 +3597,7 @@ nm_platform_ip6_address_add(NMPlatform *self, g_return_val_if_fail(preferred <= lifetime, FALSE); if (_LOGD_ENABLED()) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; NMPlatformIP6Address addr = {0}; addr.ifindex = ifindex; @@ -3605,7 +3610,7 @@ nm_platform_ip6_address_add(NMPlatform *self, addr.n_ifa_flags = flags; _LOG3D("address: adding or updating IPv6 address: %s", - nm_platform_ip6_address_to_string(&addr, NULL, 0)); + nm_platform_ip6_address_to_string(&addr, sbuf, sizeof(sbuf))); } return klass ->ip6_address_add(self, ifindex, address, plen, peer_address, lifetime, preferred, flags); @@ -5126,7 +5131,8 @@ nm_platform_ip6_route_add(NMPlatform *self, NMPNlmFlags flags, const NMPlatformI gboolean nm_platform_object_delete(NMPlatform *self, const NMPObject *obj) { - int ifindex; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + int ifindex; _CHECK_SELF(self, klass, FALSE); @@ -5134,7 +5140,7 @@ nm_platform_object_delete(NMPlatform *self, const NMPObject *obj) case NMP_OBJECT_TYPE_ROUTING_RULE: _LOGD("%s: delete %s", NMP_OBJECT_GET_CLASS(obj)->obj_type_name, - nmp_object_to_string(obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0)); + nmp_object_to_string(obj, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); break; case NMP_OBJECT_TYPE_IP4_ROUTE: case NMP_OBJECT_TYPE_IP6_ROUTE: @@ -5143,7 +5149,7 @@ nm_platform_object_delete(NMPlatform *self, const NMPObject *obj) ifindex = NMP_OBJECT_CAST_OBJ_WITH_IFINDEX(obj)->ifindex; _LOG3D("%s: delete %s", NMP_OBJECT_GET_CLASS(obj)->obj_type_name, - nmp_object_to_string(obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0)); + nmp_object_to_string(obj, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); break; default: g_return_val_if_reached(FALSE); @@ -5161,6 +5167,7 @@ nm_platform_ip_route_get(NMPlatform *self, int oif_ifindex, NMPObject **out_route) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; nm_auto_nmpobj NMPObject *route = NULL; int result; char buf[NM_UTILS_INET_ADDRSTRLEN]; @@ -5197,7 +5204,7 @@ nm_platform_ip_route_get(NMPlatform *self, _LOGD("route: get IPv%c route for: %s succeeded: %s", nm_utils_addr_family_to_char(addr_family), inet_ntop(addr_family, address, buf, sizeof(buf)), - nmp_object_to_string(route, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0)); + nmp_object_to_string(route, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); NM_SET_OUT(out_route, g_steal_pointer(&route)); } return result; @@ -5224,6 +5231,7 @@ _ip4_dev_route_blacklist_timeout_ms_marked(gint64 timeout_msec) static gboolean _ip4_dev_route_blacklist_check_cb(gpointer user_data) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; NMPlatform *self = user_data; NMPlatformPrivate *priv = NM_PLATFORM_GET_PRIVATE(self); GHashTableIter iter; @@ -5254,7 +5262,7 @@ again: continue; _LOGT("ip4-dev-route: delete %s", - nmp_object_to_string(p_obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0)); + nmp_object_to_string(p_obj, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); nm_platform_object_delete(self, p_obj); goto again; } @@ -5317,6 +5325,7 @@ _ip4_dev_route_blacklist_notify_route(NMPlatform *self, const NMPObject *obj) static gboolean _ip4_dev_route_blacklist_gc_timeout_handle(gpointer user_data) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; NMPlatform *self = user_data; NMPlatformPrivate *priv = NM_PLATFORM_GET_PRIVATE(self); GHashTableIter iter; @@ -5332,7 +5341,7 @@ _ip4_dev_route_blacklist_gc_timeout_handle(gpointer user_data) while (g_hash_table_iter_next(&iter, (gpointer *) &p_obj, (gpointer *) &p_timeout_ms)) { if (now_ms > _ip4_dev_route_blacklist_timeout_ms_get(*p_timeout_ms)) { _LOGT("ip4-dev-route: cleanup %s", - nmp_object_to_string(p_obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0)); + nmp_object_to_string(p_obj, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); g_hash_table_iter_remove(&iter); } } @@ -5392,6 +5401,7 @@ nm_platform_ip4_dev_route_blacklist_set(NMPlatform *self, int ifindex, GPtrArray *ip4_dev_route_blacklist) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; NMPlatformPrivate *priv; GHashTableIter iter; const NMPObject *p_obj; @@ -5447,14 +5457,17 @@ nm_platform_ip4_dev_route_blacklist_set(NMPlatform *self, if (nmp_object_equal(p_obj, o)) { /* un-expire and reuse the entry. */ _LOGT("ip4-dev-route: register %s (update)", - nmp_object_to_string(p_obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0)); + nmp_object_to_string(p_obj, + NMP_OBJECT_TO_STRING_PUBLIC, + sbuf, + sizeof(sbuf))); *p_timeout_ms = timeout_msec_val; continue; } } _LOGT("ip4-dev-route: register %s", - nmp_object_to_string(o, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0)); + nmp_object_to_string(o, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); p_timeout_ms = g_slice_new(gint64); *p_timeout_ms = timeout_msec_val; g_hash_table_replace(priv->ip4_dev_route_blacklist_hash, @@ -5476,12 +5489,13 @@ nm_platform_routing_rule_add(NMPlatform *self, NMPNlmFlags flags, const NMPlatformRoutingRule *routing_rule) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; _CHECK_SELF(self, klass, -NME_BUG); g_return_val_if_fail(routing_rule, -NME_BUG); _LOGD("routing-rule: adding or updating: %s", - nm_platform_routing_rule_to_string(routing_rule, NULL, 0)); + nm_platform_routing_rule_to_string(routing_rule, sbuf, sizeof(sbuf))); return klass->routing_rule_add(self, flags, routing_rule); } @@ -5490,13 +5504,15 @@ nm_platform_routing_rule_add(NMPlatform *self, int nm_platform_qdisc_add(NMPlatform *self, NMPNlmFlags flags, const NMPlatformQdisc *qdisc) { - int ifindex = qdisc->ifindex; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + int ifindex = qdisc->ifindex; _CHECK_SELF(self, klass, -NME_BUG); /* Note: @qdisc must not be copied or kept alive because the lifetime of qdisc.kind * is undefined. */ - _LOG3D("adding or updating a qdisc: %s", nm_platform_qdisc_to_string(qdisc, NULL, 0)); + _LOG3D("adding or updating a qdisc: %s", + nm_platform_qdisc_to_string(qdisc, sbuf, sizeof(sbuf))); return klass->qdisc_add(self, flags, qdisc); } @@ -5514,13 +5530,15 @@ nm_platform_qdisc_delete(NMPlatform *self, int ifindex, guint32 parent, gboolean int nm_platform_tfilter_add(NMPlatform *self, NMPNlmFlags flags, const NMPlatformTfilter *tfilter) { - int ifindex = tfilter->ifindex; + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + int ifindex = tfilter->ifindex; _CHECK_SELF(self, klass, -NME_BUG); /* Note: @tfilter must not be copied or kept alive because the lifetime of tfilter.kind * and tfilter.action.kind is undefined. */ - _LOG3D("adding or updating a tfilter: %s", nm_platform_tfilter_to_string(tfilter, NULL, 0)); + _LOG3D("adding or updating a tfilter: %s", + nm_platform_tfilter_to_string(tfilter, sbuf, sizeof(sbuf))); return klass->tfilter_add(self, flags, tfilter); } @@ -8945,9 +8963,11 @@ log_link(NMPlatform *self, NMPlatformSignalChangeType change_type, gpointer user_data) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + _LOG3D("signal: link %7s: %s", nm_platform_signal_change_type_to_string(change_type), - nm_platform_link_to_string(device, NULL, 0)); + nm_platform_link_to_string(device, sbuf, sizeof(sbuf))); } static void @@ -8958,9 +8978,11 @@ log_ip4_address(NMPlatform *self, NMPlatformSignalChangeType change_type, gpointer user_data) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + _LOG3D("signal: address 4 %7s: %s", nm_platform_signal_change_type_to_string(change_type), - nm_platform_ip4_address_to_string(address, NULL, 0)); + nm_platform_ip4_address_to_string(address, sbuf, sizeof(sbuf))); } static void @@ -8971,9 +8993,11 @@ log_ip6_address(NMPlatform *self, NMPlatformSignalChangeType change_type, gpointer user_data) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + _LOG3D("signal: address 6 %7s: %s", nm_platform_signal_change_type_to_string(change_type), - nm_platform_ip6_address_to_string(address, NULL, 0)); + nm_platform_ip6_address_to_string(address, sbuf, sizeof(sbuf))); } static void @@ -8984,9 +9008,11 @@ log_ip4_route(NMPlatform *self, NMPlatformSignalChangeType change_type, gpointer user_data) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + _LOG3D("signal: route 4 %7s: %s", nm_platform_signal_change_type_to_string(change_type), - nm_platform_ip4_route_to_string(route, NULL, 0)); + nm_platform_ip4_route_to_string(route, sbuf, sizeof(sbuf))); } static void @@ -8997,9 +9023,11 @@ log_ip6_route(NMPlatform *self, NMPlatformSignalChangeType change_type, gpointer user_data) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + _LOG3D("signal: route 6 %7s: %s", nm_platform_signal_change_type_to_string(change_type), - nm_platform_ip6_route_to_string(route, NULL, 0)); + nm_platform_ip6_route_to_string(route, sbuf, sizeof(sbuf))); } static void @@ -9010,10 +9038,12 @@ log_routing_rule(NMPlatform *self, NMPlatformSignalChangeType change_type, gpointer user_data) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + /* routing rules don't have an ifindex. We probably should refactor the signals that are emitted for platform changes. */ _LOG3D("signal: rt-rule %7s: %s", nm_platform_signal_change_type_to_string(change_type), - nm_platform_routing_rule_to_string(routing_rule, NULL, 0)); + nm_platform_routing_rule_to_string(routing_rule, sbuf, sizeof(sbuf))); } static void @@ -9024,9 +9054,11 @@ log_qdisc(NMPlatform *self, NMPlatformSignalChangeType change_type, gpointer user_data) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + _LOG3D("signal: qdisc %7s: %s", nm_platform_signal_change_type_to_string(change_type), - nm_platform_qdisc_to_string(qdisc, NULL, 0)); + nm_platform_qdisc_to_string(qdisc, sbuf, sizeof(sbuf))); } static void @@ -9037,9 +9069,11 @@ log_tfilter(NMPlatform *self, NMPlatformSignalChangeType change_type, gpointer user_data) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + _LOG3D("signal: tfilter %7s: %s", nm_platform_signal_change_type_to_string(change_type), - nm_platform_tfilter_to_string(tfilter, NULL, 0)); + nm_platform_tfilter_to_string(tfilter, sbuf, sizeof(sbuf))); } /*****************************************************************************/ @@ -9050,6 +9084,7 @@ nm_platform_cache_update_emit_signal(NMPlatform *self, const NMPObject *obj_old, const NMPObject *obj_new) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; gboolean visible_new; gboolean visible_old; const NMPObject *o; @@ -9112,7 +9147,7 @@ nm_platform_cache_update_emit_signal(NMPlatform *self, _LOG3t("emit signal %s %s: %s", klass->signal_type, nm_platform_signal_change_type_to_string((NMPlatformSignalChangeType) cache_op), - nmp_object_to_string(o, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0)); + nmp_object_to_string(o, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); nmp_object_ref(o); g_signal_emit(self, diff --git a/src/libnm-platform/nmp-route-manager.c b/src/libnm-platform/nmp-route-manager.c index c31c9806a5..842301b1bd 100644 --- a/src/libnm-platform/nmp-route-manager.c +++ b/src/libnm-platform/nmp-route-manager.c @@ -397,14 +397,17 @@ nmp_route_manager_track(NMPRouteManager *self, _track_data_assert(track_data, TRUE); if (changed) { - _LOGD("track [" NM_HASH_OBFUSCATE_PTR_FMT ",%s%u] %s \"%s\"", - NM_HASH_OBFUSCATE_PTR(track_data->user_tag), - (track_data->track_priority_val == 0 - ? "" - : (track_data->track_priority_present ? "+" : "-")), - (guint) track_data->track_priority_val, - NMP_OBJECT_GET_CLASS(track_data->obj)->obj_type_name, - nmp_object_to_string(track_data->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0)); + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + + _LOGD( + "track [" NM_HASH_OBFUSCATE_PTR_FMT ",%s%u] %s \"%s\"", + NM_HASH_OBFUSCATE_PTR(track_data->user_tag), + (track_data->track_priority_val == 0 + ? "" + : (track_data->track_priority_present ? "+" : "-")), + (guint) track_data->track_priority_val, + NMP_OBJECT_GET_CLASS(track_data->obj)->obj_type_name, + nmp_object_to_string(track_data->obj, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); } return changed || changed_untrack; @@ -416,6 +419,7 @@ _track_data_untrack(NMPRouteManager *self, gboolean remove_user_tag_data, gboolean make_owned_by_us) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; TrackObjData *obj_data; nm_assert(NMP_IS_ROUTE_MANAGER(self)); @@ -426,7 +430,7 @@ _track_data_untrack(NMPRouteManager *self, _LOGD("untrack [" NM_HASH_OBFUSCATE_PTR_FMT "] %s \"%s\"", NM_HASH_OBFUSCATE_PTR(track_data->user_tag), NMP_OBJECT_GET_CLASS(track_data->obj)->obj_type_name, - nmp_object_to_string(track_data->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0)); + nmp_object_to_string(track_data->obj, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); #if NM_MORE_ASSERTS { @@ -552,6 +556,7 @@ nmp_route_manager_untrack_all(NMPRouteManager *self, void nmp_route_manager_sync(NMPRouteManager *self, NMPObjectType obj_type, gboolean keep_deleted) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; const NMDedupMultiHeadEntry *pl_head_entry; NMDedupMultiIter pl_iter; const NMPObject *plobj; @@ -608,7 +613,7 @@ nmp_route_manager_sync(NMPRouteManager *self, NMPObjectType obj_type, gboolean k if (keep_deleted) { _LOGD("forget/leak object added by us: %s \"%s\"", NMP_OBJECT_GET_CLASS(plobj)->obj_type_name, - nmp_object_to_string(plobj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0)); + nmp_object_to_string(plobj, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); continue; } From 27752bfd5be594bfe49cb13e742c12a3366b76f2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 30 Mar 2022 10:11:26 +0200 Subject: [PATCH 16/23] glib-aux: assert that nm_utils_to_string_buffer_init() does not use the global buffer For convenience, most to-string methods call nm_utils_to_string_buffer_init(). This allows to omit the string buffer and use a global (thread-local) buffer. That "convenience" seems error prone. Start drop it. Start by adding a g_return_if_reached() assertion to catch the cases that use it. --- src/libnm-glib-aux/nm-shared-utils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libnm-glib-aux/nm-shared-utils.c b/src/libnm-glib-aux/nm-shared-utils.c index 3255368971..60ebe633bc 100644 --- a/src/libnm-glib-aux/nm-shared-utils.c +++ b/src/libnm-glib-aux/nm-shared-utils.c @@ -871,6 +871,11 @@ nm_utils_to_string_buffer_init(char **buf, gsize *len) if (!*buf) { *buf = _nm_utils_to_string_buffer; *len = NM_UTILS_TO_STRING_BUFFER_SIZE; + + /* We no longer want to support callers to omit the buffer + * and fallback to the global buffer. Callers should be fixed + * to always provide a valid buffer. */ + g_return_if_reached(); } } From 4fc25d523af0ad59a13be7dcdb25910d861e628b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 30 Mar 2022 09:13:45 +0200 Subject: [PATCH 17/23] platform: guard logging statements with check whether logging is enabled --- src/libnm-platform/nm-platform.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index 42966aced9..10bc55d000 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -1873,12 +1873,14 @@ nm_platform_link_set_sriov_vfs(NMPlatform *self, int ifindex, const NMPlatformVF g_return_val_if_fail(ifindex > 0, FALSE); - _LOG3D("link: setting VFs"); - for (i = 0; vfs[i]; i++) { - char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; - const NMPlatformVF *vf = vfs[i]; + if (_LOGD_ENABLED()) { + _LOG3D("link: setting VFs"); + for (i = 0; vfs[i]; i++) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + const NMPlatformVF *vf = vfs[i]; - _LOG3D("link: VF %s", nm_platform_vf_to_string(vf, sbuf, sizeof(sbuf))); + _LOG3D("link: VF %s", nm_platform_vf_to_string(vf, sbuf, sizeof(sbuf))); + } } return klass->link_set_sriov_vfs(self, ifindex, vfs); @@ -1895,16 +1897,18 @@ nm_platform_link_set_bridge_vlans(NMPlatform *self, g_return_val_if_fail(ifindex > 0, FALSE); - _LOG3D("link: %s bridge VLANs on %s", - vlans ? "setting" : "clearing", - on_master ? "master" : "self"); - if (vlans) { - for (i = 0; vlans[i]; i++) { - char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; - const NMPlatformBridgeVlan *vlan = vlans[i]; + if (_LOGD_ENABLED()) { + _LOG3D("link: %s bridge VLANs on %s", + vlans ? "setting" : "clearing", + on_master ? "master" : "self"); + if (vlans) { + for (i = 0; vlans[i]; i++) { + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + const NMPlatformBridgeVlan *vlan = vlans[i]; - _LOG3D("link: bridge VLAN %s", - nm_platform_bridge_vlan_to_string(vlan, sbuf, sizeof(sbuf))); + _LOG3D("link: bridge VLAN %s", + nm_platform_bridge_vlan_to_string(vlan, sbuf, sizeof(sbuf))); + } } } From 3a545fd041cbfb242d8457f55a4e9f9295d41f61 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 1 Apr 2022 21:25:55 +0200 Subject: [PATCH 18/23] platform: use nm_utils_ip4_address_clear_host_address() We have this util function, presumably because it's good to have it. Use it. --- src/libnm-platform/nm-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index 10bc55d000..112b9d5df6 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -7988,8 +7988,8 @@ nm_platform_ip4_address_pretty_sort_cmp(const NMPlatformIP4Address *a1, * subnet (and thus also the primary/secondary role) is * preserved. */ - n1 = a1->address & _nm_utils_ip4_prefix_to_netmask(a1->plen); - n2 = a2->address & _nm_utils_ip4_prefix_to_netmask(a2->plen); + n1 = nm_utils_ip4_address_clear_host_address(a1->address, a1->plen); + n2 = nm_utils_ip4_address_clear_host_address(a2->address, a2->plen); NM_CMP_DIRECT_MEMCMP(&n1, &n2, sizeof(guint32)); return 0; } From d7990b359b421ebc4a8bde7fdd6614773d157153 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 1 Apr 2022 21:29:51 +0200 Subject: [PATCH 19/23] glib-aux: move ip address utils in "nm-shared-utils.h" header Some were duplicated. Drop those. Some function were in an order where they required forward declarations. Reorder. --- src/libnm-glib-aux/nm-shared-utils.h | 54 ++++++++++++---------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/src/libnm-glib-aux/nm-shared-utils.h b/src/libnm-glib-aux/nm-shared-utils.h index b9b16950fa..3cf9fcc59d 100644 --- a/src/libnm-glib-aux/nm-shared-utils.h +++ b/src/libnm-glib-aux/nm-shared-utils.h @@ -389,6 +389,10 @@ gboolean nm_utils_get_ipv6_interface_identifier(NMLinkType link_type, /*****************************************************************************/ +in_addr_t _nm_utils_ip4_prefix_to_netmask(guint32 prefix); +guint32 _nm_utils_ip4_get_default_prefix0(in_addr_t ip); +guint32 _nm_utils_ip4_get_default_prefix(in_addr_t ip); + gconstpointer nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer src, guint8 plen); in_addr_t nm_utils_ip4_address_clear_host_address(in_addr_t addr, guint8 plen); @@ -408,6 +412,20 @@ int nm_utils_ip6_address_same_prefix_cmp(const struct in6_addr *addr_a, const struct in6_addr *addr_b, guint8 plen); +static inline gboolean +nm_utils_ip4_address_same_prefix(in_addr_t addr_a, in_addr_t addr_b, guint8 plen) +{ + return nm_utils_ip4_address_same_prefix_cmp(addr_a, addr_b, plen) == 0; +} + +static inline gboolean +nm_utils_ip6_address_same_prefix(const struct in6_addr *addr_a, + const struct in6_addr *addr_b, + guint8 plen) +{ + return nm_utils_ip6_address_same_prefix_cmp(addr_a, addr_b, plen) == 0; +} + static inline int nm_utils_ip_address_same_prefix_cmp(int addr_family, gconstpointer addr_a, @@ -427,20 +445,6 @@ nm_utils_ip_address_same_prefix_cmp(int addr_family, return nm_utils_ip6_address_same_prefix_cmp(addr_a, addr_b, plen); } -static inline gboolean -nm_utils_ip4_address_same_prefix(in_addr_t addr_a, in_addr_t addr_b, guint8 plen) -{ - return nm_utils_ip4_address_same_prefix_cmp(addr_a, addr_b, plen) == 0; -} - -static inline gboolean -nm_utils_ip6_address_same_prefix(const struct in6_addr *addr_a, - const struct in6_addr *addr_b, - guint8 plen) -{ - return nm_utils_ip6_address_same_prefix_cmp(addr_a, addr_b, plen) == 0; -} - static inline gboolean nm_utils_ip_address_same_prefix(int addr_family, gconstpointer addr_a, @@ -458,6 +462,10 @@ nm_utils_ip_address_same_prefix(int addr_family, /*****************************************************************************/ +gboolean nm_utils_ip_is_site_local(int addr_family, const void *address); + +/*****************************************************************************/ + #define NM_IPV4LL_NETWORK ((in_addr_t) (htonl(0xA9FE0000lu))) #define NM_IPV4LL_NETMASK ((in_addr_t) (htonl(0xFFFF0000lu))) @@ -974,24 +982,6 @@ nm_utils_escaped_tokens_options_escape_val(const char *val, char **out_to_free) /*****************************************************************************/ -guint32 _nm_utils_ip4_prefix_to_netmask(guint32 prefix); -guint32 _nm_utils_ip4_get_default_prefix0(in_addr_t ip); -guint32 _nm_utils_ip4_get_default_prefix(in_addr_t ip); - -gconstpointer -nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer src, guint8 plen); -in_addr_t nm_utils_ip4_address_clear_host_address(in_addr_t addr, guint8 plen); -const struct in6_addr *nm_utils_ip6_address_clear_host_address(struct in6_addr *dst, - const struct in6_addr *src, - guint8 plen); -int nm_utils_ip6_address_same_prefix_cmp(const struct in6_addr *addr_a, - const struct in6_addr *addr_b, - guint8 plen); - -gboolean nm_utils_ip_is_site_local(int addr_family, const void *address); - -/*****************************************************************************/ - gboolean nm_utils_parse_inaddr_bin_full(int addr_family, gboolean accept_legacy, const char *text, From b5a06dedd4080532cdda758fb6fd8dd3f3f9f6d3 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 1 Apr 2022 21:29:51 +0200 Subject: [PATCH 20/23] glib-aux: move nm_utils_ip4_address_clear_host_address() to header so it can be inlined --- src/libnm-glib-aux/nm-shared-utils.c | 26 ----------------------- src/libnm-glib-aux/nm-shared-utils.h | 31 ++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/libnm-glib-aux/nm-shared-utils.c b/src/libnm-glib-aux/nm-shared-utils.c index 60ebe633bc..304740d60e 100644 --- a/src/libnm-glib-aux/nm-shared-utils.c +++ b/src/libnm-glib-aux/nm-shared-utils.c @@ -950,20 +950,6 @@ nm_utils_flags2str(const NMUtilsFlags2StrDesc *descs, /*****************************************************************************/ -/** - * _nm_utils_ip4_prefix_to_netmask: - * @prefix: a CIDR prefix - * - * Returns: the netmask represented by the prefix, in network byte order - **/ -guint32 -_nm_utils_ip4_prefix_to_netmask(guint32 prefix) -{ - return prefix < 32 ? ~htonl(0xFFFFFFFFu >> prefix) : 0xFFFFFFFFu; -} - -/*****************************************************************************/ - guint32 _nm_utils_ip4_get_default_prefix0(in_addr_t ip) { @@ -6320,18 +6306,6 @@ nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer return dst; } -/* nm_utils_ip4_address_clear_host_address: - * @addr: source ip6 address - * @plen: prefix length of network - * - * returns: the input address, with the host address set to 0. - */ -in_addr_t -nm_utils_ip4_address_clear_host_address(in_addr_t addr, guint8 plen) -{ - return addr & _nm_utils_ip4_prefix_to_netmask(plen); -} - /* nm_utils_ip6_address_clear_host_address: * @dst: destination output buffer, will contain the network part of the @src address * @src: source ip6 address diff --git a/src/libnm-glib-aux/nm-shared-utils.h b/src/libnm-glib-aux/nm-shared-utils.h index 3cf9fcc59d..0953063081 100644 --- a/src/libnm-glib-aux/nm-shared-utils.h +++ b/src/libnm-glib-aux/nm-shared-utils.h @@ -389,13 +389,36 @@ gboolean nm_utils_get_ipv6_interface_identifier(NMLinkType link_type, /*****************************************************************************/ -in_addr_t _nm_utils_ip4_prefix_to_netmask(guint32 prefix); -guint32 _nm_utils_ip4_get_default_prefix0(in_addr_t ip); -guint32 _nm_utils_ip4_get_default_prefix(in_addr_t ip); +/** + * _nm_utils_ip4_prefix_to_netmask: + * @prefix: a CIDR prefix + * + * Returns: the netmask represented by the prefix, in network byte order + **/ +static inline in_addr_t +_nm_utils_ip4_prefix_to_netmask(guint32 prefix) +{ + return prefix < 32 ? ~htonl(0xFFFFFFFFu >> prefix) : 0xFFFFFFFFu; +} + +guint32 _nm_utils_ip4_get_default_prefix0(in_addr_t ip); +guint32 _nm_utils_ip4_get_default_prefix(in_addr_t ip); gconstpointer nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer src, guint8 plen); -in_addr_t nm_utils_ip4_address_clear_host_address(in_addr_t addr, guint8 plen); + +/* nm_utils_ip4_address_clear_host_address: + * @addr: source ip6 address + * @plen: prefix length of network + * + * returns: the input address, with the host address set to 0. + */ +static inline in_addr_t +nm_utils_ip4_address_clear_host_address(in_addr_t addr, guint8 plen) +{ + return addr & _nm_utils_ip4_prefix_to_netmask(plen); +} + const struct in6_addr *nm_utils_ip6_address_clear_host_address(struct in6_addr *dst, const struct in6_addr *src, guint8 plen); From 0cf9db42d4a40e8602d86759d75bc25b0f84f313 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 5 Apr 2022 18:12:24 +0200 Subject: [PATCH 21/23] glib-aux: use uint32 type for prefix length parameter Of course, the prefix length cannot be larger than 32 or 128. But as C does implicit conversions, a buggy prefix length can lead to a (wrongly) valid prefix length. Make the type uint32, to prevent that (at least for common cases, unless you pass a huge 64 bit integer). --- src/libnm-glib-aux/nm-shared-utils.c | 9 +++++---- src/libnm-glib-aux/nm-shared-utils.h | 12 ++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/libnm-glib-aux/nm-shared-utils.c b/src/libnm-glib-aux/nm-shared-utils.c index 304740d60e..9c7bceb01b 100644 --- a/src/libnm-glib-aux/nm-shared-utils.c +++ b/src/libnm-glib-aux/nm-shared-utils.c @@ -6282,7 +6282,7 @@ _nm_utils_ssid_to_string_gbytes(GBytes *ssid) /*****************************************************************************/ gconstpointer -nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer src, guint8 plen) +nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer src, guint32 plen) { g_return_val_if_fail(dst, NULL); @@ -6308,7 +6308,8 @@ nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer /* nm_utils_ip6_address_clear_host_address: * @dst: destination output buffer, will contain the network part of the @src address - * @src: source ip6 address + * @src: source ip6 address. If NULL, this does an in-place update of @dst. + * Also, @src and @dst are allowed to be the same pointers. * @plen: prefix length of network * * Note: this function is self assignment safe, to update @src inplace, set both @@ -6317,7 +6318,7 @@ nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer const struct in6_addr * nm_utils_ip6_address_clear_host_address(struct in6_addr *dst, const struct in6_addr *src, - guint8 plen) + guint32 plen) { g_return_val_if_fail(plen <= 128, NULL); g_return_val_if_fail(dst, NULL); @@ -6346,7 +6347,7 @@ nm_utils_ip6_address_clear_host_address(struct in6_addr *dst, int nm_utils_ip6_address_same_prefix_cmp(const struct in6_addr *addr_a, const struct in6_addr *addr_b, - guint8 plen) + guint32 plen) { int nbytes; guint8 va, vb, m; diff --git a/src/libnm-glib-aux/nm-shared-utils.h b/src/libnm-glib-aux/nm-shared-utils.h index 0953063081..56ab5e0d93 100644 --- a/src/libnm-glib-aux/nm-shared-utils.h +++ b/src/libnm-glib-aux/nm-shared-utils.h @@ -405,7 +405,7 @@ guint32 _nm_utils_ip4_get_default_prefix0(in_addr_t ip); guint32 _nm_utils_ip4_get_default_prefix(in_addr_t ip); gconstpointer -nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer src, guint8 plen); +nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer src, guint32 plen); /* nm_utils_ip4_address_clear_host_address: * @addr: source ip6 address @@ -414,17 +414,17 @@ nm_utils_ipx_address_clear_host_address(int family, gpointer dst, gconstpointer * returns: the input address, with the host address set to 0. */ static inline in_addr_t -nm_utils_ip4_address_clear_host_address(in_addr_t addr, guint8 plen) +nm_utils_ip4_address_clear_host_address(in_addr_t addr, guint32 plen) { return addr & _nm_utils_ip4_prefix_to_netmask(plen); } const struct in6_addr *nm_utils_ip6_address_clear_host_address(struct in6_addr *dst, const struct in6_addr *src, - guint8 plen); + guint32 plen); static inline int -nm_utils_ip4_address_same_prefix_cmp(in_addr_t addr_a, in_addr_t addr_b, guint8 plen) +nm_utils_ip4_address_same_prefix_cmp(in_addr_t addr_a, in_addr_t addr_b, guint32 plen) { NM_CMP_DIRECT(htonl(nm_utils_ip4_address_clear_host_address(addr_a, plen)), htonl(nm_utils_ip4_address_clear_host_address(addr_b, plen))); @@ -433,10 +433,10 @@ nm_utils_ip4_address_same_prefix_cmp(in_addr_t addr_a, in_addr_t addr_b, guint8 int nm_utils_ip6_address_same_prefix_cmp(const struct in6_addr *addr_a, const struct in6_addr *addr_b, - guint8 plen); + guint32 plen); static inline gboolean -nm_utils_ip4_address_same_prefix(in_addr_t addr_a, in_addr_t addr_b, guint8 plen) +nm_utils_ip4_address_same_prefix(in_addr_t addr_a, in_addr_t addr_b, guint32 plen) { return nm_utils_ip4_address_same_prefix_cmp(addr_a, addr_b, plen) == 0; } From a850e438a7ad535d2c82e062830d3c80e3735fd0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 6 Apr 2022 07:59:54 +0200 Subject: [PATCH 22/23] glib-aux/tests: avoid invalid prefix length in test_platform_ip_address_pretty_sort_cmp() Next we are going to assert that the prefix length is valid. The test needs to have valid prefix lengths too. Adjust. --- .../platform/tests/test-platform-general.c | 538 +++++++++--------- 1 file changed, 270 insertions(+), 268 deletions(-) diff --git a/src/core/platform/tests/test-platform-general.c b/src/core/platform/tests/test-platform-general.c index 42e05dadfe..93e525dd8d 100644 --- a/src/core/platform/tests/test-platform-general.c +++ b/src/core/platform/tests/test-platform-general.c @@ -101,9 +101,9 @@ static void test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data) { static const char *const EXPECTED_BUFFER[3] = { - [0] = ("5b1aea34648cabfec7c3523f76cf1ce34ca17a9a32f3f0f218424e48836dd1cb504e03d53e1124c5" + [0] = ("5b1aea34648cabfec7c3523f76cf1ce34ca17a9a32f3f0f218024e48836dd1cb504e03d53e1124c5" "0065aeb2e6fbf952902383028e3b47f280f062ea1a7e0b7be218d067530e1b0487b8c3b99f2b8a1a" - "8982c42f0000003437c5156e072b2f2f0037c9cfe07c34ddb3980deb14ab7b5af84a034703000000" + "8907c42f0000003437c5156e072b2f2f0037c9cfe07c34ddb3980deb14ab7b5af84a034703000000" "883b0f3fd6ed84d6c959e553b887edcd6101f5d200000043b809d259e499db7d00f1853bdcb0e4bc" "0e2b00b667b7b16d8d1e69c803000000b973972c17a47631c169f11ff9119c40b403b6630000007a" "034f43340d01683c0045097aea4a849f060ddf57b24a5be9636360d603000000ad7c499dd538d345" @@ -115,50 +115,50 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data) "6663861eea1bf42c12ea3b9503000000fb95e8332fdfff658483a2d039a7bf148e02481e00000060" "e89f7abdb682380a00eae374835b4a49a2b980b6aba92da6409969aa03000000e00473755d31e5b2" "de252167c1c91b3a36020c700000007740318db913a353ed006efc068829c0e66ad0143a0554efb4" - "40e55b8b03000000c0cfb2b4386bec092fa5757ecde9348bda002ebd000000ab667224dae775e5cc" - "0041aca2ff0f576767d3648102b61886d149f07403000000153ece68ade15cec25a59273e7519f34" - "c4458d70000000f3819aa46fbe1439340033ae6dec0fb124f264af67eed7c9a8ecc8fb1103000000" + "d149f07403000000153ece68ade15cec25a59273e7519f34c40d8d70000000f3819aa46fbe143934" + "0033ae6dec0fb124f264af67eed7c9a840e55b8b03000000c0cfb2b4386bec092fa5757ecde9348b" + "da002ebd000000ab667224dae775e5cc0041aca2ff0f576767d3648102b61886ecc8fb1103000000" "fcebbaeb0c56535923f14874042a8aff1d028e5ec3cc13cc36bbe3c9bb0ec36f00e007bb64a2827b" "7cdd38d0314c178e5a06c40b03000000ab90135fa636af4464d210a256be75e0500244770000004b" "2e69220d6c0fc09c25d6534c809829af4a9df58dbfef186d416f3a1e030000002c932e655203d82a" "3c84c4eb274ed18687030281000000f2235376239daeaacb3cae864b437baaae91921681c2162b9b" "69e66142030000004fda8a3e0b841cf76391dd68269b53eccb02a831000000b78c54dda9ac3bb1b1" "d43e6505621b9a7f0422ae3fc8979ee0416f95e70300000057d6249b652ba98c7dc7f17f666969e4" - "5c02af7a000000ee0b06fa9e988f80f0de6dc8dfcf2a3ad3bbcc0fa3b314f695111d891d03000000" - "cd897619f51f44e644d7cf1d06b2b115d800549e62c12fba5b1cdec48d10bbb13b8313d8cd2a24d3" - "4fc812bd2f8a59d90fcc00ac030000005292cd32dc096cd5d8a4c5cf3351ee1cfc03056c00000051" - "bbce426cfa4b861cc78592be7b14e7ba9c15acb881ae55f0e5fe7d360300000066a3ae3939762df3" - "3a2d55060c78d551cb0010fd00000041b9aca07b6e4925dd27943a272c171ed15abbbe1cd911db7b" - "86ed271803000000a5edc511c1507a141e0f515638c7ba31f50209450000003357ae79989870ccec" - "3def0ad92749e016663fe6ee0228c1da82d1595603000000348352d715cf9d411ea012e5307294b6" - "e301dac4000000075efee38dd16f8ee4ccd2f50c30706cae3fdcc2f0ee3d5e26bb20413203000000" - "862573c2303dd1d65c7b2cffeca6d1adaccae11f0000000f855ebf3b772eb2b1c896c9a7304f6645" - "0a5f6abd850b06e3b10123e6030000001dff045298cfee0636674cdefb57b9ae54cfe8f400000038" - "1ba2c4396de60f032bc7f34de2959871c0d4c0d4eb720c4ab550c5db03000000f32f4af595d785d5" - "c1b5aad487c192f08bd7a09b00000043288cd9bf66ec305a225a0c71b2ce78bb16104c8eaf18c565" - "b16c7376030000005219061ab4c5c79489b2cc6a883c146972decb8b000000f5e6d66df46ea13910" - "7754dee62c36d2fc70ccc567df7a49b8585287dc03000000cfb18b2b2cb749e2e03e544d0eb4f73e" - "75039fcf251b32fc79685b05ddd3aa9ba511d2e40edb4d758fb554158ae5c7c0beb42b3403000000" + "5c02af7a000000ee0b06fa9e988f80f0de6dc8dfcf2a3ad3bbcc0fa3b314f695b550c5db03000000" + "f32f4af595d785d5c1b5aad487c192f08b12a09b00000043288cd9bf66ec305a225a0c71b2ce78bb" + "16104c8eaf18c565111d891d03000000cd897619f51f44e644d7cf1d06b2b115d800549e62c12fba" + "5b1cdec48d10bbb13b8313d8cd2a24d34fc812bd2f8a59d90fcc00ac030000005292cd32dc096cd5" + "d8a4c5cf3351ee1cfc03056c00000051bbce426cfa4b861cc78592be7b14e7ba9c15acb881ae55f0" + "b16c7376030000005219061ab4c5c79489b2cc6a883c14697205cb8b000000f5e6d66df46ea13910" + "7754dee62c36d2fc70ccc567df7a49b8e5fe7d360300000066a3ae3939762df33a2d55060c78d551" + "cb0010fd00000041b9aca07b6e4925dd27943a272c171ed15abbbe1cd911db7b86ed271803000000" + "a5edc511c1507a141e0f515638c7ba31f50209450000003357ae79989870ccec3def0ad92749e016" + "663fe6ee0228c1dabb20413203000000862573c2303dd1d65c7b2cffeca6d1adac11e11f0000000f" + "855ebf3b772eb2b1c896c9a7304f66450a5f6abd850b06e382d1595603000000348352d715cf9d41" + "1ea012e5307294b6e301dac4000000075efee38dd16f8ee4ccd2f50c30706cae3fdcc2f0ee3d5e26" + "b10123e6030000001dff045298cfee0636674cdefb57b9ae541de8f4000000381ba2c4396de60f03" + "2bc7f34de2959871c0d4c0d4eb720c4a585287dc03000000cfb18b2b2cb749e2e03e544d0eb4f73e" + "751d9fcf251b32fc79685b05ddd3aa9ba511d2e40edb4d758fb554158ae5c7c0beb42b3403000000" "895d5f24037d233302ad3b82d639272e4a02eadfbd2146bf8cfdb205f90e54b58a6ee136a779f37c" - "30d2c5053c40ecaec38b6b8e03000000bea73223e59bf0193432e9fa7a899f2d8ec7e4b89bf5a5d0" + "30d2c5053c40ecaec38b6b8e03000000bea73223e59bf0193432e9fa7a899f2d8e0ae4b89bf5a5d0" "6776e66a9d80ab132e1ac921eb76adbb229df32e561fa80a0fc4676703000000a23eb66e720da9e0" "7ac998b5690807d52602369ee1af4ca5a6a95581af5fd7ceacdca10f47d7b351a36b178aabc78a4a" "1a0dd8c003000000e2815a1a37a52bddd1c2f1018b587eed720358f0e9201f17bd99fcf72909ac9e" "7a55299e9bb4fd53bc7417940fcffe3f81cafd6302000000d6732578acd14320aefd4503189f7630" - "2403501c0000002b9f3c39f24b0572b100745cb25851429b3bbfb50168dfd04eb62f22ca02000000" - "891715df7fc6a902edae579e2e10c7f7a202a0340436242cbeb0248cee3fbc160032d4f28aa28c08" - "f80dd50c6712dfb4abba4a32020000008ffe423d01883918039249f398f9b37ea091465100000064" - "3722d9b707c0d8a400b7c8307f06b4b29088f20d9ac676d5e4bafc4e02000000fde69eec3af2e6d0" - "bd68ab722af14548b29572e504265f6c72923e22594f3f790008ed2e2ebb0771db46a54cadb245ea" + "2403501c0000002b9f3c39f24b0572b100745cb25851429b3bbfb50168dfd04eabba4a3202000000" + "8ffe423d01883918039249f398f9b37ea0104651000000643722d9b707c0d8a400b7c8307f06b4b2" + "9088f20d9ac676d5b62f22ca02000000891715df7fc6a902edae579e2e10c7f7a202a0340436242c" + "beb0248cee3fbc160032d4f28aa28c08f80dd50c6712dfb4e4bafc4e02000000fde69eec3af2e6d0" + "bd68ab722af14548b20672e504265f6c72923e22594f3f790008ed2e2ebb0771db46a54cadb245ea" "8c3b371502000000710c030690f5f18ea125dbf7d7e93bd65c01a56dfdcfc1155f236c8b9c79a620" "00660bbf024b03ff0a8e27c405e64244e36f90d402000000fd41fe47684b370b6ec6584d64496089" - "570968ead4d1ae91c819bb068196d59900de3246e43f5e7945aaf95e2ffa3a11d1e1b34902000000" - "bcd7be07d78e6222e45aaf61814f703b40125e6b000000cbaaa37b861e6d46dafe7d6ec4ac1ea051" - "010911915ddb05f29c64ed0402000000a660ac824b7fae389861419c50da49bf2b02258300000025" + "570568ead4d1ae91c819bb068196d59900de3246e43f5e7945aaf95e2ffa3a11641e447502000000" + "b9b68c08a5e4351ea349e1ccf662e058b819a45100000045fcb6a035339d504c9726d80d9c2d89df" + "765b4d9a130257dc9c64ed0402000000a660ac824b7fae389861419c50da49bf2b02258300000025" "9f9f0251becc987907879cca68fec7bbbb5f8edf248b4995d184e82002000000a19cdf6dd1c173f6" "078a806d329c9b008b00c972000000f5b2cd3dbddc74e26de958e48d2ab8b0313e7f8933e315130f" - "641e447502000000b9b68c08a5e4351ea349e1ccf662e058b879a45100000045fcb6a035339d504c" - "9726d80d9c2d89df765b4d9a130257dcc43bd794010000005bfe47c6f53a54e01b0c1d89414d94d0" + "d1e1b34902000000bcd7be07d78e6222e45aaf61814f703b401f5e6b000000cbaaa37b861e6d46da" + "fe7d6ec4ac1ea051010911915ddb05f2c43bd794010000005bfe47c6f53a54e01b0c1d89414d94d0" "e0032ec50000000103781b0f294a2b7300421398f4de67e9cee64b38b56e03e01539ce4101000000" "18238487a417f3da01d99dae5f190096cc012cab0000005b2363d13edc5aa115005eb914d8fbe9a4" "fdb3d117d76b0de5bd82e9ea010000003d1b91caae8cb60b49ba9be338d856a40c02c3d400000064" @@ -172,49 +172,49 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data) "b900b2061d0c334b009f2dd1cdf64b0f9a60e0e289f08db3fde6b0250100000039dd8f88152a5845" "4d9ca9d20f45dfa774028604000000fbcd7db68b9ae586da00b4070c50320427c4dd3d031e33f22c" "210aeb09010000007000b96d06992b6a58acd3995b9663d2df02f333ef467092818aa77d6732b678" - "00844ef5a943825fcd743f59bd14c89b955e1a13010000007acbce3e3bcdf3824f1b134847ff26ba" - "4400774900000017ec852d59f3d17232edd86ad6c3103a68843a9aef34983882d3d3878501000000" - "5e0dfe491d1ba96742c7b5e02b2271229c01b02a06d0dc5504b0595daf37deb499996bfb667f072d" - "ec1e5d9cdc8a11f4409bcfb30100000099d90a8543961b2ccd47724a3c460ba85103f4c500000063" - "eafb1ac4c0982b283aa9986700b2a2b3ed257b8b0489f48f053ec8ca0100000027335a25a364d101" - "5ffac03089f45539e1021784000000d7b83579b8da27345a72437f9b6245de39ec9e71ee4b951507" - "f121014a01000000efc67bce716c856e3973dc42a1003be94f89d8ee0000009b5d5bbe6c10085f3d" - "6176f78a19bb8df1804c122fce5078c156e8f3fe010000000ea8042602a1f8e6f5657f3f9e3eb807" - "cbad7645000000b8df6f628a70456d79f25d5895fb57fa60d9279fb2b8fcbac65ad47b8a01000000" - "da40d88d40a6d75bc404156225b7eedefc2b44574b15e2ae496ad01bf007eacb0a28aec868282510" - "b60291ea6480e356925b568a0000000087bb24e5264fd3ebe9cf9f6df9615189f701e815000000a7" - "5c9555876b6a3f13002b6cb8360feaac1d5c302df59dd32a7a859db500000000362956cd46646a0e" - "222160e5f769bb295703ed370000005b6a813387e99bb834009da86c64fefab2548759d313a5b92d" - "8e47935e0000000034f0386a253c21d94064f6b021281e235f00ae20000000d71fd050bf8d85055b" - "00e3756ccdb3455c60ca7b11c66af76e594f24a100000000e143fd52599364e13468f80fd514573f" - "b572671c0000006932d1d5f5d0ce2cf6007a70ba5193a162bc92ec1b11d9172c857ae81200000000" - "3e29535402e9b690c628d048eacce745ea213cb1000000b632ef3be6070dafa200187470e9da5570" - "9427c226d324d9a08487fd0d00000000b7a350f9fc1519defa7db4532545666937c22a3b000000dc" + "00844ef5a943825fcd743f59bd14c89bf121014a01000000efc67bce716c856e3973dc42a1003be9" + "4f0ed8ee0000009b5d5bbe6c10085f3d6176f78a19bb8df1804c122fce5078c1955e1a1301000000" + "7acbce3e3bcdf3824f1b134847ff26ba4400774900000017ec852d59f3d17232edd86ad6c3103a68" + "843a9aef34983882d3d38785010000005e0dfe491d1ba96742c7b5e02b2271229c01b02a06d0dc55" + "04b0595daf37deb499996bfb667f072dec1e5d9cdc8a11f4409bcfb30100000099d90a8543961b2c" + "cd47724a3c460ba85103f4c500000063eafb1ac4c0982b283aa9986700b2a2b3ed257b8b0489f48f" + "053ec8ca0100000027335a25a364d1015ffac03089f45539e1021784000000d7b83579b8da27345a" + "72437f9b6245de39ec9e71ee4b95150756e8f3fe010000000ea8042602a1f8e6f5657f3f9e3eb807" + "cb067645000000b8df6f628a70456d79f25d5895fb57fa60d9279fb2b8fcbac65ad47b8a01000000" + "da40d88d40a6d75bc404156225b7eedefc1e44574b15e2ae496ad01bf007eacb0a28aec868282510" + "b60291ea6480e356594f24a100000000e143fd52599364e13468f80fd514573fb517671c00000069" + "32d1d5f5d0ce2cf6007a70ba5193a162bc92ec1b11d9172c925b568a0000000087bb24e5264fd3eb" + "e9cf9f6df9615189f701e815000000a75c9555876b6a3f13002b6cb8360feaac1d5c302df59dd32a" + "7a859db500000000362956cd46646a0e222160e5f769bb295703ed370000005b6a813387e99bb834" + "009da86c64fefab2548759d313a5b92d8e47935e0000000034f0386a253c21d94064f6b021281e23" + "5f00ae20000000d71fd050bf8d85055b00e3756ccdb3455c60ca7b11c66af76e857ae81200000000" + "3e29535402e9b690c628d048eacce745ea053cb1000000b632ef3be6070dafa200187470e9da5570" + "9427c226d324d9a08487fd0d00000000b7a350f9fc1519defa7db45325456669371e2a3b000000dc" "c405cbee5016c25200d8901d7a0165fe20744edb6ba04f14a4c73cf500000000a4bab14874afdf54" - "e6aae816430607ca0675e09818e9bbec5918c59068baf76a008940f6fc3bbdc7f6090f756aae660b" + "e6aae816430607ca061fe09818e9bbec5918c59068baf76a008940f6fc3bbdc7f6090f756aae660b" "6e4c699300000000d9c1e67743efb54e54270e46042e91186a034e38000000376feecb80ac245409" "c0becc271d9c2f67179bff0644399ae7df6b3542000000004c5cf8107ba282f4f983821918f93e74" - "2d08f0550000006f2292362e5d68265d9f98c82d9b7a559be3acf4fc36fa6b51e3c9472e00000000" + "2d00f0550000006f2292362e5d68265d9f98c82d9b7a559be3acf4fc36fa6b51e3c9472e00000000" "c5cfd9f2343b21362c19a0921dce2f839200fa45000000270b9977e166bee737fe73670c439a644c" - "323b59b4cd20eb7dabea74f700000000f6989d2d6a909e986ff7add5df2c93e05459507b0000000f" - "466554d2ae4d52a8c67b2e48b47003c81785d3ffdbd9a61759747cf200000000ab2dadc5a39411fd" - "4ff1116d478987316a553fc2000000cfc6ebe434a7ae8ff040483e310819e3b10db116431ec6f769" - "438a72e1000000002495a609675344f7e2e3a5ebaec3c85f0a1742f70abe95c50345132a61eda239" - "d9d083c3bf085387046ef8a36f0e9e696b382ab0000000009a6ce5d906837dbca6a5ee19d6f63fe9" + "323b59b4cd20eb7dabea74f700000000f6989d2d6a909e986ff7add5df2c93e05412507b0000000f" + "466554d2ae4d52a8c67b2e48b47003c81785d3ffdbd9a617438a72e1000000002495a609675344f7" + "e2e3a5ebaec3c85f0a0042f70abe95c50345132a61eda239d9d083c3bf085387046ef8a36f0e9e69" + "59747cf200000000ab2dadc5a39411fd4ff1116d478987316a1f3fc2000000cfc6ebe434a7ae8ff0" + "40483e310819e3b10db116431ec6f7696b382ab0000000009a6ce5d906837dbca6a5ee19d6f63fe9" "cb0301f7246f13b2050424a2b3a45ef7a029c896b4132bd895072cfeffe9d6815997069500000000" "0d3c723b91adb0da7c4aa7e7eb5a15bcde035fb98b841fd84cc43c510385b9a4c2aac1d67a909b29" - "7c703915312e9c3cae02dfa000000000dd603bd35e7fa0f02f2f3313d8469d09a92409c0b7f0318a" + "7c703915312e9c3cae02dfa000000000dd603bd35e7fa0f02f2f3313d8469d09a91709c0b7f0318a" "575a4f8e061db3dd7fde25654a4059d565dbc8a91e3b4457b077ddad3108be69f9b97d05c917ad6b" - "10e693bb6e26f2ba90c8e909a9fe20e5c7a4c656482a9b0d00625009a40aeb62a42b6a62548e3c38" + "10e693bb6e26f2ba900fe909a9fe20e5c7a4c656482a9b0d00625009a40aeb62a42b6a62548e3c38" "cd3c72f203000000ca82ac5180101be4f85cef468ea086ea9a01fdc3a9fe1ec787bc45db7c52a52d" "00bd39a44e8e8bc17c01ac63eca0c1cf5ff7f03a03000000c9a89192c1c8be55281a59d1fd338f35" - "7e00f8cea9fec34573654ea6624f138ef9531cd9367a02e4d241989477a363d53b02239e03000000" - "24438387def0f4c6544e4b275d9b7146a70010d2a9fec17647176b7c07d856e3b883efebc09dd9d6" - "1966b7ae7412041d57393c6f03000000182c0287822a272bec4501a1e27acfee7a0188ffa9fe6cae" - "426de59560fad65d67c624f285d7174177a47579dda0b6eaa9a84c820300000070b1646d8026e9f1" - "704f1b16286ba2dabc01f082a9feed33ef60a8b540b26f66761d1f13badfad0fe8fa8f3c1aad2a82" - "fa40546c03000000df2d7c2790d3119a051bb2ee8192ac0cfa3abc1ea9fe3e7d75a2f42b50c6a363" - "40132378b95c59313bacba64dbe996206e6904f50200000047150b9b14010469823acb72bb89182f" + "7e00f8cea9fec34573654ea6624f138ef9531cd9367a02e4d241989477a363d5fa40546c03000000" + "df2d7c2790d3119a051bb2ee8192ac0cfa00bc1ea9fe3e7d75a2f42b50c6a36340132378b95c5931" + "3bacba64dbe996203b02239e0300000024438387def0f4c6544e4b275d9b7146a70010d2a9fec176" + "47176b7c07d856e3b883efebc09dd9d61966b7ae7412041d57393c6f03000000182c0287822a272b" + "ec4501a1e27acfee7a0188ffa9fe6cae426de59560fad65d67c624f285d7174177a47579dda0b6ea" + "a9a84c820300000070b1646d8026e9f1704f1b16286ba2dabc01f082a9feed33ef60a8b540b26f66" + "761d1f13badfad0fe8fa8f3c1aad2a826e6904f50200000047150b9b14010469823acb72bb89182f" "93002196a9feb9153b36bc60be5b534e006527f67485ab35aca0c7ee419733853cf09e8b02000000" "e79c10acfce165e332a62384ec04e5bab40085ada9fe0070a36dd51323b2c54200154d12f86c260a" "9edfa7a74c1c83c1050f63f802000000443cacf59c6379a44b7892f487afa98cb102c19ca9fe942f" @@ -222,7 +222,7 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data) "36506ebd455e679cef009bb8a9fecec3f8c8fa6867a982be8a934f852cc3d4d82bc0ec7303f99f8f" "def85b7502000000a0bef8675b29a197b7b3cceaf5f1bb12c503256aa9fe6e5d58099ffc4a503a71" "2350acbd48411f0dc15d2f0f49dad345d966279502000000e06302aba042aaa218dc091e9aa1477f" - "6fdc9830a9fec95829a8838314dff34d24c332219a1b163a732d803e0e2f4f916d06412601000000" + "6f059830a9fec95829a8838314dff34d24c332219a1b163a732d803e0e2f4f916d06412601000000" "98c39e7cc282208fefc57ff447036b955101cb22a9fe793f797a3c7dadd1c86e009d0c90bc512e13" "7dcef5e4a27985bd5cfd5ce601000000152f2b70eaef7443e0f79ab6902dde533601ec71a9fe9f25" "4ac95883195580410062ed564153e17478f8c3344d89c0bbfaa100fd01000000be184524a6bdc878" @@ -230,7 +230,7 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data) "0d80684e01000000ba8110fb9733cc24904f288262e6ea77a203a5f8a9feeefa701d120523bd98f2" "00098b43cd68be6e3f81268193fd637e9037d7a701000000c47cf0f551e96770a754ac19ef820fe0" "2900f2d3a9fe049150b8d10ab700cc3a7cf51be0403b654ba2f56808092069af5f5b481b01000000" - "68cb3bc873b04d937a6ed8f7bc51e54066fed098a9fe048a92d3adc69a84eb47622400207799416a" + "68cb3bc873b04d937a6ed8f7bc51e5406617d098a9fe048a92d3adc69a84eb47622400207799416a" "f1f0a086fbd7e2f7dea0077a00000000c386e9c6e6a2cbfa10ee58bdc75183609900d627a9feb1cb" "e491cbbbf9443fd6007eb3c5bf64b671d6f18dbf463f9b83f512dc1c00000000fbab244735d67c61" "283031667b2d74a10302b1b1a9fe2aa590a2312e17f1a35900459582f4ef43c780908872746e39ef" @@ -241,306 +241,306 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data) "3215abf8fbdf17c3677e5a3a00000000608df061d45d864d09f4ecf17625f82da1034828a9fe1e37" "1051852c972ea7954079884af257b044fd13a6826a4c619f3d136cac000000009402a4c216772167" "3f2b02b3256ead1f2f039bc1a9fefca162fb81e733cff620ca7feefe1933631e8e69f6d9d6962d2c"), - [1] = ("54270e46020000006a894e387625da376feecb80ac245409c0becc271d9c2f67179bff0644399ae7" + [1] = ("54270e46020000006a894e387625da376feecb80ac245409c058cc271d9c2f67179bff0644399ae7" "9c64ed0432d599eaa660ac824b7fae389861419c7a899f2d010000009bf5a5d06776e66a9d80ab13" - "2e1ac921eb76adbb229df32e561fa80a40e55b8b1dd92e18c0cfb2b4386bec092fa5757ecde9348b" - "c4e1966800000000b3121cd5ef51e696c816290dbaee0e7726d082e1530ff5397c9125f59577d71c" + "2e1ac921eb04adbb229df32e561fa80a40e55b8b1dd92e18c0cfb2b4386bec092fa5757ecde9348b" + "c4e1966800000000b3121cd5ef51e696c816290dbaee0e77264c82e1530ff5397c9125f59577d71c" "4b258a005116d11354edff62ceaa458fc75a91c425a5927300000000c4458d70911714f1819aa46f" - "be143934c933ae6dec0fb124f264af67eed7c9a8c38b6b8ee2614344bea73223e59bf0193432e9fa" - "4cc43c5103000000c2aac1d67a909b297c703915312e9c3c5a06c40b20ea99d5ab90135fa636af44" + "be143934c915ae6dec0fb124f264af67eed7c9a8c38b6b8ee2614344bea73223e59bf0193432e9fa" + "4cc43c5103000000c2aac1d67a909b297c703915312e9c3c5a64c40b20ea99d5ab90135fa636af44" "64d210a256be75e0509c4477d19ac64b2e69220d12ea3b9501000000fb95e8332fdfff658483a2d0" - "39a7bf148ed3481e0bccc460e89f7abdb682380a62eae374835b4a49a2b980b6aba92da6409969aa" - "288cd9bf00000000225a0c71b2ce78bb16104c8eaf18c565ecc8fb112087b97cfcebbaeb0c565359" + "39a7bf148e4c481e0bccc460e89f7abdb682380a62eae374835b4a49a2b980b6aba92da6409969aa" + "288cd9bf00000000225a0c71b2ce78bb16104c8eaf18c565ec5ffb112087b97cfcebbaeb0c565359" "23f14874042a8aff1d1f8e5ec3cc13cc36bbe3c9bb0ec36f0000000064a2827b7cdd38d0314c178e" - "925b568ae56bc4e9fefb24e5264fd3ebe9cf9f6df9615189f78ee815b2781ea55c9555876b6a3f13" - "02e9b69000000000eacce745ea213cb1a84035b632ef3be6070dafa2fed87470e9da55709427c226" + "925b568ae566c4e9fefb24e5264fd3ebe9cf9f6df9615189f78ee815b2781ea55c9555876b6a3f13" + "02e9b69000000000eacce745ea213cb1a84035b632ef3be60755afa2fed87470e9da55709427c226" "d324d9a086ed27184b443181a5edc511c1507a142fea9bc10300000062fb81e733cff620ca7feefe" - "1933631e8e69f6d9fed62d2c6e6904f57239c09c47150b9b14010469823acb72bb89182f93112196" - "9985d62700000000e491cbbbf9443fd6a77eb3c5bf64b671d6f18dbffeff9b8306c83bc026977911" + "1933631e8e18f6d9fed62d2c6e6904f57239c09c47150b9b14010469823acb72bb89182f93112196" + "9985d62700000000e491cbbbf9443fd6a77eb3c5bf64b671d6098dbffeff9b8306c83bc026977911" "4bdade862c224f6f36506ebd455e679cef369bb8d514573f03000000f6932f6932d1d5f5d0ce2cf6" - "bf7a70ba5193a162fe92ec1b11d9172cf84a03478b82cdd8883b0f3fd6ed84d6c959e553b887edcd" - "6297dfa700000000fd0d53bb6215de4bb6f6f3d031a790287e45e9c1feb836c0a25ea71f5daaed4d" + "bf7a70ba5111a162fe92ec1b11d9172cf84a03478b82cdd8883b0f3fd6ed84d6c959e553b887edcd" + "6297dfa700000000fd0d53bb6215de4bb6f6f3d031a790287e7be9c1feb836c0a25ea71f5daaed4d" "99eb2ebebe3c432fec7d3abc4ccf30d3aaaf02a41e0f515601000000f57609453df7803357ae7998" - "9870ccec3def0ad9000000000000000000000000000000019f05a16768cb3bc873b04d937a6ed8f7" - "ae8cb60b0300000038d856a40c67c3d4afa9c8649da90bd2fff2f256000000000000000000000000" + "9870ccec3d4f0ad9000000000000000000000000000000019f05a16768cb3bc873b04d937a6ed8f7" + "ae8cb60b0300000038d856a40c67c3d4afa9c8649da90bd2ff4cf256000000000000000000000000" "00000001955e1a13d1111b067acbce3e3bcdf38200154d12010000009edfa7a74c1c83c18e47935e" - "8354846e34f0386a00000000000000000000000000000001ac26c7d41fd050bf8d85055bcfe3756c" - "a2f56808092069affaa100fdfdd68d34be184524a6bdc8789cf85178000000000000000000000000" + "8354846e346e386a00000000000000000000000000000001ac26c7d41fd050bf8d85055bcfe3756c" + "a2f56808092069affaa100fdfdd68d34be184524a6bdc8789c575178000000000000000000000000" "00000000020ffdb0e612098610e52bb2a16a40086f0e9e6903000000ec2e2924348352d715cf9d41" - "1ea012e5307294b600000000000000000000000000000000ccd2f50c30706cae3fdcc2f0ee3d5e26" - "81ae55f0030000000aa20624fbab244735d67c61283031667b2d74a1000000000000000000000000" + "1ea012e5305a94b600000000000000000000000000000000ccd2f50c30706cae3fdcc2f0ee3d5e26" + "81ae55f0030000000aa20624fbab244735d67c61283031667b2274a1000000000000000000000000" "0000000000459582f4ef43c780908872746e39efaefd545b020000007ced4f8b362956cd46646a0e" - "222160e5f769bb2900000000000000000000000000000000a19da86c64fefab2548759d313a5b92d" - "f05d7308020000009d82c856ba942455050f63f8282f3464443cacf5000000000000000000000000" + "222160e5f749bb2900000000000000000000000000000000a19da86c64fefab2548759d313a5b92d" + "f05d7308020000009d82c856ba942455050f63f8282f34644466acf5000000000000000000000000" "0000000069d9942f460bcea75481f25e307d0de96e91b91501000000be5b534e0a6527f67485ab35" - "aca0c7ee4197338500000000000000000000000000000000aefd4503189f7630248e501c9052c22b" - "5d68265d010000009b7a559be3acf4fc36fa6b513cf09e8b99289462000000000000000000000000" + "aca0c7ee4167338500000000000000000000000000000000aefd4503189f7630248e501c9052c22b" + "5d68265d010000009b7a559be3acf4fc36fa6b513cf09e8b99729462000000000000000000000000" "00000000b49185ad9b7d0070a36dd51323b2c542e5fe7d360100000066a3ae3939762df33a2d5506" - "0c78d551cbb110fd000000000000000000000000000000002c171ed15abbbe1cd911db7b56e8f3fe" - "9a6ce5d900000000a6a5ee19d6f63fe9cbdd01f7246f13b2050424a2000000000000000000000000" + "0c78d551cb7410fd000000000000000000000000000000002c171ed15abbbe1cd911db7b56e8f3fe" + "9a6ce5d900000000a6a5ee19d6f63fe9cbdd01f7246f13b2055624a2000000000000000000000000" "00000000ffe9d6812231bb02f922259b173c333cbae87d60000000005d31e5b2de252167c1c91b3a" - "36ba0c700ee78477000000000000000000000000000000006ad0143a0554efb46b382ab0404cdf02" - "7c52a52d030000004e8e8bc17c01ac63eca0c1cfbb204132fb7213e4000000000000000000000000" + "36ba0c700e538477000000000000000000000000000000006ad0143a0554efb46b382ab0404cdf02" + "7c52a52d030000004e8e8bc17c01ac63eca0c1cfbb204132fb0813e4000000000000000000000000" "00000000accae11f8045a80f855ebf3b772eb2b1d03bc90503000000eb760e3f004a2efc8ffc96b8" - "9b1bc8f415bd4e7700000000000000000000000000000000d149f074a378b881153ece68ade15cec" - "7666c05303000000ffa8e89871fb9510b900b2061d0c334b819f2dd1000000000000000000000000" + "9b1bc8f415174e7700000000000000000000000000000000d149f074a378b881153ece68ade15cec" + "7666c05303000000ffa8e89871fb9510b900b2061d0c334b816a2dd1000000000000000000000000" "00000000095a3230fde69eec3af2e6d0bd68ab7210613fc90200000016a31dc2e46a234558817151" - "b38fc9c909cf8d7100000000000000000000000000000000ae17bb4515856092b4d9e89b676761b2" - "57d6249b020000007dc7f17f666969e45c3baf7a119a65ee0b06fa9e000000000000000000000000" + "b38fc9c9093c8d7100000000000000000000000000000000ae17bb4515856092b4d9e89b676761b2" + "57d6249b020000007dc7f17f666969e45c3baf7a119a65ee0b08fa9e000000000000000000000000" "00000000b314f695bd82e9ea8891ed0a3d1b91cab56e03e0010000002f70249eefc67bce716c856e" "3973dc42a1003be9000000000000000000000000000000006176f78a19bb8df1804c122fce5078c1" - "eecc89f601000000d635edea8ffe423d01883918039249f398f9b37e000000000000000000000000" + "eecc89f601000000d635edea8ffe423d01883918039249f3984ab37e000000000000000000000000" "000000001fb7c8307f06b4b29088f20d9ac676d5f90e54b501000000a779f37c30d2c5053c40ecae" - "210aeb0934cb2a2400000000000000000000000000000000df48f333ef467092818aa77d6732b678" - "bcd7be0700000000e45aaf61814f703b40125e6baf4648cbaaa37b86000000000000000000000000" + "210aeb0934392a2400000000000000000000000000000000df48f333ef467092818aa77d6732b678" + "bcd7be0700000000e45aaf61814f703b40125e6baf4648cbaa557b86000000000000000000000000" "000000005ddb05f2a84e27c18a06e2c9cb29efdf50da49bf00000000d94beb259f9f0251becc9879" - "07879cca68fec7bb000000000000000000000000000000009402a4c2167721673f2b02b3256ead1f" - "a349e1cc00000000b879a45176740744fcb6a035339d504c9726d80d000000000000000000000000" + "07879cca6857c7bb000000000000000000000000000000009402a4c2167721673f2b02b3256ead1f" + "a349e1cc00000000b879a45176740744fcb6a035339d504c972bd80d000000000000000000000000" "000000009518862bc9a89192c1c8be55281a59d1ebfdcec30000000067a982be8a934f852cc3d4d8" - "2bc0ec7303f99f8f00000000000000000000000000000000901f55f960c55c22f32099a8020bea2a" - "5b1aea3401000000c7c3523f76cf1ce34ca17a9a32f3f0f218424e48000000000000000000000000" + "2bc0ec7303579f8f00000000000000000000000000000000901f55f960c55c22f32099a8020bea2a" + "5b1aea3401000000c7c3523f76cf1ce34ca17a9a32f3f0f2187c4e48000000000000000000000000" "00000002e6fbf952902383028e3b47f2111d891d536c75bb01000000720da9e07ac998b5690807d5" - "2617369ee1af4ca500000000000000000000ffff47d7b351a36b178aabc78a4a0d80684ee5dbf45b" - "17a4763102000000f9119c40b468b66331bca67a034f43340d01683c00000000000000000000ffff" + "2617369ee16d4ca500000000000000000000ffff47d7b351a36b178aabc78a4a0d80684ee5dbf45b" + "17a4763102000000f9119c40b468b66331bca67a034f43340d2c683c00000000000000000000ffff" "b24a5be9b10123e6e4f15ecd1dff045298cfee069c88b02a0300000004b0595daf37deb499996bfb" - "667f072dec1e5d9cdc8a11f4409bcfb3c167090e99d90a8543961b2ccd47724a3c460ba85183f4c5" - "a7afe28302000000d05ff720b16c73761a3fcb675219061ab4c5c79489b2cc6a883c146972decb8b" + "667f072dec755d9cdc8a11f4409bcfb3c167090e99d90a8543961b2ccd47724a3c460ba85183f4c5" + "a7afe28302000000d05ff720b16c73761a3fcb675219061ab466c79489b2cc6a883c146972decb8b" "5adac8f5e6d66df46ea139107754dee62c36d2fcc7a4c65601000000cd625009a40aeb62a42b6a62" - "548e3c38b96c20022753c5fbfaf1809becd2506315a6da29b2e94d3ab51fe0e9af98b180a36035fb" - "e36f90d401000000fd41fe47684b370b6ec6584d64496089570968ead4d1ae91c819bb068196d599" + "548e3c38b96620022753c5fbfaf1809becd2506315a6da29b2e94d3ab51fe0e9af98b180a36035fb" + "e36f90d401000000fd41fe47684b370b6ec6584d64496089574568ead4d1ae91c819bb068196d599" "efde3246e43f5e7945aaf95e2ffa3a11b9ef1b21cdb3455c00000000c66af76e80f062ea1a7e0b7b" - "e218d067530e1b0487b8c3b99f2b8a1a8982c42f53700a3437c5156e072b2f2fb337c9cfe07c34dd" - "c896c9a7000000000a5f6abd850b06e3d9662795ce2cc1cee06302aba042aaa218dc091e9aa1477f" + "e218d067532d1b0487b8c3b99f2b8a1a8982c42f53700a3437c5156e072b2f2fb337c9cfe07c34dd" + "c896c9a7000000000a5f6abd850b06e3d9662795ce2cc1cee03202aba042aaa218dc091e9aa1477f" "6fdc9830d7fbc95829a8838314dff34d24c332214d4647f5000000000f88e3759a08e7a56663861e" - "ea1bf42ccd3c72f2ad063857ca82ac5180101be4f85cef468ea086ea9aaafdc388811ec787bc45db" - "7625ca4a00000000e682f80f94315c45ef817264c89a736ed55ed637b077ddad3108be69f9b97d05" + "ea1bf42ccd1172f2ad063857ca82ac5180101be4f85cef468ea086ea9aaafdc388811ec787bc45db" + "7625ca4a00000000e682f80f94315c45ef817264c89a736ed580d637b077ddad3108be69f9b97d05" "c917ad6b10e693bb6e26f2ba90c8e909e85e20e5b0916e5d030000004a503a712350acbd48411f0d" - "c15d2f0f49dad345599706954d2471f00d3c723b91adb0da7c4aa7e7eb5a15bcde015fb98b841fd8" - "ba8110fb03000000904f288262e6ea77a22fa5f863eaeefa701d120523bd98f29b098b43cd68be6e" + "c15d2f0f4952d345599706954d2471f00d3c723b91adb0da7c4aa7e7eb5a15bcde015fb98b841fd8" + "ba8110fb03000000904f288262e6ea77a22fa5f863eaeefa700b120523bd98f29b098b43cd68be6e" "3f81268193fd637e585287dc6ca972a2cfb18b2b3cae864b0200000091921681c2162b9bfa40546c" - "db544e44df2d7c2790d3119a051bb2ee8192ac0cfa3abc1ea0ab3e7d75a2f42b50c6a36340132378" - "8c3b371502000000710c030690f5f18ea125dbf7d7e93bd65c1fa56dfdcfc1155f236c8b9c79a620" + "db544e44df587c2790d3119a051bb2ee8192ac0cfa3abc1ea0ab3e7d75a2f42b50c6a36340132378" + "8c3b371502000000710c030690f5f18ea125dbf7d7e93bd65c03a56dfdcfc1155f236c8b9c79a620" "5f660bbf024b03ff0a8e27c405e6424457393c6fdac12ebd01000000667224dae775e5ccd141aca2" - "ff0f576767d3648102b61886b62f22ca33478e1f891715df7fc6a902edae579e2e10c7f7a22ba034" - "abf85f0c0100000008d33a2ea67776d7f88d69c8c7e3b2d3c93ef054e93f8120abb42316c533d9c9" + "ff0f57676754648102b61886b62f22ca33478e1f891715df7fc6a902edae579e2e10c7f7a22ba034" + "abf85f0c0100000008d33a2ea67776d7f88d69c8c7e3b2d3c951f054e93f8120abb42316c533d9c9" "4d88189c471a1ff2f0ce3ff66e782110125ae2eddaae7d6300000000c0982b283aa9986700b2a2b3" - "ed257b8b0489f48f053ec8cac72105b327335a25a364d1015ffac03089f45539e1b0178462156cd6" - "6855676c00000000017c9148da5892bb4951c3a7ed55689d3391ce7d3fd48469845f0c233dbdd2a9" + "ed257b8b042ff48f053ec8cac72105b327335a25a364d1015ffac03089f45539e1b0178462156cd6" + "6855676c00000000017c9148da5892bb4951c3a7ed55689d336bce7d3fd48469845f0c233dbdd2a9" "7835df1f1782dee88487fd0db5971b46b7a350f998c39e7c00000000efc57ff447036b9551adcb22" - "fd50793f797a3c7dadd1c86e759d0c90bc512e137dcef5e4a27985bd8d1e69c83dc21056b973972c" - "bc51e540030000006c3d048a92d3adc69a84eb47622400207799416afef0a086fbd7e2f7dea0077a" + "fd50793f791c3c7dadd1c86e759d0c90bc512e137dcef5e4a27985bd8d1e69c83dc21056b973972c" + "bc51e540030000006c3d048a92d3adc69a84eb47622400207708416afef0a086fbd7e2f7dea0077a" "e9c0c0d9c386e9c6e6a2cbfa10ee58bdc75183600422ae3f03000000c43bd794c697895e5bfe47c6" - "f53a54e01b0c1d89fecd94d0e02d2ec587fc330003781b0f294a2b73c4421398f4de67e9cee64b38" - "69121aec010000000fcc00ac2daa755e5292cd32dc096cd5d8a4c5cffe91ee1cfcc2056cc1ff8e51" + "f53a54e01b211d89fecd94d0e02d2ec587fc330003781b0f294a2b73c4421398f4de67e9cee64b38" + "69121aec010000000fcc00ac2daa755e5292cd32dc096cd5d830c5cffe91ee1cfcc2056cc1ff8e51" "bbce426cfa4b861cc78592be7b14e7ba9c15acb836674cde0200000054cfe8f42bf0e9381ba2c439" - "6de60f032bc7f34dfe959871c0d4c0d4eb720c4ae3c9472e5f2da5d9c5cfd9f2343b21362c19a092" - "b2cd3dbd01000000e958e48d2ab8b0313e7f8933e315130fa9a84c82feb83f6e70b1646d8026e9f1" + "6de60f032b5af34dfe959871c0d4c0d4eb720c4ae3c9472e5f2da5d9c5cfd9f2343b21362c19a092" + "b2cd3dbd01000000e958e48d2ab8b0313e7f8933e315130fa9274c82feb83f6e70b1646d8026e9f1" "704f1b16286ba2dabc7ef0820c91ed33ef60a8b5bcfe97e1000000007ad742d3d7320a4f880cf47f" - "5dd0cf69cb22840ffeb3fe7749509cb6752b2cee30b7e7736a0afc9879ea40e69710fc9f6e8e99cd" - "1dce2f83020000003a3efc240b9977e166bee737fe73670c439a644c000000000000000000000000" + "5dd0cf69cb7f840ffeb3fe7749509cb6752b2cee30b7e7736a0afc9879ea40e69710fc9f6e8e99cd" + "1dce2f83020000003a3efc240b9977e166bee737fe73670c436b644c000000000000000000000000" "000000015e0dfe491d1ba96742c7b5e02b227122cf844ef501000000cd743f59bd14c89b5cfd5ce6" - "e82e7854152f2b700000000000000000000000000000000127e19f254ac9588319558041fc62ed56" - "b83579b80300000072437f9b6245de39ec9e71ee4b951507beb42b34000000000000000000000000" + "e82e7854157b2b700000000000000000000000000000000127e19f254ac9588319558041fc62ed56" + "b83579b80300000072437f9b6245de39ec9e71ee4b951507be0a2b34000000000000000000000000" "00000001d639272e4a46eadfbd2146bf8cfdb205b3980deb020000006c1de913df1424ce3ee1d76f" - "c1ea76e98c9dfc7800000000000000000000000000000001e44ea74b4f2b83f9b3bee14d861a4c9e" - "0436242c03000000ee3fbc164632d4f28aa28c08f80dd50c6712dfb4000000000000000000000000" + "c1ea76e98c16fc7800000000000000000000000000000001e44ea74b4f2b83f9b3bee14d861a4c9e" + "0436242c03000000ee3fbc164632d4f28aa28c08f80dd50c6705dfb4000000000000000000000000" "00000000078a806d329c9b008bbfc9723107f3f52af145480300000004265f6c72923e22594f3f79" - "e208ed2e2ebb07710000000000000000000000000000000039dd8f88152a58454d9ca9d20f45dfa7" - "922b6cb8030000001d5c302df59dd32a677e5a3af4fe297f608df061000000000000000000000000" + "e208ed2e2e7107710000000000000000000000000000000039dd8f88152a58454d9ca9d20f45dfa7" + "922b6cb8030000001d5c302df59dd32a677e5a3af4fe297f6042f061000000000000000000000000" "000000008ae21e371051852c972ea7954079884a9a1b163a030000000e2f4f911a0dd8c052ed6b13" - "e2815a1a37a52bdd00000000000000000000000000000000bd99fcf72909ac9e7a55299e9bb4fd53" - "9f3c2c8803000000f51f44e644d7cf1d06b2b115d882549e62c12fba000000000000000000000000" + "e2815a1a37322bdd00000000000000000000000000000000bd99fcf72909ac9e7a55299e9bb4fd53" + "9f3c2c8803000000f51f44e644d7cf1d06b2b115d882549e62042fba000000000000000000000000" "000000004fc812bd2f8a59d96d064126666befbbf257b044030000006a4c619f9037d7a754655354" - "c47cf0f551e967700000000000000000000000000000000050b8d10ab700cc3a7cf51be0403b654b" - "74e7860402000000cd7db68b9ae586dacdb4070c50320427c4dd3d03000000000000000000000000" + "c47cf0f5512167700000000000000000000000000000000050b8d10ab700cc3a7cf51be0403b654b" + "74e7860402000000cd7db68b9ae586dacdb4070c50320427c4803d03000000000000000000000000" "00000000d538d34574c038404923e75d0e09e2fcfc1519de010000002545666937c22a3b6e9686dc" - "c405cbee5016c252000000000000000000000000000000006e4c699341b95f41d9c1e67743efb54e" - "6aae660b01000000fc1fb23d24438387def0f4c6544e4b275d9b7146000000000000000000000000" + "c405cbee504dc252000000000000000000000000000000006e4c699341b95f41d9c1e67743efb54e" + "6aae660b01000000fc1fb23d24438387def0f4c6544e4b275d4a7146000000000000000000000000" "00000000b883efebc09dd9d61966b7ae7412041dd7ac5f9901000000822a272bec4501a1e27acfee" - "7a8588ffd5a06cae0000000000000000000000000000000077a47579dda0b6ead1e1b34901eaedd5" - "61c2f5d200000000b809d259e499db7dc8f1853bdcb0e4bc0e2b00b6000000000000000000000000" + "7a8588ffd5286cae0000000000000000000000000000000077a47579dda0b6ead1e1b34901eaedd5" + "61c2f5d200000000b809d259e499db7dc8f1853bdcb0e4bc0e0e00b6000000000000000000000000" "000000005e7fa0f02f2f3313d8469d09a92409c0b4d54acb00000000a417f3da01d99dae5f190096" - "cc582cabd5ddd15a00000000000000000000000000000000fdb3d117d76b0de5416f95e7bb75d72f" - "fc2b445700000000496ad01bf007eacb0a28aec868282510b60291ea000000000000000000000000" + "cc582cabd534d15a00000000000000000000000000000000fdb3d117d76b0de5416f95e7bb75d72f" + "fc2b445700000000496ad01bf007eacb0a28aec868282510b61b91ea000000000000000000000000" "000000005b29a197b7b3cceaf5f1bb12c535256a74993ade03000000e62112898dab2dade2ab2fc9" - "c56a7c86be5f962200000000000000000000000000000000bdd06352cb2c354434819f4b248eb2b8" - "dc335c8b030000000a3c8e7c91bf821c4b09cee3c37ff4283a631480000000000000000000000000" + "c56a7c86be73962200000000000000000000000000000000bdd06352cb2c354434819f4b248eb2b8" + "dc335c8b030000000a3c8e7c91bf821c4b09cee3c37ff4283a0c1480000000000000000000000000" "000000005588456e4ead7cbda620a3abae816e34e3ff1a5f03000000b4425486c619147eb0216050" - "ed7afd741024e83600000000000000000000000000000000f493472201e48d163106cc397446a33f" - "bc74179403000000438a72e12ae0436a2495a609675344f7e2e3a5eb000000000000000000000000" + "ed7afd74105fe83600000000000000000000000000000000f493472201e48d163106cc397446a33f" + "bc74179403000000438a72e12ae0436a2495a609675344f7e226a5eb000000000000000000000000" "0000000061eda239d9d083c3bf085387046ef8a34153e174020000004d89c0bb5408c1b7d17fb084" - "d9e1825fa638e1af000000000000000000000000000000006e08cb887464b9344ec3127c750fabdd" - "6c0fc09c02000000809829af4a9df58dbfef186d416f3a1ef170d10f000000000000000000000000" + "d9e1825fa613e1af000000000000000000000000000000006e08cb887464b9344ec3127c750fabdd" + "6c0fc09c02000000809829af4a9df58dbfef186d416f3a1ef154d10f000000000000000000000000" "0000000087780281d47a32f2235376239daeaacba9a89f8701000000fcdf6d9be94030b34774d1d7" - "dddedd9899f0f62700000000000000000000000000000000848518c4e3f6cbf25e5e1b990fc46767" - "fd338f35010000006e8cc34573654ea6624f138ef9531cd9367a02e4000000000000000000000000" + "dddedd989972f62700000000000000000000000000000000848518c4e3f6cbf25e5e1b990fc46767" + "fd338f35010000006e8cc34573654ea6624f138ef9531cd9361802e4000000000000000000000000" "00000000da40d88d40a6d75bc404156225b7eede2cb749e2010000000eb4f73e75039fcf251b32fc" - "79685b05ddd3aa9b000000000000000000000000000000000d58fbcc58fc4c2fd0d44ff1e51c3515" - "b7f0318a01000000061db3dd7fde25654a4059d565dbc8a91e3b4457000000000000000000000000" + "79685b05dd3caa9b000000000000000000000000000000000d58fbcc58fc4c2fd0d44ff1e51c3515" + "b7f0318a01000000061db3dd7fde25654a4059d565dbc8a91e004457000000000000000000000000" "00000000c1b5aad487c192f08bd7a09bdd21444359747cf200000000ab2dadc5a39411fd4ff1116d" - "478987316a553fc2000000000000000000000000000000000819e3b10db116431ec6f7691539ce41" - "b95c593100000000dbe9962069e66142e22753344fda8a3e0b841cf7000000000000000000000000" + "478987316a293fc2000000000000000000000000000000000819e3b10db116431ec6f7691539ce41" + "b95c593100000000dbe9962069e66142e22753344fda8a3e0b001cf7000000000000000000000000" "000000008c54dda9ac3bb1b1d43e6505621b9a7f672d2fa501000000e276c5661a64192db44ce7af" - "5eb888e9eb37bb0400000000000000000000000000000002641e447514ca565fb9b68c08a5e4351e" - "9f3c39f201000000de745cb25851429b3bbfb50168dfd04edf6b3542000000000000000000000000" + "5eb888e9eb73bb0400000000000000000000000000000002641e447514ca565fb9b68c08a5e4351e" + "9f3c39f201000000de745cb25851429b3bbfb50168dfd04edf2a3542000000000000000000000000" "0000000218f93e742d08f0550b55726f2292362e70ccc56700000000a4c73cf5ffa4ffc8a4bab148" - "74afdf54e6aae8160000000000000000000000000000000268baf76ab08940f6fc3bbdc7f6090f75" - "4f1b134803000000449a774929e86716ec852d59f3d17232edd86ad6000000000000000000000000" + "74afdf54e64be8160000000000000000000000000000000268baf76ab08940f6fc3bbdc7f6090f75" + "4f1b134803000000449a774929e86716ec852d59f3d17232ed3a6ad6000000000000000000000000" "000000027dba1ee7e143fd52599364e13468f80f40b26f6603000000badfad0fe8fa8f3c1aad2a82" - "530b7447d9c2f401000000000000000000000000000000028147507e1cd59ea1ae6da48b1eba6d16" - "dedea2030100000002a1f8e6f5657f3f9e3eb807cbad76451055edb8000000000000000000000000" + "530b7447d93bf401000000000000000000000000000000028147507e1cd59ea1ae6da48b1eba6d16" + "dedea2030100000002a1f8e6f5657f3f9e3eb807cbad76451013edb8000000000000000000000000" "00000002d9279fb2b8fcbac6abea74f7a6df7979f6989d2d000000006ff7add5df2c93e05459507b" - "5d8c6a0f466554d200000000000000000000ffff1785d3ffdbd9a617857ae8126b028c0e3e295354"), - [2] = ("4cc43c5103000000c2aac1d67a909b297c703915312e9c3c5a06c40b20ea99d5ab90135fa636af44" + "5d8c6a0f465354d200000000000000000000ffff1785d3ffdbd9a617857ae8126b028c0e3e295354"), + [2] = ("4cc43c5103000000c2aac1d67a909b297c703915312e9c3c5a64c40b20ea99d5ab90135fa636af44" "64d210a256be75e0509c4477d19ac64b2e69220d54270e46020000006a894e387625da376feecb80" - "ac245409c0becc271d9c2f67179bff0644399ae79c64ed0432d599eaa660ac824b7fae389861419c" - "12ea3b9501000000fb95e8332fdfff658483a2d039a7bf148ed3481e0bccc460e89f7abdb682380a" + "ac245409c058cc271d9c2f67179bff0644399ae79c64ed0432d599eaa660ac824b7fae389861419c" + "12ea3b9501000000fb95e8332fdfff658483a2d039a7bf148e4c481e0bccc460e89f7abdb682380a" "62eae374835b4a49a2b980b6aba92da6409969aa7a899f2d010000009bf5a5d06776e66a9d80ab13" - "2e1ac921eb76adbb229df32e561fa80a40e55b8b1dd92e18c0cfb2b4386bec092fa5757ecde9348b" - "288cd9bf00000000225a0c71b2ce78bb16104c8eaf18c565ecc8fb112087b97cfcebbaeb0c565359" + "2e1ac921eb04adbb229df32e561fa80a40e55b8b1dd92e18c0cfb2b4386bec092fa5757ecde9348b" + "288cd9bf00000000225a0c71b2ce78bb16104c8eaf18c565ec5ffb112087b97cfcebbaeb0c565359" "23f14874042a8aff1d1f8e5ec3cc13cc36bbe3c9c4e1966800000000b3121cd5ef51e696c816290d" - "baee0e7726d082e1530ff5397c9125f59577d71c4b258a005116d11354edff62ceaa458fc75a91c4" - "25a5927300000000c4458d70911714f1819aa46fbe143934c933ae6dec0fb124f264af67eed7c9a8" + "baee0e77264c82e1530ff5397c9125f59577d71c4b258a005116d11354edff62ceaa458fc75a91c4" + "25a5927300000000c4458d70911714f1819aa46fbe143934c915ae6dec0fb124f264af67eed7c9a8" "c38b6b8ee2614344bea73223e59bf0193432e9fa2fea9bc10300000062fb81e733cff620ca7feefe" - "1933631e8e69f6d9fed62d2c6e6904f57239c09c47150b9b14010469823acb72bb89182f93112196" - "9985d62700000000e491cbbbf9443fd6a77eb3c5bf64b671d6f18dbffeff9b8306c83bc026977911" + "1933631e8e18f6d9fed62d2c6e6904f57239c09c47150b9b14010469823acb72bb89182f93112196" + "9985d62700000000e491cbbbf9443fd6a77eb3c5bf64b671d6098dbffeff9b8306c83bc026977911" "4bdade862c224f6f36506ebd455e679cef369bb8bb0ec36f0000000064a2827b7cdd38d0314c178e" - "925b568ae56bc4e9fefb24e5264fd3ebe9cf9f6df9615189f78ee815b2781ea55c9555876b6a3f13" - "02e9b69000000000eacce745ea213cb1a84035b632ef3be6070dafa2fed87470e9da55709427c226" + "925b568ae566c4e9fefb24e5264fd3ebe9cf9f6df9615189f78ee815b2781ea55c9555876b6a3f13" + "02e9b69000000000eacce745ea213cb1a84035b632ef3be60755afa2fed87470e9da55709427c226" "d324d9a086ed27184b443181a5edc511c1507a14d514573f03000000f6932f6932d1d5f5d0ce2cf6" - "bf7a70ba5193a162fe92ec1b11d9172cf84a03478b82cdd8883b0f3fd6ed84d6c959e553b887edcd" - "6297dfa700000000fd0d53bb6215de4bb6f6f3d031a790287e45e9c1feb836c0a25ea71f5daaed4d" + "bf7a70ba5111a162fe92ec1b11d9172cf84a03478b82cdd8883b0f3fd6ed84d6c959e553b887edcd" + "6297dfa700000000fd0d53bb6215de4bb6f6f3d031a790287e7be9c1feb836c0a25ea71f5daaed4d" "99eb2ebebe3c432fec7d3abc4ccf30d3aaaf02a4ae8cb60b0300000038d856a40c67c3d4afa9c864" - "9da90bd2fff2f25600000000000000000000000000000001955e1a13d1111b067acbce3e3bcdf382" - "00154d12010000009edfa7a74c1c83c18e47935e8354846e34f0386a000000000000000000000000" + "9da90bd2ff4cf25600000000000000000000000000000001955e1a13d1111b067acbce3e3bcdf382" + "00154d12010000009edfa7a74c1c83c18e47935e8354846e346e386a000000000000000000000000" "00000001ac26c7d41fd050bf8d85055bcfe3756c1e0f515601000000f57609453df7803357ae7998" - "9870ccec3def0ad9000000000000000000000000000000019f05a16768cb3bc873b04d937a6ed8f7" - "7c52a52d030000004e8e8bc17c01ac63eca0c1cfbb204132fb7213e4000000000000000000000000" + "9870ccec3d4f0ad9000000000000000000000000000000019f05a16768cb3bc873b04d937a6ed8f7" + "7c52a52d030000004e8e8bc17c01ac63eca0c1cfbb204132fb0813e4000000000000000000000000" "00000000accae11f8045a80f855ebf3b772eb2b1d03bc90503000000eb760e3f004a2efc8ffc96b8" - "9b1bc8f415bd4e7700000000000000000000000000000000d149f074a378b881153ece68ade15cec" - "6f0e9e6903000000ec2e2924348352d715cf9d411ea012e5307294b6000000000000000000000000" + "9b1bc8f415174e7700000000000000000000000000000000d149f074a378b881153ece68ade15cec" + "6f0e9e6903000000ec2e2924348352d715cf9d411ea012e5305a94b6000000000000000000000000" "00000000ccd2f50c30706cae3fdcc2f0ee3d5e267666c05303000000ffa8e89871fb9510b900b206" - "1d0c334b819f2dd100000000000000000000000000000000095a3230fde69eec3af2e6d0bd68ab72" - "81ae55f0030000000aa20624fbab244735d67c61283031667b2d74a1000000000000000000000000" + "1d0c334b816a2dd100000000000000000000000000000000095a3230fde69eec3af2e6d0bd68ab72" + "81ae55f0030000000aa20624fbab244735d67c61283031667b2274a1000000000000000000000000" "0000000000459582f4ef43c780908872746e39ef10613fc90200000016a31dc2e46a234558817151" - "b38fc9c909cf8d7100000000000000000000000000000000ae17bb4515856092b4d9e89b676761b2" - "57d6249b020000007dc7f17f666969e45c3baf7a119a65ee0b06fa9e000000000000000000000000" + "b38fc9c9093c8d7100000000000000000000000000000000ae17bb4515856092b4d9e89b676761b2" + "57d6249b020000007dc7f17f666969e45c3baf7a119a65ee0b08fa9e000000000000000000000000" "00000000b314f695bd82e9ea8891ed0a3d1b91ca6e91b91501000000be5b534e0a6527f67485ab35" - "aca0c7ee4197338500000000000000000000000000000000aefd4503189f7630248e501c9052c22b" - "5d68265d010000009b7a559be3acf4fc36fa6b513cf09e8b99289462000000000000000000000000" + "aca0c7ee4167338500000000000000000000000000000000aefd4503189f7630248e501c9052c22b" + "5d68265d010000009b7a559be3acf4fc36fa6b513cf09e8b99729462000000000000000000000000" "00000000b49185ad9b7d0070a36dd51323b2c542b56e03e0010000002f70249eefc67bce716c856e" "3973dc42a1003be9000000000000000000000000000000006176f78a19bb8df1804c122fce5078c1" - "e5fe7d360100000066a3ae3939762df33a2d55060c78d551cbb110fd000000000000000000000000" + "e5fe7d360100000066a3ae3939762df33a2d55060c78d551cb7410fd000000000000000000000000" "000000002c171ed15abbbe1cd911db7b56e8f3feeecc89f601000000d635edea8ffe423d01883918" - "039249f398f9b37e000000000000000000000000000000001fb7c8307f06b4b29088f20d9ac676d5" - "f90e54b501000000a779f37c30d2c5053c40ecae210aeb0934cb2a24000000000000000000000000" + "039249f3984ab37e000000000000000000000000000000001fb7c8307f06b4b29088f20d9ac676d5" + "f90e54b501000000a779f37c30d2c5053c40ecae210aeb0934392a24000000000000000000000000" "00000000df48f333ef467092818aa77d6732b678bcd7be0700000000e45aaf61814f703b40125e6b" - "af4648cbaaa37b86000000000000000000000000000000005ddb05f2a84e27c18a06e2c9cb29efdf" - "50da49bf00000000d94beb259f9f0251becc987907879cca68fec7bb000000000000000000000000" + "af4648cbaa557b86000000000000000000000000000000005ddb05f2a84e27c18a06e2c9cb29efdf" + "50da49bf00000000d94beb259f9f0251becc987907879cca6857c7bb000000000000000000000000" "000000009402a4c2167721673f2b02b3256ead1fa349e1cc00000000b879a45176740744fcb6a035" - "339d504c9726d80d000000000000000000000000000000009518862bc9a89192c1c8be55281a59d1" - "bae87d60000000005d31e5b2de252167c1c91b3a36ba0c700ee78477000000000000000000000000" + "339d504c972bd80d000000000000000000000000000000009518862bc9a89192c1c8be55281a59d1" + "bae87d60000000005d31e5b2de252167c1c91b3a36ba0c700e538477000000000000000000000000" "000000006ad0143a0554efb46b382ab0404cdf02ebfdcec30000000067a982be8a934f852cc3d4d8" - "2bc0ec7303f99f8f00000000000000000000000000000000901f55f960c55c22f32099a8020bea2a" - "a2f56808092069affaa100fdfdd68d34be184524a6bdc8789cf85178000000000000000000000000" + "2bc0ec7303579f8f00000000000000000000000000000000901f55f960c55c22f32099a8020bea2a" + "a2f56808092069affaa100fdfdd68d34be184524a6bdc8789c575178000000000000000000000000" "00000000020ffdb0e612098610e52bb2a16a4008aefd545b020000007ced4f8b362956cd46646a0e" - "222160e5f769bb2900000000000000000000000000000000a19da86c64fefab2548759d313a5b92d" - "f05d7308020000009d82c856ba942455050f63f8282f3464443cacf5000000000000000000000000" + "222160e5f749bb2900000000000000000000000000000000a19da86c64fefab2548759d313a5b92d" + "f05d7308020000009d82c856ba942455050f63f8282f34644466acf5000000000000000000000000" "0000000069d9942f460bcea75481f25e307d0de99a6ce5d900000000a6a5ee19d6f63fe9cbdd01f7" - "246f13b2050424a200000000000000000000000000000000ffe9d6812231bb02f922259b173c333c" - "5b1aea3401000000c7c3523f76cf1ce34ca17a9a32f3f0f218424e48000000000000000000000000" + "246f13b2055624a200000000000000000000000000000000ffe9d6812231bb02f922259b173c333c" + "5b1aea3401000000c7c3523f76cf1ce34ca17a9a32f3f0f2187c4e48000000000000000000000000" "00000002e6fbf952902383028e3b47f2111d891d17a4763102000000f9119c40b468b66331bca67a" - "034f43340d01683c00000000000000000000ffffb24a5be9b10123e6e4f15ecd1dff045298cfee06" - "536c75bb01000000720da9e07ac998b5690807d52617369ee1af4ca500000000000000000000ffff" + "034f43340d2c683c00000000000000000000ffffb24a5be9b10123e6e4f15ecd1dff045298cfee06" + "536c75bb01000000720da9e07ac998b5690807d52617369ee16d4ca500000000000000000000ffff" "47d7b351a36b178aabc78a4a0d80684ee5dbf45bb0916e5d030000004a503a712350acbd48411f0d" - "c15d2f0f49dad345599706954d2471f00d3c723b91adb0da7c4aa7e7eb5a15bcde015fb98b841fd8" - "ba8110fb03000000904f288262e6ea77a22fa5f863eaeefa701d120523bd98f29b098b43cd68be6e" + "c15d2f0f4952d345599706954d2471f00d3c723b91adb0da7c4aa7e7eb5a15bcde015fb98b841fd8" + "ba8110fb03000000904f288262e6ea77a22fa5f863eaeefa700b120523bd98f29b098b43cd68be6e" "3f81268193fd637e585287dc6ca972a2cfb18b2b3cae864b0200000091921681c2162b9bfa40546c" - "db544e44df2d7c2790d3119a051bb2ee8192ac0cfa3abc1ea0ab3e7d75a2f42b50c6a36340132378" - "8c3b371502000000710c030690f5f18ea125dbf7d7e93bd65c1fa56dfdcfc1155f236c8b9c79a620" + "db544e44df587c2790d3119a051bb2ee8192ac0cfa3abc1ea0ab3e7d75a2f42b50c6a36340132378" + "8c3b371502000000710c030690f5f18ea125dbf7d7e93bd65c03a56dfdcfc1155f236c8b9c79a620" "5f660bbf024b03ff0a8e27c405e6424457393c6fdac12ebd01000000667224dae775e5ccd141aca2" - "ff0f576767d3648102b61886b62f22ca33478e1f891715df7fc6a902edae579e2e10c7f7a22ba034" - "abf85f0c0100000008d33a2ea67776d7f88d69c8c7e3b2d3c93ef054e93f8120abb42316c533d9c9" + "ff0f57676754648102b61886b62f22ca33478e1f891715df7fc6a902edae579e2e10c7f7a22ba034" + "abf85f0c0100000008d33a2ea67776d7f88d69c8c7e3b2d3c951f054e93f8120abb42316c533d9c9" "4d88189c471a1ff2f0ce3ff66e782110125ae2edc7a4c65601000000cd625009a40aeb62a42b6a62" - "548e3c38b96c20022753c5fbfaf1809becd2506315a6da29b2e94d3ab51fe0e9af98b180a36035fb" - "daae7d6300000000c0982b283aa9986700b2a2b3ed257b8b0489f48f053ec8cac72105b327335a25" + "548e3c38b96620022753c5fbfaf1809becd2506315a6da29b2e94d3ab51fe0e9af98b180a36035fb" + "daae7d6300000000c0982b283aa9986700b2a2b3ed257b8b042ff48f053ec8cac72105b327335a25" "a364d1015ffac03089f45539e1b0178462156cd66855676c00000000017c9148da5892bb4951c3a7" - "ed55689d3391ce7d3fd48469845f0c233dbdd2a97835df1f1782dee88487fd0db5971b46b7a350f9" - "cdb3455c00000000c66af76e80f062ea1a7e0b7be218d067530e1b0487b8c3b99f2b8a1a8982c42f" + "ed55689d336bce7d3fd48469845f0c233dbdd2a97835df1f1782dee88487fd0db5971b46b7a350f9" + "cdb3455c00000000c66af76e80f062ea1a7e0b7be218d067532d1b0487b8c3b99f2b8a1a8982c42f" "53700a3437c5156e072b2f2fb337c9cfe07c34ddc896c9a7000000000a5f6abd850b06e3d9662795" - "ce2cc1cee06302aba042aaa218dc091e9aa1477f6fdc9830d7fbc95829a8838314dff34d24c33221" - "98c39e7c00000000efc57ff447036b9551adcb22fd50793f797a3c7dadd1c86e759d0c90bc512e13" + "ce2cc1cee03202aba042aaa218dc091e9aa1477f6fdc9830d7fbc95829a8838314dff34d24c33221" + "98c39e7c00000000efc57ff447036b9551adcb22fd50793f791c3c7dadd1c86e759d0c90bc512e13" "7dcef5e4a27985bd8d1e69c83dc21056b973972c7625ca4a00000000e682f80f94315c45ef817264" - "c89a736ed55ed637b077ddad3108be69f9b97d05c917ad6b10e693bb6e26f2ba90c8e909e85e20e5" - "9c88b02a0300000004b0595daf37deb499996bfb667f072dec1e5d9cdc8a11f4409bcfb3c167090e" + "c89a736ed580d637b077ddad3108be69f9b97d05c917ad6b10e693bb6e26f2ba90c8e909e85e20e5" + "9c88b02a0300000004b0595daf37deb499996bfb667f072dec755d9cdc8a11f4409bcfb3c167090e" "99d90a8543961b2ccd47724a3c460ba85183f4c5a7afe28302000000d05ff720b16c73761a3fcb67" - "5219061ab4c5c79489b2cc6a883c146972decb8b5adac8f5e6d66df46ea139107754dee62c36d2fc" - "e36f90d401000000fd41fe47684b370b6ec6584d64496089570968ead4d1ae91c819bb068196d599" + "5219061ab466c79489b2cc6a883c146972decb8b5adac8f5e6d66df46ea139107754dee62c36d2fc" + "e36f90d401000000fd41fe47684b370b6ec6584d64496089574568ead4d1ae91c819bb068196d599" "efde3246e43f5e7945aaf95e2ffa3a11b9ef1b214d4647f5000000000f88e3759a08e7a56663861e" - "ea1bf42ccd3c72f2ad063857ca82ac5180101be4f85cef468ea086ea9aaafdc388811ec787bc45db" - "0422ae3f03000000c43bd794c697895e5bfe47c6f53a54e01b0c1d89fecd94d0e02d2ec587fc3300" + "ea1bf42ccd1172f2ad063857ca82ac5180101be4f85cef468ea086ea9aaafdc388811ec787bc45db" + "0422ae3f03000000c43bd794c697895e5bfe47c6f53a54e01b211d89fecd94d0e02d2ec587fc3300" "03781b0f294a2b73c4421398f4de67e9cee64b38bc51e540030000006c3d048a92d3adc69a84eb47" - "622400207799416afef0a086fbd7e2f7dea0077ae9c0c0d9c386e9c6e6a2cbfa10ee58bdc7518360" - "36674cde0200000054cfe8f42bf0e9381ba2c4396de60f032bc7f34dfe959871c0d4c0d4eb720c4a" + "622400207708416afef0a086fbd7e2f7dea0077ae9c0c0d9c386e9c6e6a2cbfa10ee58bdc7518360" + "36674cde0200000054cfe8f42bf0e9381ba2c4396de60f032b5af34dfe959871c0d4c0d4eb720c4a" "e3c9472e5f2da5d9c5cfd9f2343b21362c19a092b2cd3dbd01000000e958e48d2ab8b0313e7f8933" - "e315130fa9a84c82feb83f6e70b1646d8026e9f1704f1b16286ba2dabc7ef0820c91ed33ef60a8b5" - "bcfe97e1000000007ad742d3d7320a4f880cf47f5dd0cf69cb22840ffeb3fe7749509cb6752b2cee" + "e315130fa9274c82feb83f6e70b1646d8026e9f1704f1b16286ba2dabc7ef0820c91ed33ef60a8b5" + "bcfe97e1000000007ad742d3d7320a4f880cf47f5dd0cf69cb7f840ffeb3fe7749509cb6752b2cee" "30b7e7736a0afc9879ea40e69710fc9f6e8e99cd69121aec010000000fcc00ac2daa755e5292cd32" - "dc096cd5d8a4c5cffe91ee1cfcc2056cc1ff8e51bbce426cfa4b861cc78592be7b14e7ba9c15acb8" - "b83579b80300000072437f9b6245de39ec9e71ee4b951507beb42b34000000000000000000000000" + "dc096cd5d830c5cffe91ee1cfcc2056cc1ff8e51bbce426cfa4b861cc78592be7b14e7ba9c15acb8" + "b83579b80300000072437f9b6245de39ec9e71ee4b951507be0a2b34000000000000000000000000" "00000001d639272e4a46eadfbd2146bf8cfdb205b3980deb020000006c1de913df1424ce3ee1d76f" - "c1ea76e98c9dfc7800000000000000000000000000000001e44ea74b4f2b83f9b3bee14d861a4c9e" - "cf844ef501000000cd743f59bd14c89b5cfd5ce6e82e7854152f2b70000000000000000000000000" + "c1ea76e98c16fc7800000000000000000000000000000001e44ea74b4f2b83f9b3bee14d861a4c9e" + "cf844ef501000000cd743f59bd14c89b5cfd5ce6e82e7854157b2b70000000000000000000000000" "0000000127e19f254ac9588319558041fc62ed561dce2f83020000003a3efc240b9977e166bee737" - "fe73670c439a644c000000000000000000000000000000015e0dfe491d1ba96742c7b5e02b227122" - "2af145480300000004265f6c72923e22594f3f79e208ed2e2ebb0771000000000000000000000000" + "fe73670c436b644c000000000000000000000000000000015e0dfe491d1ba96742c7b5e02b227122" + "2af145480300000004265f6c72923e22594f3f79e208ed2e2e710771000000000000000000000000" "0000000039dd8f88152a58454d9ca9d20f45dfa774993ade03000000e62112898dab2dade2ab2fc9" - "c56a7c86be5f962200000000000000000000000000000000bdd06352cb2c354434819f4b248eb2b8" - "922b6cb8030000001d5c302df59dd32a677e5a3af4fe297f608df061000000000000000000000000" + "c56a7c86be73962200000000000000000000000000000000bdd06352cb2c354434819f4b248eb2b8" + "922b6cb8030000001d5c302df59dd32a677e5a3af4fe297f6042f061000000000000000000000000" "000000008ae21e371051852c972ea7954079884a9f3c2c8803000000f51f44e644d7cf1d06b2b115" - "d882549e62c12fba000000000000000000000000000000004fc812bd2f8a59d96d064126666befbb" - "dc335c8b030000000a3c8e7c91bf821c4b09cee3c37ff4283a631480000000000000000000000000" + "d882549e62042fba000000000000000000000000000000004fc812bd2f8a59d96d064126666befbb" + "dc335c8b030000000a3c8e7c91bf821c4b09cee3c37ff4283a0c1480000000000000000000000000" "000000005588456e4ead7cbda620a3abae816e34e3ff1a5f03000000b4425486c619147eb0216050" - "ed7afd741024e83600000000000000000000000000000000f493472201e48d163106cc397446a33f" - "f257b044030000006a4c619f9037d7a754655354c47cf0f551e96770000000000000000000000000" + "ed7afd74105fe83600000000000000000000000000000000f493472201e48d163106cc397446a33f" + "f257b044030000006a4c619f9037d7a754655354c47cf0f551216770000000000000000000000000" "0000000050b8d10ab700cc3a7cf51be0403b654bbc74179403000000438a72e12ae0436a2495a609" - "675344f7e2e3a5eb0000000000000000000000000000000061eda239d9d083c3bf085387046ef8a3" - "4153e174020000004d89c0bb5408c1b7d17fb084d9e1825fa638e1af000000000000000000000000" + "675344f7e226a5eb0000000000000000000000000000000061eda239d9d083c3bf085387046ef8a3" + "4153e174020000004d89c0bb5408c1b7d17fb084d9e1825fa613e1af000000000000000000000000" "000000006e08cb887464b9344ec3127c750fabdd6c0fc09c02000000809829af4a9df58dbfef186d" - "416f3a1ef170d10f0000000000000000000000000000000087780281d47a32f2235376239daeaacb" - "74e7860402000000cd7db68b9ae586dacdb4070c50320427c4dd3d03000000000000000000000000" + "416f3a1ef154d10f0000000000000000000000000000000087780281d47a32f2235376239daeaacb" + "74e7860402000000cd7db68b9ae586dacdb4070c50320427c4803d03000000000000000000000000" "00000000d538d34574c038404923e75d0e09e2fca9a89f8701000000fcdf6d9be94030b34774d1d7" - "dddedd9899f0f62700000000000000000000000000000000848518c4e3f6cbf25e5e1b990fc46767" - "fd338f35010000006e8cc34573654ea6624f138ef9531cd9367a02e4000000000000000000000000" + "dddedd989972f62700000000000000000000000000000000848518c4e3f6cbf25e5e1b990fc46767" + "fd338f35010000006e8cc34573654ea6624f138ef9531cd9361802e4000000000000000000000000" "00000000da40d88d40a6d75bc404156225b7eede2cb749e2010000000eb4f73e75039fcf251b32fc" - "79685b05ddd3aa9b000000000000000000000000000000000d58fbcc58fc4c2fd0d44ff1e51c3515" - "6aae660b01000000fc1fb23d24438387def0f4c6544e4b275d9b7146000000000000000000000000" + "79685b05dd3caa9b000000000000000000000000000000000d58fbcc58fc4c2fd0d44ff1e51c3515" + "6aae660b01000000fc1fb23d24438387def0f4c6544e4b275d4a7146000000000000000000000000" "00000000b883efebc09dd9d61966b7ae7412041db7f0318a01000000061db3dd7fde25654a4059d5" - "65dbc8a91e3b445700000000000000000000000000000000c1b5aad487c192f08bd7a09bdd214443" - "61c2f5d200000000b809d259e499db7dc8f1853bdcb0e4bc0e2b00b6000000000000000000000000" + "65dbc8a91e00445700000000000000000000000000000000c1b5aad487c192f08bd7a09bdd214443" + "61c2f5d200000000b809d259e499db7dc8f1853bdcb0e4bc0e0e00b6000000000000000000000000" "000000005e7fa0f02f2f3313d8469d09a92409c0b4d54acb00000000a417f3da01d99dae5f190096" - "cc582cabd5ddd15a00000000000000000000000000000000fdb3d117d76b0de5416f95e7bb75d72f" - "59747cf200000000ab2dadc5a39411fd4ff1116d478987316a553fc2000000000000000000000000" + "cc582cabd534d15a00000000000000000000000000000000fdb3d117d76b0de5416f95e7bb75d72f" + "59747cf200000000ab2dadc5a39411fd4ff1116d478987316a293fc2000000000000000000000000" "000000000819e3b10db116431ec6f7691539ce41b95c593100000000dbe9962069e66142e2275334" - "4fda8a3e0b841cf7000000000000000000000000000000008c54dda9ac3bb1b1d43e6505621b9a7f" - "fc2b445700000000496ad01bf007eacb0a28aec868282510b60291ea000000000000000000000000" + "4fda8a3e0b001cf7000000000000000000000000000000008c54dda9ac3bb1b1d43e6505621b9a7f" + "fc2b445700000000496ad01bf007eacb0a28aec868282510b61b91ea000000000000000000000000" "000000005b29a197b7b3cceaf5f1bb12c535256a0436242c03000000ee3fbc164632d4f28aa28c08" - "f80dd50c6712dfb400000000000000000000000000000000078a806d329c9b008bbfc9723107f3f5" - "9a1b163a030000000e2f4f911a0dd8c052ed6b13e2815a1a37a52bdd000000000000000000000000" + "f80dd50c6705dfb400000000000000000000000000000000078a806d329c9b008bbfc9723107f3f5" + "9a1b163a030000000e2f4f911a0dd8c052ed6b13e2815a1a37322bdd000000000000000000000000" "00000000bd99fcf72909ac9e7a55299e9bb4fd53fc1519de010000002545666937c22a3b6e9686dc" - "c405cbee5016c252000000000000000000000000000000006e4c699341b95f41d9c1e67743efb54e" - "d7ac5f9901000000822a272bec4501a1e27acfee7a8588ffd5a06cae000000000000000000000000" + "c405cbee504dc252000000000000000000000000000000006e4c699341b95f41d9c1e67743efb54e" + "d7ac5f9901000000822a272bec4501a1e27acfee7a8588ffd5286cae000000000000000000000000" "0000000077a47579dda0b6ead1e1b34901eaedd54f1b134803000000449a774929e86716ec852d59" - "f3d17232edd86ad6000000000000000000000000000000027dba1ee7e143fd52599364e13468f80f" - "40b26f6603000000badfad0fe8fa8f3c1aad2a82530b7447d9c2f401000000000000000000000000" + "f3d17232ed3a6ad6000000000000000000000000000000027dba1ee7e143fd52599364e13468f80f" + "40b26f6603000000badfad0fe8fa8f3c1aad2a82530b7447d93bf401000000000000000000000000" "000000028147507e1cd59ea1ae6da48b1eba6d16dedea2030100000002a1f8e6f5657f3f9e3eb807" - "cbad76451055edb800000000000000000000000000000002d9279fb2b8fcbac6abea74f7a6df7979" - "672d2fa501000000e276c5661a64192db44ce7af5eb888e9eb37bb04000000000000000000000000" + "cbad76451013edb800000000000000000000000000000002d9279fb2b8fcbac6abea74f7a6df7979" + "672d2fa501000000e276c5661a64192db44ce7af5eb888e9eb73bb04000000000000000000000000" "00000002641e447514ca565fb9b68c08a5e4351e9f3c39f201000000de745cb25851429b3bbfb501" - "68dfd04edf6b35420000000000000000000000000000000218f93e742d08f0550b55726f2292362e" - "70ccc56700000000a4c73cf5ffa4ffc8a4bab14874afdf54e6aae816000000000000000000000000" + "68dfd04edf2a35420000000000000000000000000000000218f93e742d08f0550b55726f2292362e" + "70ccc56700000000a4c73cf5ffa4ffc8a4bab14874afdf54e64be816000000000000000000000000" "0000000268baf76ab08940f6fc3bbdc7f6090f75f6989d2d000000006ff7add5df2c93e05459507b" - "5d8c6a0f466554d200000000000000000000ffff1785d3ffdbd9a617857ae8126b028c0e3e295354"), + "5d8c6a0f465354d200000000000000000000ffff1785d3ffdbd9a617857ae8126b028c0e3e295354"), }; const int TEST_DATA_I = GPOINTER_TO_INT(test_data); const int addr_family = (TEST_DATA_I == 0 ? AF_INET : AF_INET6); @@ -584,8 +584,9 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data) nmtst_stable_rand(710086081, rand_map, sizeof(rand_map[0]) * N_ADDRESSES); for (i = 0; i < N_ADDRESSES; i++) { - NMPlatformIPXAddress *a = (gpointer) (&addresses[i * ELM_SIZE]); - guint64 r = rand_map[i]; + NMPlatformIPXAddress *a = (gpointer) (&addresses[i * ELM_SIZE]); + guint64 r = rand_map[i]; + guint64 r0 = r; struct in6_addr *a6; #define CONSUME_BITS(r, nbits) \ @@ -664,9 +665,10 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data) a->a4.label[0] = '\0'; } } + if (a->ax.plen > 0) + a->ax.plen = (r0 + 209284393u) % ((NM_IS_IPv4(addr_family) ? 32 : 128) + 1); if (addr_family == AF_INET) { if (CONSUME_BITS(r, 2) != 0) { - /* randomly make the label empty or not. */ a->a4.plen = CONSUME_BITS(r, 2); } } From 9ce4a1652357ded586adeb653ac4c94383ad1ca0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 5 Apr 2022 18:25:24 +0200 Subject: [PATCH 23/23] glib-aux: add assertions for valid prefix length --- src/libnm-glib-aux/nm-shared-utils.c | 5 +++-- src/libnm-glib-aux/nm-shared-utils.h | 3 +-- src/libnm-glib-aux/tests/test-shared-general.c | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/libnm-glib-aux/nm-shared-utils.c b/src/libnm-glib-aux/nm-shared-utils.c index 9c7bceb01b..ad99a6b929 100644 --- a/src/libnm-glib-aux/nm-shared-utils.c +++ b/src/libnm-glib-aux/nm-shared-utils.c @@ -6352,9 +6352,10 @@ nm_utils_ip6_address_same_prefix_cmp(const struct in6_addr *addr_a, int nbytes; guint8 va, vb, m; - if (plen >= 128) + if (plen >= 128) { + nm_assert(plen == 128); NM_CMP_DIRECT_MEMCMP(addr_a, addr_b, sizeof(struct in6_addr)); - else { + } else { nbytes = plen / 8; if (nbytes) NM_CMP_DIRECT_MEMCMP(addr_a, addr_b, nbytes); diff --git a/src/libnm-glib-aux/nm-shared-utils.h b/src/libnm-glib-aux/nm-shared-utils.h index 56ab5e0d93..941312bd0e 100644 --- a/src/libnm-glib-aux/nm-shared-utils.h +++ b/src/libnm-glib-aux/nm-shared-utils.h @@ -398,6 +398,7 @@ gboolean nm_utils_get_ipv6_interface_identifier(NMLinkType link_type, static inline in_addr_t _nm_utils_ip4_prefix_to_netmask(guint32 prefix) { + nm_assert(prefix <= 32); return prefix < 32 ? ~htonl(0xFFFFFFFFu >> prefix) : 0xFFFFFFFFu; } @@ -455,8 +456,6 @@ nm_utils_ip_address_same_prefix_cmp(int addr_family, gconstpointer addr_b, guint8 plen) { - nm_assert_addr_family(addr_family); - NM_CMP_SELF(addr_a, addr_b); if (NM_IS_IPv4(addr_family)) { diff --git a/src/libnm-glib-aux/tests/test-shared-general.c b/src/libnm-glib-aux/tests/test-shared-general.c index ecba02e0c2..46689947e1 100644 --- a/src/libnm-glib-aux/tests/test-shared-general.c +++ b/src/libnm-glib-aux/tests/test-shared-general.c @@ -283,9 +283,6 @@ test_nm_utils_ip4_prefix_to_netmask(void) g_assert_cmpint(_nm_utils_ip4_prefix_to_netmask(32), ==, nmtst_inet4_from_string("255.255.255.255")); - g_assert_cmpint(_nm_utils_ip4_prefix_to_netmask(33), - ==, - nmtst_inet4_from_string("255.255.255.255")); } /*****************************************************************************/