From db307e69cbbc0438699d2ac245b173528dec8e31 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 10 Aug 2023 17:29:18 +0200 Subject: [PATCH] l3cfg: return the conflicting MAC address with ACD events When a collision is detected by the Address Conflict Detection mechanism, store the conflicting MAC address in NML3AcdAddrInfo, so that it is available to listeners of NML3Cfg for events of type NM_L3_CONFIG_NOTIFY_TYPE_ACD_EVENT. --- src/core/nm-l3cfg.c | 10 ++++------ src/core/nm-l3cfg.h | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/nm-l3cfg.c b/src/core/nm-l3cfg.c index 3c2d3ec838..f50947f244 100644 --- a/src/core/nm-l3cfg.c +++ b/src/core/nm-l3cfg.c @@ -101,8 +101,6 @@ typedef struct { * timestamp when we start probing. */ guint32 probing_timeout_msec; - NMEtherAddr last_conflict_addr; - NML3AcdDefendType acd_defend_type_desired : 3; NML3AcdDefendType acd_defend_type_current : 3; bool acd_defend_type_is_active : 1; @@ -2663,8 +2661,8 @@ handle_init: nm_assert(acd_data->info.state == NM_L3_ACD_ADDR_STATE_PROBING); nm_assert(acd_data->nacd_probe); - acd_data->nacd_probe = n_acd_probe_free(acd_data->nacd_probe); - acd_data->last_conflict_addr = *sender_addr; + acd_data->nacd_probe = n_acd_probe_free(acd_data->nacd_probe); + acd_data->info.last_conflict_addr = *sender_addr; _l3_acd_data_state_set_full(self, acd_data, NM_L3_ACD_ADDR_STATE_USED, @@ -2719,8 +2717,8 @@ handle_init: nm_ether_addr_to_string_a(sender_addr)); } - acd_data->nacd_probe = n_acd_probe_free(acd_data->nacd_probe); - acd_data->last_conflict_addr = *sender_addr; + acd_data->nacd_probe = n_acd_probe_free(acd_data->nacd_probe); + acd_data->info.last_conflict_addr = *sender_addr; _l3_acd_data_state_set(self, acd_data, NM_L3_ACD_ADDR_STATE_CONFLICT, TRUE); if (!acd_data->acd_data_timeout_source) _l3_acd_data_timeout_schedule(acd_data, ACD_WAIT_TIME_CONFLICT_RESTART_MSEC); diff --git a/src/core/nm-l3cfg.h b/src/core/nm-l3cfg.h index 5ee201e7a2..9b8ec67f02 100644 --- a/src/core/nm-l3cfg.h +++ b/src/core/nm-l3cfg.h @@ -92,6 +92,7 @@ typedef struct { NML3AcdAddrState state; NML3Cfg *l3cfg; const NML3AcdAddrTrackInfo *track_infos; + NMEtherAddr last_conflict_addr; } NML3AcdAddrInfo; static inline const NML3AcdAddrTrackInfo *