From e909b63a235a76300cd30ff5a01969d8cbbaace9 Mon Sep 17 00:00:00 2001 From: Fernando Fernandez Mancera Date: Fri, 24 Nov 2023 14:46:27 +0100 Subject: [PATCH] SCRATCH: squash with following commit. This commit alone is insufficient. The complexity of the following commit is necessary, to flag who created a ObjStateData ("os_dynamic" and "os_non_dynamic"). Without it, on each commit the object state will be removed again. WAS: ============== l3cfg: track obj-state for single-hop route after ECMP commit Before ECMP commit we don't know if the single-hop route is going to be merged as ECMP multi-hop route. Therefore if the route has a weight bigger than zero, it is going to be tracked only after the ECMP commit. --- src/core/nm-l3cfg.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/nm-l3cfg.c b/src/core/nm-l3cfg.c index 1dc9b766ed..31abee8cac 100644 --- a/src/core/nm-l3cfg.c +++ b/src/core/nm-l3cfg.c @@ -1064,7 +1064,12 @@ _obj_states_update_all(NML3Cfg *self) /* this is a nodev route. We don't track an obj-state for this. */ continue; } - + if (obj_type == NMP_OBJECT_TYPE_IP4_ROUTE + && NMP_OBJECT_CAST_IP4_ROUTE(obj)->weight > 0) { + /* this route weight is bigger than 0, that means we don't know + * which kind of route this will be. It can only be determined during commit. */ + continue; + } obj_state = g_hash_table_lookup(self->priv.p->obj_state_hash, &obj); if (!obj_state) { _obj_states_track_new(self, obj); @@ -1279,6 +1284,11 @@ loop_done: if (singlehop_routes) { for (i = 0; i < singlehop_routes->len; i++) { const NMPObject *obj = singlehop_routes->pdata[i]; + ObjStateData *obj_state; + + obj_state = g_hash_table_lookup(self->priv.p->obj_state_hash, &obj); + if (!obj_state) + _obj_states_track_new(self, obj); if (!_obj_states_sync_filter(self, obj, commit_type)) continue;