summaryrefslogtreecommitdiff
path: root/src/libnm-platform/nm-platform.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-08-06 15:17:05 +0200
committerThomas Haller <thaller@redhat.com>2021-09-30 09:56:19 +0200
commitd64b4a30d21fa98f6a7d11c28ac21a8f9d8ee299 (patch)
treeddb782113363dea1fa8e0a38e2570c269b98ff24 /src/libnm-platform/nm-platform.c
parentf20431bf89fd00c88659275f69419601cf98cb6b (diff)
downloadNetworkManager-next.tar.gz
core: rework IP configuration in NetworkManager using layer 3 configurationnext
Completely rework IP configuration in the daemon. Use NML3Cfg as layer 3 manager for the IP configuration of an interface. Use NML3ConfigData as pieces of configuration that the various components collect and configure. NMDevice is managing most of the IP configuration at a higher level, that is, it starts DHCP and other IP methods. Rework the state handling there. This is a huge rework of how NetworkManager daemon handles IP configuration. Some fallout is to be expected. It appears the patch deletes many lines of code. That is not accurate, because you also have to count the files `src/core/nm-l3*`, which were unused previously. Co-authored-by: Beniamino Galvani <bgalvani@redhat.com>
Diffstat (limited to 'src/libnm-platform/nm-platform.c')
-rw-r--r--src/libnm-platform/nm-platform.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c
index 5d4ec037ec..ee8748c631 100644
--- a/src/libnm-platform/nm-platform.c
+++ b/src/libnm-platform/nm-platform.c
@@ -4520,12 +4520,6 @@ nm_platform_ip_route_sync(NMPlatform *self,
conf_o = routes->pdata[i];
- if (NMP_OBJECT_CAST_IP_ROUTE(conf_o)->is_external) {
- /* This route is added externally. We don't have our own agenda to
- * add it, so skip. */
- continue;
- }
-
/* User space cannot add IPv6 routes with metric 0. However, kernel can, and we might track such
* routes in @route as they are present external. As we already skipped external routes above,
* we don't expect a user's choice to add such a route (it won't work anyway). */
@@ -4721,24 +4715,6 @@ sync_route_add:
}
if (routes_prune) {
- if (routes) {
- for (i = 0; i < routes->len; i++) {
- conf_o = routes->pdata[i];
-
- if (NMP_OBJECT_CAST_IP_ROUTE(conf_o)->is_external) {
- /* this is only to catch the case where an external route is
- * both in @routes and @routes_prune list. In that case,
- * @routes should win and we should not remove the address. */
- if (!routes_idx) {
- routes_idx = g_hash_table_new((GHashFunc) nmp_object_id_hash,
- (GEqualFunc) nmp_object_id_equal);
- }
- g_hash_table_add(routes_idx, (gpointer) conf_o);
- continue;
- }
- }
- }
-
for (i = 0; i < routes_prune->len; i++) {
const NMPObject *prune_o;
@@ -6273,7 +6249,6 @@ nm_platform_ip4_address_to_string(const NMPlatformIP4Address *address, char *buf
"%s" /* flags */
"%s" /* label */
" src %s"
- "%s" /* external */
"%s" /* a_acd_not_ready */
"%s" /* a_assume_config_once */
"",
@@ -6293,7 +6268,6 @@ nm_platform_ip4_address_to_string(const NMPlatformIP4Address *address, char *buf
_to_string_ifa_flags(address->n_ifa_flags, s_flags, sizeof(s_flags)),
str_label,
nmp_utils_ip_config_source_to_string(address->addr_source, s_source, sizeof(s_source)),
- address->external ? " ext" : "",
address->a_acd_not_ready ? " ip4acd-not-ready" : "",
address->a_assume_config_once ? " assume-config-once" : "");
g_free(str_peer);
@@ -6415,7 +6389,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" /* external */
"%s" /* a_assume_config_once */
"",
s_address,
@@ -6427,7 +6400,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->external ? " external" : "",
address->a_assume_config_once ? " assume-config-once" : "");
g_free(str_peer);
return buf;
@@ -6519,7 +6491,6 @@ nm_platform_ip4_route_to_string(const NMPlatformIP4Route *route, char *buf, gsiz
"%s" /* initcwnd */
"%s" /* initrwnd */
"%s" /* mtu */
- "%s" /* is_external */
"%s" /* r_assume_config_once */
"",
nm_net_aux_rtnl_rtntype_n2a_maybe_buf(nm_platform_route_type_uncoerce(route->type_coerced),
@@ -6577,7 +6548,6 @@ nm_platform_ip4_route_to_string(const NMPlatformIP4Route *route, char *buf, gsiz
route->lock_mtu ? "lock " : "",
route->mtu)
: "",
- route->is_external ? " is-external" : "",
route->r_assume_config_once ? " assume-config-once" : "");
return buf;
}
@@ -6648,7 +6618,6 @@ nm_platform_ip6_route_to_string(const NMPlatformIP6Route *route, char *buf, gsiz
"%s" /* initrwnd */
"%s" /* mtu */
"%s" /* pref */
- "%s" /* is_external */
"%s" /* r_assume_config_once */
"",
nm_net_aux_rtnl_rtntype_n2a_maybe_buf(nm_platform_route_type_uncoerce(route->type_coerced),
@@ -6710,7 +6679,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->is_external ? " is-external" : "",
route->r_assume_config_once ? " assume-config-once" : "");
return buf;
@@ -7845,7 +7813,6 @@ nm_platform_ip4_address_hash_update(const NMPlatformIP4Address *obj, NMHashState
obj->address,
obj->peer_address,
NM_HASH_COMBINE_BOOLS(guint8,
- obj->external,
obj->use_ip4_broadcast_address,
obj->a_acd_not_ready,
obj->a_assume_config_once));
@@ -7869,7 +7836,6 @@ nm_platform_ip4_address_cmp(const NMPlatformIP4Address *a, const NMPlatformIP4Ad
NM_CMP_FIELD(a, b, preferred);
NM_CMP_FIELD(a, b, n_ifa_flags);
NM_CMP_FIELD_STR(a, b, label);
- NM_CMP_FIELD_UNSAFE(a, b, external);
NM_CMP_FIELD_UNSAFE(a, b, a_acd_not_ready);
NM_CMP_FIELD_UNSAFE(a, b, a_assume_config_once);
return 0;
@@ -7888,7 +7854,7 @@ nm_platform_ip6_address_hash_update(const NMPlatformIP6Address *obj, NMHashState
obj->plen,
obj->address,
obj->peer_address,
- NM_HASH_COMBINE_BOOLS(guint8, obj->external, obj->a_assume_config_once));
+ NM_HASH_COMBINE_BOOLS(guint8, obj->a_assume_config_once));
}
int
@@ -7908,7 +7874,6 @@ nm_platform_ip6_address_cmp(const NMPlatformIP6Address *a, const NMPlatformIP6Ad
NM_CMP_FIELD(a, b, lifetime);
NM_CMP_FIELD(a, b, preferred);
NM_CMP_FIELD(a, b, n_ifa_flags);
- NM_CMP_FIELD_UNSAFE(a, b, external);
NM_CMP_FIELD_UNSAFE(a, b, a_assume_config_once);
return 0;
}
@@ -8018,7 +7983,6 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
obj->lock_initcwnd,
obj->lock_initrwnd,
obj->lock_mtu,
- obj->is_external,
obj->r_assume_config_once));
break;
}
@@ -8110,7 +8074,6 @@ nm_platform_ip4_route_cmp(const NMPlatformIP4Route *a,
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, is_external);
NM_CMP_FIELD_UNSAFE(a, b, r_assume_config_once);
}
break;
@@ -8205,7 +8168,6 @@ nm_platform_ip6_route_hash_update(const NMPlatformIP6Route *obj,
obj->lock_initcwnd,
obj->lock_initrwnd,
obj->lock_mtu,
- obj->is_external,
obj->r_assume_config_once),
obj->window,
obj->cwnd,
@@ -8290,7 +8252,6 @@ nm_platform_ip6_route_cmp(const NMPlatformIP6Route *a,
else
NM_CMP_FIELD(a, b, rt_pref);
if (cmp_type == NM_PLATFORM_IP_ROUTE_CMP_TYPE_FULL) {
- NM_CMP_FIELD_UNSAFE(a, b, is_external);
NM_CMP_FIELD_UNSAFE(a, b, r_assume_config_once);
}
break;