diff options
author | Thomas Haller <thaller@redhat.com> | 2018-02-08 13:38:47 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-02-09 17:40:01 +0100 |
commit | f2c4720bcac1cf30babd77eb8b721e4e384fee8b (patch) | |
tree | 877078eaaa9d5099c50279b32311f2a9e4a399da | |
parent | d5a51a1ad2209c47459b6dd3207d343c28ec65ed (diff) | |
download | NetworkManager-f2c4720bcac1cf30babd77eb8b721e4e384fee8b.tar.gz |
platform: clear temporary addresses early during nm_platform_ip6_address_sync()
Temporary addresses (RFC4941) are not handled by NetworkManager directly, but by
kernel. If they are in the @known_addresses list, clear them out early.
They shall be ignored.
-rw-r--r-- | src/platform/nm-platform.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 02986569b9..2bd7e3eb23 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -3159,20 +3159,30 @@ _addr_array_clean_expired (int addr_family, int ifindex, GPtrArray *array, guint } #endif - if (nm_utils_lifetime_get (a->timestamp, a->lifetime, a->preferred, - now, NULL)) { - 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 (NM_FLAGS_HAS (a->n_ifa_flags, IFA_F_SECONDARY)) { + /* temporary addresses are never added explicitly by NetworkManager but + * kernel adds them via mngtempaddr flag. + * + * We drop them from this list. */ + goto clear_and_next; + } + + if (!nm_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); } - any_addrs = TRUE; - continue; + if (!g_hash_table_add (*idx, (gpointer) NMP_OBJECT_UP_CAST (a))) + nm_assert_not_reached (); } + any_addrs = TRUE; + continue; +clear_and_next: nmp_object_unref (g_steal_pointer (&array->pdata[i])); } @@ -3562,6 +3572,10 @@ nm_platform_ip6_address_sync (NMPlatform *self, if (keep_link_local && IN6_IS_ADDR_LINKLOCAL (&address->address)) continue; + /* FIXME: handle temporary addresses better */ + if (NM_FLAGS_HAS (address->n_ifa_flags, IFA_F_SECONDARY)) + continue; + position = array_ip6_address_position (known_addresses, address, now, FALSE); if (position < 0) { nm_platform_ip6_address_delete (self, ifindex, address->address, address->plen); @@ -3581,6 +3595,10 @@ nm_platform_ip6_address_sync (NMPlatform *self, if (IN6_IS_ADDR_LINKLOCAL (&address->address)) continue; + /* FIXME: handle temporary addresses better */ + if (NM_FLAGS_HAS (address->n_ifa_flags, IFA_F_SECONDARY)) + continue; + if ( remove || position != array_ip6_address_position (known_addresses, address, @@ -3611,11 +3629,6 @@ nm_platform_ip6_address_sync (NMPlatform *self, if (!known_address) continue; - if (NM_FLAGS_HAS (known_address->n_ifa_flags, IFA_F_SECONDARY)) { - /* Kernel manages these */ - continue; - } - lifetime = nm_utils_lifetime_get (known_address->timestamp, known_address->lifetime, known_address->preferred, now, &preferred); |