mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 02:57:58 +02:00
device: refactor handling dad6_failed_addrs in queued_ip_config_change()
Whenever we process queued IP changes, we must handle all pending
dad6_failed_addrs. This is, to ensure we don't accumulate more
and more addresses in the list.
Rework the code, by stealing the entire list once at the beginning
dad6_failed_addrs = g_steal_pointer (&priv->dad6_failed_addrs);
and free it at the end:
g_slist_free_full (dad6_failed_addrs, (GDestroyNotify) nmp_object_unref);
This makes it easier to see, that we always process all addresses in
priv->dad6_failed_addrs.
This commit is contained in:
parent
3fcdba1a19
commit
e2c13af805
1 changed files with 7 additions and 8 deletions
|
|
@ -12297,18 +12297,18 @@ queued_ip_config_change (NMDevice *self, int addr_family)
|
|||
if (!IS_IPv4) {
|
||||
NMPlatform *platform;
|
||||
gboolean need_ipv6ll = FALSE;
|
||||
GSList *dad6_failed_addrs, *iter;
|
||||
|
||||
dad6_failed_addrs = g_steal_pointer (&priv->dad6_failed_addrs);
|
||||
|
||||
if ( priv->state < NM_DEVICE_STATE_DEACTIVATING
|
||||
&& (platform = nm_device_get_platform (self))
|
||||
&& nm_platform_link_get (platform, priv->ifindex)) {
|
||||
/* Handle DAD failures */
|
||||
while (priv->dad6_failed_addrs) {
|
||||
nm_auto_nmpobj const NMPObject *obj = NULL;
|
||||
for (iter = dad6_failed_addrs; iter; iter = iter->next) {
|
||||
const NMPObject *obj = iter->data;
|
||||
const NMPlatformIP6Address *addr;
|
||||
|
||||
obj = priv->dad6_failed_addrs->data;
|
||||
priv->dad6_failed_addrs = g_slist_delete_link (priv->dad6_failed_addrs, priv->dad6_failed_addrs);
|
||||
|
||||
if (!nm_ndisc_dad_addr_is_fail_candidate (platform, obj))
|
||||
continue;
|
||||
|
||||
|
|
@ -12334,10 +12334,9 @@ queued_ip_config_change (NMDevice *self, int addr_family)
|
|||
|
||||
if (need_ipv6ll)
|
||||
check_and_add_ipv6ll_addr (self);
|
||||
} else {
|
||||
g_slist_free_full (priv->dad6_failed_addrs, (GDestroyNotify) nmp_object_unref);
|
||||
priv->dad6_failed_addrs = NULL;
|
||||
}
|
||||
|
||||
g_slist_free_full (dad6_failed_addrs, (GDestroyNotify) nmp_object_unref);
|
||||
}
|
||||
|
||||
if (!IS_IPv4) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue