mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 10:38:30 +02:00
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.
This commit is contained in:
parent
d5a51a1ad2
commit
f2c4720bca
1 changed files with 30 additions and 17 deletions
|
|
@ -3159,20 +3159,30 @@ _addr_array_clean_expired (int addr_family, int ifindex, GPtrArray *array, guint
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (nm_utils_lifetime_get (a->timestamp, a->lifetime, a->preferred,
|
if (NM_FLAGS_HAS (a->n_ifa_flags, IFA_F_SECONDARY)) {
|
||||||
now, NULL)) {
|
/* temporary addresses are never added explicitly by NetworkManager but
|
||||||
if (idx) {
|
* kernel adds them via mngtempaddr flag.
|
||||||
if (G_UNLIKELY (!*idx)) {
|
*
|
||||||
*idx = g_hash_table_new ((GHashFunc) nmp_object_id_hash,
|
* We drop them from this list. */
|
||||||
(GEqualFunc) nmp_object_id_equal);
|
goto clear_and_next;
|
||||||
}
|
|
||||||
if (!g_hash_table_add (*idx, (gpointer) NMP_OBJECT_UP_CAST (a)))
|
|
||||||
nm_assert_not_reached ();
|
|
||||||
}
|
|
||||||
any_addrs = TRUE;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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]));
|
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))
|
if (keep_link_local && IN6_IS_ADDR_LINKLOCAL (&address->address))
|
||||||
continue;
|
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);
|
position = array_ip6_address_position (known_addresses, address, now, FALSE);
|
||||||
if (position < 0) {
|
if (position < 0) {
|
||||||
nm_platform_ip6_address_delete (self, ifindex, address->address, address->plen);
|
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))
|
if (IN6_IS_ADDR_LINKLOCAL (&address->address))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* FIXME: handle temporary addresses better */
|
||||||
|
if (NM_FLAGS_HAS (address->n_ifa_flags, IFA_F_SECONDARY))
|
||||||
|
continue;
|
||||||
|
|
||||||
if ( remove
|
if ( remove
|
||||||
|| position != array_ip6_address_position (known_addresses,
|
|| position != array_ip6_address_position (known_addresses,
|
||||||
address,
|
address,
|
||||||
|
|
@ -3611,11 +3629,6 @@ nm_platform_ip6_address_sync (NMPlatform *self,
|
||||||
if (!known_address)
|
if (!known_address)
|
||||||
continue;
|
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,
|
lifetime = nm_utils_lifetime_get (known_address->timestamp, known_address->lifetime, known_address->preferred,
|
||||||
now, &preferred);
|
now, &preferred);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue