diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2023-07-19 18:08:28 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2023-07-26 10:19:09 +0200 |
commit | 1935d351ac8a92e902e1999c16554eb8547f8b87 (patch) | |
tree | 417594b2a9cdf6ac55572d688cd0a1a45a55e193 | |
parent | 92fb17f99e36f37238dfa18d04c160a02734c185 (diff) |
l3cfg: commit routes that previously failedbg/rh2218866
If a route is not in platform, doesn't have force-commit and the
commit type is not "reapply", we still need to apply it if it failed
previously. Otherwise, e.g. a route with a src address that is
temporarily not available is never applied again after the first
failure.
-rw-r--r-- | src/core/nm-l3cfg.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/core/nm-l3cfg.c b/src/core/nm-l3cfg.c index ac11547cd9..1763b3c977 100644 --- a/src/core/nm-l3cfg.c +++ b/src/core/nm-l3cfg.c @@ -168,6 +168,10 @@ typedef struct { /* This flag is only used temporarily to do a bulk update and * clear all the ones that are no longer in used. */ bool os_dirty : 1; + + /* Indicates that we previously failed to configure the object. As such, + * we should try again at the next commit. */ + bool os_failed : 1; } ObjStateData; G_STATIC_ASSERT(G_STRUCT_OFFSET(ObjStateData, obj) == 0); @@ -1129,6 +1133,11 @@ _obj_states_sync_filter(NML3Cfg *self, const NMPObject *obj, NML3CfgCommitType c return TRUE; } + if (obj_state->os_failed) { + /* We previously failed to configure the object, must always try again. */ + return TRUE; + } + if (!obj_state->os_plobj && commit_type != NM_L3_CFG_COMMIT_TYPE_REAPPLY && !nmp_object_get_force_commit(obj)) return FALSE; @@ -4065,7 +4074,8 @@ _failedobj_handle_routes(NML3Cfg *self, int addr_family, GPtrArray *routes_faile nm_assert(NMP_OBJECT_GET_TYPE(o) == NMP_OBJECT_TYPE_IP_ROUTE(NM_IS_IPv4(addr_family))); - obj_state = g_hash_table_lookup(self->priv.p->obj_state_hash, &o); + obj_state = g_hash_table_lookup(self->priv.p->obj_state_hash, &o); + obj_state->os_failed = TRUE; if (!obj_state) { /* Hm? We don't track this object? Very odd, a bug? */ @@ -4545,6 +4555,11 @@ _routes_watch_ip_addrs(NML3Cfg *self, int addr_family, GPtrArray *addresses, GPt for (i = 0; i < routes->len; i++) { const NMPlatformIPRoute *rt = NMP_OBJECT_CAST_IP_ROUTE(routes->pdata[i]); gconstpointer pref_src; + ObjStateData *obj_state; + + obj_state = g_hash_table_lookup(self->priv.p->obj_state_hash, &routes->pdata[i]); + if (obj_state) + obj_state->os_failed = FALSE; nm_assert(NMP_OBJECT_GET_ADDR_FAMILY(routes->pdata[i]) == addr_family); |