mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 03:20:18 +01:00
l3cfg: also call nm_l3_config_data_merge()'s add-obj-hook for routes
This commit is contained in:
parent
cfebd0e504
commit
075bdefb71
2 changed files with 48 additions and 29 deletions
|
|
@ -2766,6 +2766,10 @@ nm_l3_config_data_merge(NML3ConfigData * self,
|
|||
NMP_OBJECT_TYPE_IP_ROUTE(IS_IPv4)) {
|
||||
const NMPlatformIPRoute *r_src = NMP_OBJECT_CAST_IP_ROUTE(obj);
|
||||
NMPlatformIPXRoute r;
|
||||
NML3ConfigMergeHookResult hook_result = {
|
||||
.ip4acd_not_ready = NM_OPTION_BOOL_DEFAULT,
|
||||
};
|
||||
|
||||
|
||||
#define _ensure_r() \
|
||||
G_STMT_START \
|
||||
|
|
@ -2781,6 +2785,11 @@ nm_l3_config_data_merge(NML3ConfigData * self,
|
|||
} \
|
||||
G_STMT_END
|
||||
|
||||
if (hook_add_obj && !hook_add_obj(src, obj, &hook_result, hook_user_data))
|
||||
continue;
|
||||
|
||||
nm_assert(hook_result.ip4acd_not_ready == NM_OPTION_BOOL_DEFAULT);
|
||||
|
||||
if (!NM_FLAGS_HAS(merge_flags, NM_L3_CONFIG_MERGE_FLAGS_CLONE)) {
|
||||
if (r_src->table_any) {
|
||||
_ensure_r();
|
||||
|
|
|
|||
|
|
@ -2937,41 +2937,51 @@ _l3_hook_add_obj_cb(const NML3ConfigData * l3cd,
|
|||
in_addr_t addr;
|
||||
gboolean acd_bad = FALSE;
|
||||
|
||||
nm_assert(obj);
|
||||
nm_assert(hook_result);
|
||||
nm_assert(hook_result->ip4acd_not_ready == NM_OPTION_BOOL_DEFAULT);
|
||||
|
||||
if (NMP_OBJECT_GET_TYPE(obj) != NMP_OBJECT_TYPE_IP4_ADDRESS)
|
||||
switch (NMP_OBJECT_GET_TYPE(obj)) {
|
||||
case NMP_OBJECT_TYPE_IP4_ADDRESS:
|
||||
|
||||
addr = NMP_OBJECT_CAST_IP4_ADDRESS(obj)->address;
|
||||
|
||||
if (ACD_ADDR_SKIP(addr))
|
||||
goto out_ip4_address;
|
||||
|
||||
acd_data = _l3_acd_data_find(self, addr);
|
||||
|
||||
if (!acd_data) {
|
||||
/* we don't yet track an ACD state for this address. That can only
|
||||
* happened during _l3cfg_update_combined_config() with !to_commit,
|
||||
* where we didn't update the ACD state.
|
||||
*
|
||||
* This means, unless you actually commit, nm_l3cfg_get_combined_l3cd(self, get_commited = FALSE)
|
||||
* won't consider IPv4 addresses ready, that have no known ACD state yet. */
|
||||
nm_assert(self->priv.p->changed_configs_acd_state);
|
||||
acd_bad = TRUE;
|
||||
goto out_ip4_address;
|
||||
}
|
||||
|
||||
nm_assert(_acd_track_data_is_not_dirty(
|
||||
_acd_data_find_track(acd_data, l3cd, obj, hook_data->tag)));
|
||||
if (!NM_IN_SET(acd_data->info.state,
|
||||
NM_L3_ACD_ADDR_STATE_READY,
|
||||
NM_L3_ACD_ADDR_STATE_DEFENDING))
|
||||
acd_bad = TRUE;
|
||||
|
||||
out_ip4_address:
|
||||
hook_result->ip4acd_not_ready = acd_bad ? NM_OPTION_BOOL_TRUE : NM_OPTION_BOOL_FALSE;
|
||||
return TRUE;
|
||||
|
||||
addr = NMP_OBJECT_CAST_IP4_ADDRESS(obj)->address;
|
||||
|
||||
if (ACD_ADDR_SKIP(addr))
|
||||
goto out;
|
||||
|
||||
acd_data = _l3_acd_data_find(self, addr);
|
||||
|
||||
if (!acd_data) {
|
||||
/* we don't yet track an ACD state for this address. That can only
|
||||
* happend during _l3cfg_update_combined_config() with !to_commit,
|
||||
* where we didn't update the ACD state.
|
||||
*
|
||||
* This means, unless you actually commit, nm_l3cfg_get_combined_l3cd(self, get_commited = FALSE)
|
||||
* won't consider IPv4 addresses ready, that have no known ACD state yet. */
|
||||
nm_assert(self->priv.p->changed_configs_acd_state);
|
||||
acd_bad = TRUE;
|
||||
goto out;
|
||||
default:
|
||||
nm_assert_not_reached();
|
||||
/* fall-through */
|
||||
case NMP_OBJECT_TYPE_IP6_ADDRESS:
|
||||
case NMP_OBJECT_TYPE_IP4_ROUTE:
|
||||
case NMP_OBJECT_TYPE_IP6_ROUTE:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
nm_assert(
|
||||
_acd_track_data_is_not_dirty(_acd_data_find_track(acd_data, l3cd, obj, hook_data->tag)));
|
||||
if (!NM_IN_SET(acd_data->info.state,
|
||||
NM_L3_ACD_ADDR_STATE_READY,
|
||||
NM_L3_ACD_ADDR_STATE_DEFENDING))
|
||||
acd_bad = TRUE;
|
||||
|
||||
out:
|
||||
hook_result->ip4acd_not_ready = acd_bad ? NM_OPTION_BOOL_TRUE : NM_OPTION_BOOL_FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue