mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-16 01:50:29 +01:00
l3cfg: drop NM_L3_CFG_COMMIT_TYPE_ASSUME and assume_config_once
ASSUME is causing more troubles than benefits it provides. This patch is
dropping NM_L3_CFG_COMMIT_TYPE_ASSUME and assume_config_once. NM3LCfg
will commit as if the sys-iface-state is MANAGED.
This patch is part of the effort to remove ASSUME from NetworkManager.
After ASSUME is dropped when starting NetworkManager it will take full
control of the interface, re-configuring it. The interface will be
managed from the start instead of assumed and then managed.
This will solve the situations where an interface is half-up and then a
restart happens. When NetworkManager is back it won't add the missing
addresses (which is what assume does) so the interface will fail during
the activation and will require a full activation.
https://bugzilla.redhat.com/show_bug.cgi?id=2050216
https://bugzilla.redhat.com/show_bug.cgi?id=2077605
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1196
(cherry picked from commit bf5927b978)
This commit is contained in:
parent
ea6625ce97
commit
a494c00901
11 changed files with 36 additions and 139 deletions
|
|
@ -3984,7 +3984,9 @@ _dev_l3_cfg_commit_type_reset(NMDevice *self)
|
|||
commit_type = NM_L3_CFG_COMMIT_TYPE_NONE;
|
||||
goto do_set;
|
||||
case NM_DEVICE_SYS_IFACE_STATE_ASSUME:
|
||||
commit_type = NM_L3_CFG_COMMIT_TYPE_ASSUME;
|
||||
/* TODO: NM_DEVICE_SYS_IFACE_STATE_ASSUME, will be dropped from the code.
|
||||
* Meanwhile, the commit type must be updated. */
|
||||
commit_type = NM_L3_CFG_COMMIT_TYPE_UPDATE;
|
||||
goto do_set;
|
||||
case NM_DEVICE_SYS_IFACE_STATE_MANAGED:
|
||||
commit_type = NM_L3_CFG_COMMIT_TYPE_UPDATE;
|
||||
|
|
|
|||
|
|
@ -1172,13 +1172,6 @@ _l3_config_data_add_obj(NMDedupMultiIndex *multi_idx,
|
|||
modified = TRUE;
|
||||
}
|
||||
|
||||
/* OR assume_config_once flag */
|
||||
if (obj_new->ip_address.a_assume_config_once
|
||||
&& !obj_old->ip_address.a_assume_config_once) {
|
||||
obj_new = nmp_object_stackinit_obj(&obj_new_stackinit, obj_new);
|
||||
obj_new_stackinit.ip_address.a_assume_config_once = TRUE;
|
||||
modified = TRUE;
|
||||
}
|
||||
break;
|
||||
case NMP_OBJECT_TYPE_IP4_ROUTE:
|
||||
case NMP_OBJECT_TYPE_IP6_ROUTE:
|
||||
|
|
@ -1189,13 +1182,6 @@ _l3_config_data_add_obj(NMDedupMultiIndex *multi_idx,
|
|||
modified = TRUE;
|
||||
}
|
||||
|
||||
/* OR assume_config_once flag */
|
||||
if (obj_new->ip_route.r_assume_config_once
|
||||
&& !obj_old->ip_route.r_assume_config_once) {
|
||||
obj_new = nmp_object_stackinit_obj(&obj_new_stackinit, obj_new);
|
||||
obj_new_stackinit.ip_route.r_assume_config_once = TRUE;
|
||||
modified = TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
nm_assert_not_reached();
|
||||
|
|
@ -3056,9 +3042,8 @@ nm_l3_config_data_merge(NML3ConfigData *self,
|
|||
const NMPlatformIPAddress *a_src = NMP_OBJECT_CAST_IP_ADDRESS(obj);
|
||||
NMPlatformIPXAddress a;
|
||||
NML3ConfigMergeHookResult hook_result = {
|
||||
.ip4acd_not_ready = NM_OPTION_BOOL_DEFAULT,
|
||||
.assume_config_once = NM_OPTION_BOOL_DEFAULT,
|
||||
.force_commit = NM_OPTION_BOOL_DEFAULT,
|
||||
.ip4acd_not_ready = NM_OPTION_BOOL_DEFAULT,
|
||||
.force_commit = NM_OPTION_BOOL_DEFAULT,
|
||||
};
|
||||
|
||||
#define _ensure_a() \
|
||||
|
|
@ -3091,12 +3076,6 @@ nm_l3_config_data_merge(NML3ConfigData *self,
|
|||
a.a4.a_acd_not_ready = (!!hook_result.ip4acd_not_ready);
|
||||
}
|
||||
|
||||
if (hook_result.assume_config_once != NM_OPTION_BOOL_DEFAULT
|
||||
&& (!!hook_result.assume_config_once) != a_src->a_assume_config_once) {
|
||||
_ensure_a();
|
||||
a.ax.a_assume_config_once = (!!hook_result.assume_config_once);
|
||||
}
|
||||
|
||||
if (hook_result.force_commit != NM_OPTION_BOOL_DEFAULT
|
||||
&& (!!hook_result.force_commit) != a_src->a_force_commit) {
|
||||
_ensure_a();
|
||||
|
|
@ -3121,9 +3100,8 @@ nm_l3_config_data_merge(NML3ConfigData *self,
|
|||
const NMPlatformIPRoute *r_src = NMP_OBJECT_CAST_IP_ROUTE(obj);
|
||||
NMPlatformIPXRoute r;
|
||||
NML3ConfigMergeHookResult hook_result = {
|
||||
.ip4acd_not_ready = NM_OPTION_BOOL_DEFAULT,
|
||||
.assume_config_once = NM_OPTION_BOOL_DEFAULT,
|
||||
.force_commit = NM_OPTION_BOOL_DEFAULT,
|
||||
.ip4acd_not_ready = NM_OPTION_BOOL_DEFAULT,
|
||||
.force_commit = NM_OPTION_BOOL_DEFAULT,
|
||||
};
|
||||
|
||||
#define _ensure_r() \
|
||||
|
|
@ -3149,12 +3127,6 @@ nm_l3_config_data_merge(NML3ConfigData *self,
|
|||
r.rx.ifindex = self->ifindex;
|
||||
}
|
||||
|
||||
if (hook_result.assume_config_once != NM_OPTION_BOOL_DEFAULT
|
||||
&& (!!hook_result.assume_config_once) != r_src->r_assume_config_once) {
|
||||
_ensure_r();
|
||||
r.rx.r_assume_config_once = (!!hook_result.assume_config_once);
|
||||
}
|
||||
|
||||
if (hook_result.force_commit != NM_OPTION_BOOL_DEFAULT
|
||||
&& (!!hook_result.force_commit) != r_src->r_force_commit) {
|
||||
_ensure_r();
|
||||
|
|
|
|||
|
|
@ -137,7 +137,6 @@ NML3ConfigData *nm_l3_config_data_new_from_platform(NMDedupMultiIndex *mu
|
|||
|
||||
typedef struct {
|
||||
NMOptionBool ip4acd_not_ready;
|
||||
NMOptionBool assume_config_once;
|
||||
NMOptionBool force_commit;
|
||||
} NML3ConfigMergeHookResult;
|
||||
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ _l3cd_config_add(NML3IPv4LL *self)
|
|||
nm_assert_not_reached();
|
||||
|
||||
self->l3cfg_commit_handle = nm_l3cfg_commit_type_register(self->l3cfg,
|
||||
NM_L3_CFG_COMMIT_TYPE_ASSUME,
|
||||
NM_L3_CFG_COMMIT_TYPE_UPDATE,
|
||||
self->l3cfg_commit_handle,
|
||||
"ipv4ll");
|
||||
nm_l3cfg_commit_on_idle_schedule(self->l3cfg, NM_L3_CFG_COMMIT_TYPE_AUTO);
|
||||
|
|
|
|||
|
|
@ -398,10 +398,7 @@ _lladdr_handle_changed(NML3IPv6LL *self)
|
|||
* NML3IPv4LL, where we use NM_L3_CONFIG_MERGE_FLAGS_ONLY_FOR_ACD. The difference
|
||||
* is that for IPv6 we let kernel do DAD, so we need to actually configure the
|
||||
* address. For IPv4, we can run ACD without configuring anything in kernel,
|
||||
* and let the user decide how to proceed.
|
||||
*
|
||||
* Also in this case, we use the most graceful commit-type (NM_L3_CFG_COMMIT_TYPE_ASSUME),
|
||||
* but for that to work, we also need NM_L3CFG_CONFIG_FLAGS_ASSUME_CONFIG_ONCE flag. */
|
||||
* and let the user decide how to proceed. */
|
||||
|
||||
l3cd = nm_l3_ipv6ll_get_l3cd(self);
|
||||
|
||||
|
|
@ -421,7 +418,7 @@ _lladdr_handle_changed(NML3IPv6LL *self)
|
|||
NM_DNS_PRIORITY_DEFAULT_NORMAL,
|
||||
NM_L3_ACD_DEFEND_TYPE_ALWAYS,
|
||||
0,
|
||||
NM_L3CFG_CONFIG_FLAGS_ASSUME_CONFIG_ONCE,
|
||||
NM_L3CFG_CONFIG_FLAGS_NONE,
|
||||
NM_L3_CONFIG_MERGE_FLAGS_NONE))
|
||||
changed = TRUE;
|
||||
} else {
|
||||
|
|
@ -430,7 +427,7 @@ _lladdr_handle_changed(NML3IPv6LL *self)
|
|||
}
|
||||
|
||||
self->l3cfg_commit_handle = nm_l3cfg_commit_type_register(self->l3cfg,
|
||||
l3cd ? NM_L3_CFG_COMMIT_TYPE_ASSUME
|
||||
l3cd ? NM_L3_CFG_COMMIT_TYPE_UPDATE
|
||||
: NM_L3_CFG_COMMIT_TYPE_NONE,
|
||||
self->l3cfg_commit_handle,
|
||||
"ipv6ll");
|
||||
|
|
|
|||
|
|
@ -363,7 +363,6 @@ static NM_UTILS_ENUM2STR_DEFINE(_l3_cfg_commit_type_to_string,
|
|||
NML3CfgCommitType,
|
||||
NM_UTILS_ENUM2STR(NM_L3_CFG_COMMIT_TYPE_AUTO, "auto"),
|
||||
NM_UTILS_ENUM2STR(NM_L3_CFG_COMMIT_TYPE_NONE, "none"),
|
||||
NM_UTILS_ENUM2STR(NM_L3_CFG_COMMIT_TYPE_ASSUME, "assume"),
|
||||
NM_UTILS_ENUM2STR(NM_L3_CFG_COMMIT_TYPE_UPDATE, "update"),
|
||||
NM_UTILS_ENUM2STR(NM_L3_CFG_COMMIT_TYPE_REAPPLY, "reapply"), );
|
||||
|
||||
|
|
@ -768,14 +767,6 @@ _nm_n_acd_data_probe_new(NML3Cfg *self, in_addr_t addr, guint32 timeout_msec, gp
|
|||
} \
|
||||
G_STMT_END
|
||||
|
||||
static gboolean
|
||||
_obj_state_data_get_assume_config_once(const ObjStateData *obj_state)
|
||||
{
|
||||
nm_assert_obj_state(NULL, obj_state);
|
||||
|
||||
return nmp_object_get_assume_config_once(obj_state->obj);
|
||||
}
|
||||
|
||||
static ObjStateData *
|
||||
_obj_state_data_new(const NMPObject *obj, const NMPObject *plobj)
|
||||
{
|
||||
|
|
@ -1054,10 +1045,6 @@ _obj_states_sync_filter(NML3Cfg *self, const NMPObject *obj, NML3CfgCommitType c
|
|||
nm_assert(c_list_is_empty(&obj_state->os_zombie_lst));
|
||||
|
||||
if (!obj_state->os_nm_configured) {
|
||||
if (commit_type == NM_L3_CFG_COMMIT_TYPE_ASSUME
|
||||
&& !_obj_state_data_get_assume_config_once(obj_state))
|
||||
return FALSE;
|
||||
|
||||
obj_state->os_nm_configured = TRUE;
|
||||
|
||||
_LOGD("obj-state: configure-first-time: %s",
|
||||
|
|
@ -3086,7 +3073,6 @@ nm_l3cfg_commit_on_idle_schedule(NML3Cfg *self, NML3CfgCommitType commit_type)
|
|||
nm_assert(NM_IS_L3CFG(self));
|
||||
nm_assert(NM_IN_SET(commit_type,
|
||||
NM_L3_CFG_COMMIT_TYPE_AUTO,
|
||||
NM_L3_CFG_COMMIT_TYPE_ASSUME,
|
||||
NM_L3_CFG_COMMIT_TYPE_UPDATE,
|
||||
NM_L3_CFG_COMMIT_TYPE_REAPPLY));
|
||||
|
||||
|
|
@ -3501,7 +3487,6 @@ out_clear:
|
|||
typedef struct {
|
||||
NML3Cfg *self;
|
||||
gconstpointer tag;
|
||||
bool assume_config_once;
|
||||
bool to_commit;
|
||||
bool force_commit_once;
|
||||
} L3ConfigMergeHookAddObjData;
|
||||
|
|
@ -3521,11 +3506,9 @@ _l3_hook_add_obj_cb(const NML3ConfigData *l3cd,
|
|||
nm_assert(obj);
|
||||
nm_assert(hook_result);
|
||||
nm_assert(hook_result->ip4acd_not_ready == NM_OPTION_BOOL_DEFAULT);
|
||||
nm_assert(hook_result->assume_config_once == NM_OPTION_BOOL_DEFAULT);
|
||||
nm_assert(hook_result->force_commit == NM_OPTION_BOOL_DEFAULT);
|
||||
|
||||
hook_result->assume_config_once = hook_data->assume_config_once;
|
||||
hook_result->force_commit = hook_data->force_commit_once;
|
||||
hook_result->force_commit = hook_data->force_commit_once;
|
||||
|
||||
switch (NMP_OBJECT_GET_TYPE(obj)) {
|
||||
case NMP_OBJECT_TYPE_IP4_ADDRESS:
|
||||
|
|
@ -3681,9 +3664,7 @@ _l3cfg_update_combined_config(NML3Cfg *self,
|
|||
if (NM_FLAGS_HAS(l3cd_data->config_flags, NM_L3CFG_CONFIG_FLAGS_ONLY_FOR_ACD))
|
||||
continue;
|
||||
|
||||
hook_data.tag = l3cd_data->tag_confdata;
|
||||
hook_data.assume_config_once =
|
||||
NM_FLAGS_HAS(l3cd_data->config_flags, NM_L3CFG_CONFIG_FLAGS_ASSUME_CONFIG_ONCE);
|
||||
hook_data.tag = l3cd_data->tag_confdata;
|
||||
hook_data.force_commit_once = l3cd_data->force_commit_once;
|
||||
|
||||
nm_l3_config_data_merge(l3cd,
|
||||
|
|
@ -4210,8 +4191,7 @@ _l3_commit_one(NML3Cfg *self,
|
|||
nm_assert(NM_IN_SET(commit_type,
|
||||
NM_L3_CFG_COMMIT_TYPE_NONE,
|
||||
NM_L3_CFG_COMMIT_TYPE_REAPPLY,
|
||||
NM_L3_CFG_COMMIT_TYPE_UPDATE,
|
||||
NM_L3_CFG_COMMIT_TYPE_ASSUME));
|
||||
NM_L3_CFG_COMMIT_TYPE_UPDATE));
|
||||
nm_assert_addr_family(addr_family);
|
||||
|
||||
_LOGT("committing IPv%c configuration (%s)",
|
||||
|
|
@ -4297,7 +4277,6 @@ _l3_commit(NML3Cfg *self, NML3CfgCommitType commit_type, gboolean is_idle)
|
|||
nm_assert(NM_IN_SET(commit_type,
|
||||
NM_L3_CFG_COMMIT_TYPE_NONE,
|
||||
NM_L3_CFG_COMMIT_TYPE_AUTO,
|
||||
NM_L3_CFG_COMMIT_TYPE_ASSUME,
|
||||
NM_L3_CFG_COMMIT_TYPE_UPDATE,
|
||||
NM_L3_CFG_COMMIT_TYPE_REAPPLY));
|
||||
nm_assert(self->priv.p->commit_reentrant_count == 0);
|
||||
|
|
@ -4421,10 +4400,7 @@ nm_l3cfg_commit_type_register(NML3Cfg *self,
|
|||
char buf[64];
|
||||
|
||||
nm_assert(NM_IS_L3CFG(self));
|
||||
nm_assert(NM_IN_SET(commit_type,
|
||||
NM_L3_CFG_COMMIT_TYPE_NONE,
|
||||
NM_L3_CFG_COMMIT_TYPE_ASSUME,
|
||||
NM_L3_CFG_COMMIT_TYPE_UPDATE));
|
||||
nm_assert(NM_IN_SET(commit_type, NM_L3_CFG_COMMIT_TYPE_NONE, NM_L3_CFG_COMMIT_TYPE_UPDATE));
|
||||
|
||||
/* It would be easy (and maybe convenient) to allow that @existing_handle
|
||||
* can currently be registered on another NML3Cfg instance. But then we couldn't
|
||||
|
|
|
|||
|
|
@ -363,15 +363,6 @@ typedef enum _nm_packed {
|
|||
/* Don't touch the interface. */
|
||||
NM_L3_CFG_COMMIT_TYPE_NONE,
|
||||
|
||||
/* ASSUME means to keep any pre-existing extra routes/addresses, while
|
||||
* also not adding routes/addresses that are not present yet. This is to
|
||||
* gracefully take over after restart, where the existing IP configuration
|
||||
* should not change.
|
||||
*
|
||||
* The flag NM_L3CFG_CONFIG_FLAGS_ASSUME_CONFIG_ONCE can make certain addresses/
|
||||
* routes commitable also during "assume". */
|
||||
NM_L3_CFG_COMMIT_TYPE_ASSUME,
|
||||
|
||||
/* UPDATE means to add new addresses/routes, while also removing addresses/routes
|
||||
* that are no longer present (but were previously configured by NetworkManager).
|
||||
* Routes/addresses that were removed externally won't be re-added, and routes/addresses
|
||||
|
|
|
|||
|
|
@ -382,13 +382,11 @@ test_l3cfg(gconstpointer test_data)
|
|||
nm_l3cfg_commit_type_register(l3cfg0, NM_L3_CFG_COMMIT_TYPE_UPDATE, NULL, "test1");
|
||||
|
||||
if (!nmtst_get_rand_one_case_in(4)) {
|
||||
commit_type_2 =
|
||||
nm_l3cfg_commit_type_register(l3cfg0,
|
||||
nmtst_rand_select(NM_L3_CFG_COMMIT_TYPE_NONE,
|
||||
NM_L3_CFG_COMMIT_TYPE_ASSUME,
|
||||
NM_L3_CFG_COMMIT_TYPE_UPDATE),
|
||||
NULL,
|
||||
"test2");
|
||||
commit_type_2 = nm_l3cfg_commit_type_register(
|
||||
l3cfg0,
|
||||
nmtst_rand_select(NM_L3_CFG_COMMIT_TYPE_NONE, NM_L3_CFG_COMMIT_TYPE_UPDATE),
|
||||
NULL,
|
||||
"test2");
|
||||
} else
|
||||
commit_type_2 = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -6376,7 +6376,6 @@ nm_platform_ip4_address_to_string(const NMPlatformIP4Address *address, char *buf
|
|||
"%s" /* label */
|
||||
" src %s"
|
||||
"%s" /* a_acd_not_ready */
|
||||
"%s" /* a_assume_config_once */
|
||||
"%s" /* a_force_commit */
|
||||
"",
|
||||
s_address,
|
||||
|
|
@ -6396,7 +6395,6 @@ nm_platform_ip4_address_to_string(const NMPlatformIP4Address *address, char *buf
|
|||
str_label,
|
||||
nmp_utils_ip_config_source_to_string(address->addr_source, s_source, sizeof(s_source)),
|
||||
address->a_acd_not_ready ? " ip4acd-not-ready" : "",
|
||||
address->a_assume_config_once ? " assume-config-once" : "",
|
||||
address->a_force_commit ? " force-commit" : "");
|
||||
g_free(str_peer);
|
||||
return buf;
|
||||
|
|
@ -6517,7 +6515,6 @@ nm_platform_ip6_address_to_string(const NMPlatformIP6Address *address, char *buf
|
|||
buf,
|
||||
len,
|
||||
"%s/%d lft %s pref %s%s%s%s%s src %s"
|
||||
"%s" /* a_assume_config_once */
|
||||
"%s" /* a_force_commit */
|
||||
"",
|
||||
s_address,
|
||||
|
|
@ -6529,7 +6526,6 @@ nm_platform_ip6_address_to_string(const NMPlatformIP6Address *address, char *buf
|
|||
str_dev,
|
||||
_to_string_ifa_flags(address->n_ifa_flags, s_flags, sizeof(s_flags)),
|
||||
nmp_utils_ip_config_source_to_string(address->addr_source, s_source, sizeof(s_source)),
|
||||
address->a_assume_config_once ? " assume-config-once" : "",
|
||||
address->a_force_commit ? " force-commit" : "");
|
||||
g_free(str_peer);
|
||||
return buf;
|
||||
|
|
@ -6633,7 +6629,6 @@ nm_platform_ip4_route_to_string(const NMPlatformIP4Route *route, char *buf, gsiz
|
|||
"%s" /* initcwnd */
|
||||
"%s" /* initrwnd */
|
||||
"%s" /* mtu */
|
||||
"%s" /* r_assume_config_once */
|
||||
"%s" /* r_force_commit */
|
||||
"",
|
||||
nm_net_aux_rtnl_rtntype_n2a_maybe_buf(nm_platform_route_type_uncoerce(route->type_coerced),
|
||||
|
|
@ -6692,7 +6687,6 @@ nm_platform_ip4_route_to_string(const NMPlatformIP4Route *route, char *buf, gsiz
|
|||
route->lock_mtu ? "lock " : "",
|
||||
route->mtu)
|
||||
: "",
|
||||
route->r_assume_config_once ? " assume-config-once" : "",
|
||||
route->r_force_commit ? " force-commit" : "");
|
||||
return buf;
|
||||
}
|
||||
|
|
@ -6768,7 +6762,6 @@ nm_platform_ip6_route_to_string(const NMPlatformIP6Route *route, char *buf, gsiz
|
|||
"%s" /* initrwnd */
|
||||
"%s" /* mtu */
|
||||
"%s" /* pref */
|
||||
"%s" /* r_assume_config_once */
|
||||
"%s" /* r_force_commit */
|
||||
"",
|
||||
nm_net_aux_rtnl_rtntype_n2a_maybe_buf(nm_platform_route_type_uncoerce(route->type_coerced),
|
||||
|
|
@ -6831,7 +6824,6 @@ nm_platform_ip6_route_to_string(const NMPlatformIP6Route *route, char *buf, gsiz
|
|||
" pref %s",
|
||||
nm_icmpv6_router_pref_to_string(route->rt_pref, str_pref2, sizeof(str_pref2)))
|
||||
: "",
|
||||
route->r_assume_config_once ? " assume-config-once" : "",
|
||||
route->r_force_commit ? " force-commit" : "");
|
||||
|
||||
return buf;
|
||||
|
|
@ -7987,7 +7979,6 @@ nm_platform_ip4_address_hash_update(const NMPlatformIP4Address *obj, NMHashState
|
|||
NM_HASH_COMBINE_BOOLS(guint8,
|
||||
obj->use_ip4_broadcast_address,
|
||||
obj->a_acd_not_ready,
|
||||
obj->a_assume_config_once,
|
||||
obj->a_force_commit));
|
||||
nm_hash_update_strarr(h, obj->label);
|
||||
}
|
||||
|
|
@ -8036,7 +8027,6 @@ nm_platform_ip4_address_cmp(const NMPlatformIP4Address *a,
|
|||
if (a->use_ip4_broadcast_address)
|
||||
NM_CMP_FIELD(a, b, broadcast_address);
|
||||
NM_CMP_FIELD_UNSAFE(a, b, a_acd_not_ready);
|
||||
NM_CMP_FIELD_UNSAFE(a, b, a_assume_config_once);
|
||||
NM_CMP_FIELD_UNSAFE(a, b, a_force_commit);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -8047,18 +8037,17 @@ nm_platform_ip4_address_cmp(const NMPlatformIP4Address *a,
|
|||
void
|
||||
nm_platform_ip6_address_hash_update(const NMPlatformIP6Address *obj, NMHashState *h)
|
||||
{
|
||||
nm_hash_update_vals(
|
||||
h,
|
||||
obj->ifindex,
|
||||
obj->addr_source,
|
||||
obj->timestamp,
|
||||
obj->lifetime,
|
||||
obj->preferred,
|
||||
obj->n_ifa_flags,
|
||||
obj->plen,
|
||||
obj->address,
|
||||
obj->peer_address,
|
||||
NM_HASH_COMBINE_BOOLS(guint8, obj->a_assume_config_once, obj->a_force_commit));
|
||||
nm_hash_update_vals(h,
|
||||
obj->ifindex,
|
||||
obj->addr_source,
|
||||
obj->timestamp,
|
||||
obj->lifetime,
|
||||
obj->preferred,
|
||||
obj->n_ifa_flags,
|
||||
obj->plen,
|
||||
obj->address,
|
||||
obj->peer_address,
|
||||
NM_HASH_COMBINE_BOOLS(guint8, obj->a_force_commit));
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -8101,7 +8090,6 @@ nm_platform_ip6_address_cmp(const NMPlatformIP6Address *a,
|
|||
NM_CMP_FIELD(a, b, preferred);
|
||||
NM_CMP_FIELD(a, b, n_ifa_flags);
|
||||
NM_CMP_FIELD(a, b, addr_source);
|
||||
NM_CMP_FIELD_UNSAFE(a, b, a_assume_config_once);
|
||||
NM_CMP_FIELD_UNSAFE(a, b, a_force_commit);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -8206,7 +8194,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
|
|||
obj->initrwnd,
|
||||
obj->mtu,
|
||||
obj->r_rtm_flags,
|
||||
NM_HASH_COMBINE_BOOLS(guint16,
|
||||
NM_HASH_COMBINE_BOOLS(guint8,
|
||||
obj->metric_any,
|
||||
obj->table_any,
|
||||
obj->lock_window,
|
||||
|
|
@ -8214,7 +8202,6 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
|
|||
obj->lock_initcwnd,
|
||||
obj->lock_initrwnd,
|
||||
obj->lock_mtu,
|
||||
obj->r_assume_config_once,
|
||||
obj->r_force_commit));
|
||||
break;
|
||||
}
|
||||
|
|
@ -8305,10 +8292,8 @@ nm_platform_ip4_route_cmp(const NMPlatformIP4Route *a,
|
|||
NM_CMP_FIELD(a, b, initcwnd);
|
||||
NM_CMP_FIELD(a, b, initrwnd);
|
||||
NM_CMP_FIELD(a, b, mtu);
|
||||
if (cmp_type == NM_PLATFORM_IP_ROUTE_CMP_TYPE_FULL) {
|
||||
NM_CMP_FIELD_UNSAFE(a, b, r_assume_config_once);
|
||||
if (cmp_type == NM_PLATFORM_IP_ROUTE_CMP_TYPE_FULL)
|
||||
NM_CMP_FIELD_UNSAFE(a, b, r_force_commit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -8401,7 +8386,6 @@ nm_platform_ip6_route_hash_update(const NMPlatformIP6Route *obj,
|
|||
obj->lock_initcwnd,
|
||||
obj->lock_initrwnd,
|
||||
obj->lock_mtu,
|
||||
obj->r_assume_config_once,
|
||||
obj->r_force_commit),
|
||||
obj->window,
|
||||
obj->cwnd,
|
||||
|
|
@ -8485,10 +8469,8 @@ nm_platform_ip6_route_cmp(const NMPlatformIP6Route *a,
|
|||
NM_CMP_DIRECT(_route_pref_normalize(a->rt_pref), _route_pref_normalize(b->rt_pref));
|
||||
else
|
||||
NM_CMP_FIELD(a, b, rt_pref);
|
||||
if (cmp_type == NM_PLATFORM_IP_ROUTE_CMP_TYPE_FULL) {
|
||||
NM_CMP_FIELD_UNSAFE(a, b, r_assume_config_once);
|
||||
if (cmp_type == NM_PLATFORM_IP_ROUTE_CMP_TYPE_FULL)
|
||||
NM_CMP_FIELD_UNSAFE(a, b, r_force_commit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -330,9 +330,7 @@ typedef enum {
|
|||
\
|
||||
/* Meta flags not honored by NMPlatform (netlink code). Instead, they can be
|
||||
* used by the upper layers which use NMPlatformIPRoute to track addresses that
|
||||
* should be configured. */ \
|
||||
/* Whether the address is should be configured once during assume. */ \
|
||||
bool a_assume_config_once : 1; \
|
||||
* should be configured. */ \
|
||||
bool a_force_commit : 1; \
|
||||
\
|
||||
guint8 plen; \
|
||||
|
|
@ -476,12 +474,9 @@ typedef union {
|
|||
* This field overrides "table_coerced" field. If "table_any" is true, then
|
||||
* the "table_coerced" field is ignored (unlike for the metric). */ \
|
||||
bool table_any : 1; \
|
||||
\
|
||||
/* Meta flags not honored by NMPlatform (netlink code). Instead, they can be
|
||||
* used by the upper layers which use NMPlatformIPRoute to track routes that
|
||||
* should be configured. */ \
|
||||
/* Whether the route is should be configured once during assume. */ \
|
||||
bool r_assume_config_once : 1; \
|
||||
* should be configured. */ \
|
||||
/* Whether the route should be committed even if it was removed externally. */ \
|
||||
bool r_force_commit : 1; \
|
||||
\
|
||||
|
|
|
|||
|
|
@ -1097,21 +1097,6 @@ nm_platform_lookup_object_by_addr_family(NMPlatform *platform,
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static inline gboolean
|
||||
nmp_object_get_assume_config_once(const NMPObject *obj)
|
||||
{
|
||||
switch (NMP_OBJECT_GET_TYPE(obj)) {
|
||||
case NMP_OBJECT_TYPE_IP4_ADDRESS:
|
||||
case NMP_OBJECT_TYPE_IP6_ADDRESS:
|
||||
return NMP_OBJECT_CAST_IP_ADDRESS(obj)->a_assume_config_once;
|
||||
case NMP_OBJECT_TYPE_IP4_ROUTE:
|
||||
case NMP_OBJECT_TYPE_IP6_ROUTE:
|
||||
return NMP_OBJECT_CAST_IP_ROUTE(obj)->r_assume_config_once;
|
||||
default:
|
||||
return nm_assert_unreachable_val(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
nmp_object_get_force_commit(const NMPObject *obj)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue