device: fix assertion failure caused by DAD array reuse

This commit fixes an assertion failure caused by the `conflicts` array being reused
when both IPv4 and IPv6 duplicate address detection occurs.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1747
Fixes: afa208c862 ('core: return conflicting addresses from nm_l3cfg_check_ready()')
(cherry picked from commit aa84b5f935)
This commit is contained in:
Jan Vaclav 2023-10-02 10:50:51 +02:00 committed by Beniamino Galvani
parent 2449f29e45
commit e4c583e333

View file

@ -10362,7 +10362,6 @@ _dev_ipmanual_check_ready(NMDevice *self)
gboolean has_carrier;
NML3CfgCheckReadyFlags flags;
gboolean ready;
gs_unref_array GArray *conflicts = NULL;
int IS_IPv4;
if (priv->ipmanual_data.state_4 != NM_DEVICE_IP_STATE_PENDING
@ -10396,7 +10395,8 @@ _dev_ipmanual_check_ready(NMDevice *self)
flags |= NM_L3CFG_CHECK_READY_FLAGS_IP6_DAD_READY;
for (IS_IPv4 = 0; IS_IPv4 < 2; IS_IPv4++) {
const int addr_family = IS_IPv4 ? AF_INET : AF_INET6;
const int addr_family = IS_IPv4 ? AF_INET : AF_INET6;
gs_unref_array GArray *conflicts = NULL;
ready = nm_l3cfg_check_ready(priv->l3cfg,
priv->l3cds[L3_CONFIG_DATA_TYPE_MANUALIP].d,