diff options
author | Thomas Haller <thaller@redhat.com> | 2023-02-28 14:29:50 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-03-21 15:58:43 +0100 |
commit | 7fa63c23b44ad415a4418de74c70db0eb832f2c2 (patch) | |
tree | 67ca010398c45c55918b68f69706b372bc7dcd7a | |
parent | 6fadba55606d820d9df5c932331e4b78f8d6c616 (diff) |
platform,l3cfg: remove force-commit flag for addresses/routes
We no longer need this. We now always force-commit routes and addresses.
See the previous commit.
-rw-r--r-- | src/core/devices/nm-device.c | 25 | ||||
-rw-r--r-- | src/core/nm-l3-config-data.c | 29 | ||||
-rw-r--r-- | src/core/nm-l3-config-data.h | 2 | ||||
-rw-r--r-- | src/core/nm-l3cfg.c | 22 | ||||
-rw-r--r-- | src/core/nm-l3cfg.h | 4 | ||||
-rw-r--r-- | src/libnm-platform/nm-platform.c | 36 | ||||
-rw-r--r-- | src/libnm-platform/nmp-object.h | 15 | ||||
-rw-r--r-- | src/libnm-platform/nmp-plobj.h | 1 |
8 files changed, 26 insertions, 108 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index 939a9b2995..c4f0283123 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -3967,9 +3967,7 @@ after_merge_flags: } static gboolean -_dev_l3_register_l3cds_add_config(NMDevice *self, - L3ConfigDataType l3cd_type, - NML3CfgConfigFlags flags) +_dev_l3_register_l3cds_add_config(NMDevice *self, L3ConfigDataType l3cd_type) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); NML3ConfigMergeFlags merge_flags; @@ -3992,7 +3990,7 @@ _dev_l3_register_l3cds_add_config(NMDevice *self, _prop_get_ipvx_dns_priority(self, AF_INET6), acd_defend_type, acd_timeout_msec, - flags, + NM_L3CFG_CONFIG_FLAGS_NONE, merge_flags); } @@ -4000,7 +3998,6 @@ static gboolean _dev_l3_register_l3cds_set_one_full(NMDevice *self, L3ConfigDataType l3cd_type, const NML3ConfigData *l3cd, - NML3CfgConfigFlags flags, NMTernary commit_sync) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); @@ -4024,7 +4021,7 @@ _dev_l3_register_l3cds_set_one_full(NMDevice *self, if (priv->l3cfg) { if (priv->l3cds[l3cd_type].d) { - if (_dev_l3_register_l3cds_add_config(self, l3cd_type, flags)) + if (_dev_l3_register_l3cds_add_config(self, l3cd_type)) changed = TRUE; } @@ -4048,11 +4045,7 @@ _dev_l3_register_l3cds_set_one(NMDevice *self, const NML3ConfigData *l3cd, NMTernary commit_sync) { - return _dev_l3_register_l3cds_set_one_full(self, - l3cd_type, - l3cd, - NM_L3CFG_CONFIG_FLAGS_NONE, - commit_sync); + return _dev_l3_register_l3cds_set_one_full(self, l3cd_type, l3cd, commit_sync); } static void @@ -4107,7 +4100,7 @@ _dev_l3_register_l3cds(NMDevice *self, } if (is_external) continue; - if (_dev_l3_register_l3cds_add_config(self, i, NM_L3CFG_CONFIG_FLAGS_NONE)) + if (_dev_l3_register_l3cds_add_config(self, i)) changed = TRUE; } @@ -10487,7 +10480,6 @@ _dev_ipdhcpx_notify(NMDhcpClient *client, const NMDhcpClientNotifyData *notify_d _dev_l3_register_l3cds_set_one_full(self, L3_CONFIG_DATA_TYPE_DHCP_X(IS_IPv4), notify_data->lease_update.l3cd, - NM_L3CFG_CONFIG_FLAGS_FORCE_ONCE, FALSE); if (notify_data->lease_update.accepted) { @@ -10708,7 +10700,6 @@ _dev_ipdhcpx_start(NMDevice *self, int addr_family) _dev_l3_register_l3cds_set_one_full(self, L3_CONFIG_DATA_TYPE_DHCP_X(IS_IPv4), previous_lease, - NM_L3CFG_CONFIG_FLAGS_FORCE_ONCE, FALSE); } @@ -11641,11 +11632,7 @@ _dev_ipac6_ndisc_config_changed(NMNDisc *ndisc, _dev_ipac6_grace_period_start(self, 0, TRUE); - _dev_l3_register_l3cds_set_one_full(self, - L3_CONFIG_DATA_TYPE_AC_6, - l3cd, - NM_L3CFG_CONFIG_FLAGS_FORCE_ONCE, - FALSE); + _dev_l3_register_l3cds_set_one_full(self, L3_CONFIG_DATA_TYPE_AC_6, l3cd, FALSE); nm_clear_l3cd(&priv->ipac6_data.l3cd); ready = nm_l3cfg_check_ready(priv->l3cfg, diff --git a/src/core/nm-l3-config-data.c b/src/core/nm-l3-config-data.c index 17bb9db87d..4a9dd78bcf 100644 --- a/src/core/nm-l3-config-data.c +++ b/src/core/nm-l3-config-data.c @@ -2604,7 +2604,6 @@ nm_l3_config_data_add_dependent_device_routes(NML3ConfigData *self, int addr_family, guint32 route_table, guint32 route_metric, - gboolean force_commit, const NML3ConfigData *source) { const int IS_IPv4 = NM_IS_IPv4(addr_family); @@ -2649,7 +2648,6 @@ nm_l3_config_data_add_dependent_device_routes(NML3ConfigData *self, self->ifindex, route_table, route_metric, - force_commit, &r_stack.r4); if (r) nm_l3_config_data_add_route(self, addr_family, NULL, r); @@ -2685,13 +2683,12 @@ nm_l3_config_data_add_dependent_device_routes(NML3ConfigData *self, } rx.r6 = (NMPlatformIP6Route){ - .ifindex = self->ifindex, - .rt_source = NM_IP_CONFIG_SOURCE_KERNEL, - .table_coerced = nm_platform_route_table_coerce(route_table), - .metric = route_metric, - .network = *a6, - .plen = plen, - .r_force_commit = force_commit, + .ifindex = self->ifindex, + .rt_source = NM_IP_CONFIG_SOURCE_KERNEL, + .table_coerced = nm_platform_route_table_coerce(route_table), + .metric = route_metric, + .network = *a6, + .plen = plen, }; nm_platform_ip_route_normalize(addr_family, &rx.rx); @@ -3197,7 +3194,6 @@ nm_l3_config_data_merge(NML3ConfigData *self, NMPlatformIPXAddress a; NML3ConfigMergeHookResult hook_result = { .ip4acd_not_ready = NM_OPTION_BOOL_DEFAULT, - .force_commit = NM_OPTION_BOOL_DEFAULT, }; #define _ensure_a() \ @@ -3230,12 +3226,6 @@ nm_l3_config_data_merge(NML3ConfigData *self, a.a4.a_acd_not_ready = (!!hook_result.ip4acd_not_ready); } - if (hook_result.force_commit != NM_OPTION_BOOL_DEFAULT - && (!!hook_result.force_commit) != a_src->a_force_commit) { - _ensure_a(); - a.ax.a_force_commit = (!!hook_result.force_commit); - } - nm_l3_config_data_add_address_full(self, addr_family, a_src == &a.ax ? NULL : obj, @@ -3255,7 +3245,6 @@ nm_l3_config_data_merge(NML3ConfigData *self, NMPlatformIPXRoute r; NML3ConfigMergeHookResult hook_result = { .ip4acd_not_ready = NM_OPTION_BOOL_DEFAULT, - .force_commit = NM_OPTION_BOOL_DEFAULT, }; #define _ensure_r() \ @@ -3281,12 +3270,6 @@ nm_l3_config_data_merge(NML3ConfigData *self, r.rx.ifindex = self->ifindex; } - if (hook_result.force_commit != NM_OPTION_BOOL_DEFAULT - && (!!hook_result.force_commit) != r_src->r_force_commit) { - _ensure_r(); - r.rx.r_force_commit = (!!hook_result.force_commit); - } - if (!NM_FLAGS_HAS(merge_flags, NM_L3_CONFIG_MERGE_FLAGS_CLONE)) { if (r_src->table_any) { _ensure_r(); diff --git a/src/core/nm-l3-config-data.h b/src/core/nm-l3-config-data.h index bfab04d9ce..80abb00d88 100644 --- a/src/core/nm-l3-config-data.h +++ b/src/core/nm-l3-config-data.h @@ -137,7 +137,6 @@ NML3ConfigData *nm_l3_config_data_new_from_platform(NMDedupMultiIndex *mu typedef struct { NMOptionBool ip4acd_not_ready; - NMOptionBool force_commit; } NML3ConfigMergeHookResult; typedef gboolean (*NML3ConfigMergeHookAddObj)(const NML3ConfigData *l3cd, @@ -164,7 +163,6 @@ void nm_l3_config_data_add_dependent_device_routes(NML3ConfigData *self, int addr_family, guint32 route_table, guint32 route_metric, - gboolean force_commit, const NML3ConfigData *source); /*****************************************************************************/ diff --git a/src/core/nm-l3cfg.c b/src/core/nm-l3cfg.c index 78f4f4eae4..2bde7cc3e2 100644 --- a/src/core/nm-l3cfg.c +++ b/src/core/nm-l3cfg.c @@ -206,7 +206,6 @@ typedef struct { guint32 acd_timeout_msec_confdata; NML3AcdDefendType acd_defend_type_confdata : 3; bool dirty_confdata : 1; - gboolean force_commit_once : 1; } L3ConfigData; struct _NML3CfgBlockHandle { @@ -3429,8 +3428,7 @@ nm_l3cfg_add_config(NML3Cfg *self, .acd_timeout_msec_confdata = acd_timeout_msec, .priority_confdata = priority, .pseudo_timestamp_confdata = ++self->priv.p->pseudo_timestamp_counter, - .force_commit_once = NM_FLAGS_HAS(config_flags, NM_L3CFG_CONFIG_FLAGS_FORCE_ONCE), - .dirty_confdata = FALSE, + .dirty_confdata = FALSE, }; changed = TRUE; } else { @@ -3627,7 +3625,6 @@ typedef struct { NML3Cfg *self; gconstpointer tag; bool to_commit; - bool force_commit_once; } L3ConfigMergeHookAddObjData; static gboolean @@ -3645,9 +3642,6 @@ _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->force_commit == NM_OPTION_BOOL_DEFAULT); - - hook_result->force_commit = hook_data->force_commit_once; switch (NMP_OBJECT_GET_TYPE(obj)) { case NMP_OBJECT_TYPE_IP4_ADDRESS: @@ -3803,8 +3797,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.force_commit_once = l3cd_data->force_commit_once; + hook_data.tag = l3cd_data->tag_confdata; nm_l3_config_data_merge(l3cd, l3cd_data->l3cd, @@ -3862,7 +3855,6 @@ _l3cfg_update_combined_config(NML3Cfg *self, IS_IPv4 ? AF_INET : AF_INET6, l3cd_data->default_route_table_x[IS_IPv4], l3cd_data->default_route_metric_x[IS_IPv4], - l3cd_data->force_commit_once, l3cd_data->l3cd); } } @@ -4749,7 +4741,6 @@ _l3_commit(NML3Cfg *self, NML3CfgCommitType commit_type, gboolean is_idle) gboolean is_sticky_update = FALSE; char sbuf_ct[30]; gboolean changed_combined_l3cd; - guint i; g_return_if_fail(NM_IS_L3CFG(self)); nm_assert(NM_IN_SET(commit_type, @@ -4814,15 +4805,6 @@ _l3_commit(NML3Cfg *self, NML3CfgCommitType commit_type, gboolean is_idle) _l3_acd_data_process_changes(self); - if (self->priv.p->l3_config_datas) { - for (i = 0; i < self->priv.p->l3_config_datas->len; i++) { - L3ConfigData *l3_config_data = _l3_config_datas_at(self->priv.p->l3_config_datas, i); - - if (l3_config_data->force_commit_once) - l3_config_data->force_commit_once = FALSE; - } - } - nm_assert(self->priv.p->commit_reentrant_count == 1); self->priv.p->commit_reentrant_count--; diff --git a/src/core/nm-l3cfg.h b/src/core/nm-l3cfg.h index 9d622b4a01..3fae519eb2 100644 --- a/src/core/nm-l3cfg.h +++ b/src/core/nm-l3cfg.h @@ -55,15 +55,11 @@ typedef enum _nm_packed { * "don't change" behavior. At least once. If the address/route * is still not (no longer) configured on the subsequent * commit, it's not getting added again. - * @NM_L3CFG_CONFIG_FLAGS_FORCE_ONCE: if set, objects in the - * NML3ConfigData are committed to platform even if they were - * removed externally. */ typedef enum _nm_packed { NM_L3CFG_CONFIG_FLAGS_NONE = 0, NM_L3CFG_CONFIG_FLAGS_ONLY_FOR_ACD = (1LL << 0), NM_L3CFG_CONFIG_FLAGS_ASSUME_CONFIG_ONCE = (1LL << 1), - NM_L3CFG_CONFIG_FLAGS_FORCE_ONCE = (1LL << 2), } NML3CfgConfigFlags; typedef enum _nm_packed { diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index ba8569943c..b68b45e9c3 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -6963,7 +6963,6 @@ nm_platform_ip4_route_to_string_full(const NMPlatformIP4Route *route, "%s" /* rto_min */ "%s" /* quickack */ "%s" /* mtu */ - "%s" /* r_force_commit */ "", nm_net_aux_rtnl_rtntype_n2a_maybe_buf(nm_platform_route_type_uncoerce(route->type_coerced), str_type), @@ -7030,8 +7029,7 @@ nm_platform_ip4_route_to_string_full(const NMPlatformIP4Route *route, " mtu %s%" G_GUINT32_FORMAT, route->lock_mtu ? "lock " : "", route->mtu) - : "", - route->r_force_commit ? " force-commit" : ""); + : ""); if ((n_nexthops == 1 && route->ifindex > 0) || n_nexthops == 0) { /* A plain single hop route. Nothing extra to remark. */ @@ -7151,7 +7149,6 @@ nm_platform_ip6_route_to_string(const NMPlatformIP6Route *route, char *buf, gsiz "%s" /* quickack */ "%s" /* mtu */ "%s" /* pref */ - "%s" /* r_force_commit */ "", nm_net_aux_rtnl_rtntype_n2a_maybe_buf(nm_platform_route_type_uncoerce(route->type_coerced), str_type), @@ -7218,8 +7215,7 @@ nm_platform_ip6_route_to_string(const NMPlatformIP6Route *route, char *buf, gsiz str_pref, " pref %s", nm_icmpv6_router_pref_to_string(route->rt_pref, str_pref2, sizeof(str_pref2))) - : "", - route->r_force_commit ? " force-commit" : ""); + : ""); return buf; } @@ -8606,8 +8602,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj, obj->lock_initcwnd, obj->lock_initrwnd, obj->lock_mtu, - obj->lock_mss, - obj->r_force_commit)); + obj->lock_mss)); break; } } @@ -8750,8 +8745,6 @@ nm_platform_ip4_route_cmp(const NMPlatformIP4Route *a, NM_CMP_FIELD(a, b, initrwnd); NM_CMP_FIELD(a, b, mtu); NM_CMP_FIELD(a, b, rto_min); - if (cmp_type == NM_PLATFORM_IP_ROUTE_CMP_TYPE_FULL) - NM_CMP_FIELD_UNSAFE(a, b, r_force_commit); break; } return 0; @@ -8851,8 +8844,7 @@ nm_platform_ip6_route_hash_update(const NMPlatformIP6Route *obj, obj->lock_initcwnd, obj->lock_initrwnd, obj->lock_mtu, - obj->lock_mss, - obj->r_force_commit), + obj->lock_mss), obj->window, obj->cwnd, obj->initcwnd, @@ -8942,8 +8934,6 @@ 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_force_commit); break; } return 0; @@ -9265,7 +9255,6 @@ nm_platform_ip4_address_generate_device_route(const NMPlatformIP4Address *addr, int ifindex, guint32 route_table, guint32 route_metric, - gboolean force_commit, NMPlatformIP4Route *dst) { in_addr_t network_4; @@ -9295,15 +9284,14 @@ nm_platform_ip4_address_generate_device_route(const NMPlatformIP4Address *addr, } *dst = (NMPlatformIP4Route){ - .ifindex = ifindex, - .rt_source = NM_IP_CONFIG_SOURCE_KERNEL, - .network = network_4, - .plen = addr->plen, - .pref_src = addr->address, - .table_coerced = nm_platform_route_table_coerce(route_table), - .metric = route_metric, - .scope_inv = nm_platform_route_scope_inv(NM_RT_SCOPE_LINK), - .r_force_commit = force_commit, + .ifindex = ifindex, + .rt_source = NM_IP_CONFIG_SOURCE_KERNEL, + .network = network_4, + .plen = addr->plen, + .pref_src = addr->address, + .table_coerced = nm_platform_route_table_coerce(route_table), + .metric = route_metric, + .scope_inv = nm_platform_route_scope_inv(NM_RT_SCOPE_LINK), }; nm_platform_ip_route_normalize(AF_INET, (NMPlatformIPRoute *) dst); diff --git a/src/libnm-platform/nmp-object.h b/src/libnm-platform/nmp-object.h index 0d5f84b310..408f0318cb 100644 --- a/src/libnm-platform/nmp-object.h +++ b/src/libnm-platform/nmp-object.h @@ -1183,21 +1183,6 @@ nm_platform_lookup_object_by_addr_family(NMPlatform *platform, /*****************************************************************************/ -static inline gboolean -nmp_object_get_force_commit(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_force_commit; - case NMP_OBJECT_TYPE_IP4_ROUTE: - case NMP_OBJECT_TYPE_IP6_ROUTE: - return NMP_OBJECT_CAST_IP_ROUTE(obj)->r_force_commit; - default: - return nm_assert_unreachable_val(FALSE); - } -} - static inline const char * nmp_object_link_get_ifname(const NMPObject *obj) { diff --git a/src/libnm-platform/nmp-plobj.h b/src/libnm-platform/nmp-plobj.h index e149150d29..833167f678 100644 --- a/src/libnm-platform/nmp-plobj.h +++ b/src/libnm-platform/nmp-plobj.h @@ -255,7 +255,6 @@ NMPlatformIP4Route *nm_platform_ip4_address_generate_device_route(const NMPlatfo int ifindex, guint32 route_table, guint32 route_metric, - gboolean force_commit, NMPlatformIP4Route *dst); typedef enum { |