core: do a commit after all addresses complete ACD/DAD

l3cfg has a "temp_not_available" list of objects that couldn't be
added to platform, but can be added once some preconditions become
true (for example, a IPv6 route with a "src" attribute requires a
non-tentative src address to be present).

Retry to commit those objects once all addresses have completed
ACD/DAD.

(cherry picked from commit 9a090fdf7b)
This commit is contained in:
Beniamino Galvani
2022-02-14 09:47:20 +01:00
parent e2ef99f938
commit ce3638cd33
3 changed files with 30 additions and 0 deletions

View File

@@ -3932,6 +3932,9 @@ _dev_l3_cfg_notify_cb(NML3Cfg *l3cfg, const NML3ConfigNotifyData *notify_data, N
AF_INET6,
NM_L3CFG_CHECK_READY_FLAGS_IP6_DAD_READY,
NULL)) {
if (nm_l3cfg_has_temp_not_available_obj(priv->l3cfg, AF_INET6))
_dev_l3_cfg_commit(self, FALSE);
nm_clear_l3cd(&priv->ipac6_data.l3cd);
_dev_ipac6_set_state(self, NM_DEVICE_IP_STATE_READY);
_dev_ip_state_check_async(self, AF_INET6);
@@ -9821,6 +9824,14 @@ _dev_ipmanual_check_ready(NMDevice *self)
_dev_ipmanual_set_state(self, addr_family, NM_DEVICE_IP_STATE_FAILED);
_dev_ip_state_check_async(self, AF_UNSPEC);
} else if (ready) {
if (priv->ipmanual_data.state_x[IS_IPv4] != NM_DEVICE_IP_STATE_READY
&& nm_l3cfg_has_temp_not_available_obj(priv->l3cfg, addr_family)) {
/* Addresses with pending ACD/DAD are a possible cause for the
* presence of temporarily-not-available objects. Once all addresses
* are ready, retry to commit those unavailable objects. */
_dev_l3_cfg_commit(self, FALSE);
}
_dev_ipmanual_set_state(self, addr_family, NM_DEVICE_IP_STATE_READY);
_dev_ip_state_check_async(self, AF_UNSPEC);
}

View File

@@ -2947,6 +2947,23 @@ nm_l3cfg_get_acd_addr_info(NML3Cfg *self, in_addr_t addr)
/*****************************************************************************/
gboolean
nm_l3cfg_has_temp_not_available_obj(NML3Cfg *self, int addr_family)
{
ObjStateData *obj_state;
nm_assert(NM_IS_L3CFG(self));
nm_assert_addr_family(addr_family);
c_list_for_each_entry (obj_state,
&self->priv.p->obj_state_temporary_not_available_lst_head,
os_temporary_not_available_lst) {
if (NMP_OBJECT_GET_ADDR_FAMILY(obj_state->obj) == addr_family)
return TRUE;
}
return FALSE;
}
gboolean
nm_l3cfg_check_ready(NML3Cfg *self,
const NML3ConfigData *l3cd,

View File

@@ -410,6 +410,8 @@ gboolean nm_l3cfg_check_ready(NML3Cfg *self,
NML3CfgCheckReadyFlags flags,
gboolean *acd_used);
gboolean nm_l3cfg_has_temp_not_available_obj(NML3Cfg *self, int addr_family);
/*****************************************************************************/
NML3CfgCommitType nm_l3cfg_commit_type_get(NML3Cfg *self);