diff options
author | Thomas Haller <thaller@redhat.com> | 2022-04-02 10:34:17 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2022-04-29 17:26:17 +0200 |
commit | 0f0d7d801b95198dd5f578dad4e719388cfd9147 (patch) | |
tree | 35abe7f5b3623224d5b20d3b694255c74dc083e7 | |
parent | cea335c454fed307903835eb78b2bb715e0ce377 (diff) | |
download | NetworkManager-0f0d7d801b95198dd5f578dad4e719388cfd9147.tar.gz |
platform: move known_subnets variable to inner scope in nm_platform_ip_address_sync()
(cherry picked from commit e1431b43a2e02bdd010474df40ccf4417e8b7d08)
(cherry picked from commit a8e96e3c4b539391833b74432c3200df4e3a8223)
-rw-r--r-- | src/libnm-platform/nm-platform.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index a61c8ae823..06db58ad00 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -3905,7 +3905,6 @@ nm_platform_ip_address_sync(NMPlatform *self, NMPLookup lookup; gs_unref_hashtable GHashTable *known_addresses_idx = NULL; gs_unref_ptrarray GPtrArray *plat_addresses = NULL; - GHashTable *known_subnets = NULL; gboolean success; guint i_plat; guint i_know; @@ -3967,9 +3966,10 @@ nm_platform_ip_address_sync(NMPlatform *self, if (nm_g_ptr_array_len(plat_addresses) > 0) { /* Delete addresses that interfere with our intended order. */ if (IS_IPv4) { + GHashTable *known_subnets = NULL; + GHashTable *plat_subnets; gs_free bool *plat_handled_to_free = NULL; bool *plat_handled = NULL; - GHashTable *plat_subnets; /* For IPv4, we only consider it a conflict for addresses in the same * subnet. That's where kernel will assign a primary/secondary flag. @@ -4065,6 +4065,7 @@ nm_platform_ip_address_sync(NMPlatform *self, } } ip4_addr_subnets_destroy_index(plat_subnets, plat_addresses); + ip4_addr_subnets_destroy_index(known_subnets, known_addresses); } else { guint known_addresses_len; IP6AddrScope cur_scope; @@ -4175,9 +4176,6 @@ next_plat:; if (!known_addresses) return TRUE; - if (IS_IPv4) - ip4_addr_subnets_destroy_index(known_subnets, known_addresses); - success = TRUE; /* Add missing addresses. New addresses are added by kernel with top |