From b3316063862b593dd55970f1a2cfd70a3679b6f1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 17 Jan 2022 16:59:16 +0100 Subject: [PATCH] l3cfg: on n-acd instance-reset clear also ready ACD state The n-acd instance gets reset in various cases, for example when the MAC address changes or during errors. When that happens, we also need to forget all our pending probes, because they would reference to a now-defunct n-acd instance. When the address is currently in state NM_L3_ACD_ADDR_STATE_READY, we possibly have a pending probe. We need to clean that up. Handle it the same as in the other cases. Yes, this means we forget about that the address was ready. But a reset of the n-acd state is a dramatic event. It warrants some drastic start-over. See-also: https://bugzilla.redhat.com/show_bug.cgi?id=2026288 See-also: https://bugzilla.redhat.com/show_bug.cgi?id=2028422 See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1035 Fixes: 9a76b07f7442 ('l3cfg: fix assertion failure') --- src/core/nm-l3cfg.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/core/nm-l3cfg.c b/src/core/nm-l3cfg.c index 78f03bb62e..f36d798d2c 100644 --- a/src/core/nm-l3cfg.c +++ b/src/core/nm-l3cfg.c @@ -2610,32 +2610,30 @@ handle_init: return; case NM_L3_ACD_ADDR_STATE_PROBING: case NM_L3_ACD_ADDR_STATE_DEFENDING: - + case NM_L3_ACD_ADDR_STATE_READY: if (!acd_data->nacd_probe) { /* we failed starting to probe before and have a timer running to * restart. We don't do anything now, but let the timer handle it. * This also implements some rate limiting for us. */ _LOGT_acd(acd_data, - "n-acd instance reset. Ignore event while restarting %s", - (acd_data->info.state == NM_L3_ACD_ADDR_STATE_PROBING) ? "probing" - : "defending"); + "n-acd instance reset. Ignore event while in state %s", + _l3_acd_addr_state_to_string(acd_data->info.state)); return; } _LOGT_acd(acd_data, - "n-acd instance reset. Trigger a restart of the %s", - (acd_data->info.state == NM_L3_ACD_ADDR_STATE_PROBING) ? "probing" - : "defending"); + "n-acd instance reset. Trigger a restart while in state %s", + _l3_acd_addr_state_to_string(acd_data->info.state)); acd_data->nacd_probe = n_acd_probe_free(acd_data->nacd_probe); _l3_acd_data_timeout_schedule(acd_data, 0); return; case NM_L3_ACD_ADDR_STATE_USED: case NM_L3_ACD_ADDR_STATE_CONFLICT: case NM_L3_ACD_ADDR_STATE_EXTERNAL_REMOVED: + /* as we have no probe, we are already handling this (e.g. by having + * a retry timer). Nothing to do. */ nm_assert(!acd_data->nacd_probe); return; - case NM_L3_ACD_ADDR_STATE_READY: - return; } nm_assert_not_reached(); return;