mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-16 06:40:41 +00:00
platform: add is-external flag to NMPlatformIPRoute
We will need to track whether a route is externally added or not. We maybe could use rt_source for that, but instead add a boolean flag.
This commit is contained in:
parent
f3404435a9
commit
dc0ac73780
|
@ -6524,6 +6524,7 @@ nm_platform_ip4_route_to_string(const NMPlatformIP4Route *route, char *buf, gsiz
|
|||
"%s" /* initcwnd */
|
||||
"%s" /* initrwnd */
|
||||
"%s" /* mtu */
|
||||
"%s" /* is_external */
|
||||
"",
|
||||
nm_net_aux_rtnl_rtntype_n2a_maybe_buf(nm_platform_route_type_uncoerce(route->type_coerced),
|
||||
str_type),
|
||||
|
@ -6579,7 +6580,8 @@ nm_platform_ip4_route_to_string(const NMPlatformIP4Route *route, char *buf, gsiz
|
|||
" mtu %s%" G_GUINT32_FORMAT,
|
||||
route->lock_mtu ? "lock " : "",
|
||||
route->mtu)
|
||||
: "");
|
||||
: "",
|
||||
route->is_external ? " (E)" : "");
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -6649,6 +6651,7 @@ nm_platform_ip6_route_to_string(const NMPlatformIP6Route *route, char *buf, gsiz
|
|||
"%s" /* initrwnd */
|
||||
"%s" /* mtu */
|
||||
"%s" /* pref */
|
||||
"%s" /* is_external */
|
||||
"",
|
||||
nm_net_aux_rtnl_rtntype_n2a_maybe_buf(nm_platform_route_type_uncoerce(route->type_coerced),
|
||||
str_type),
|
||||
|
@ -6708,7 +6711,8 @@ 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->is_external ? " (E)" : "");
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -8005,7 +8009,8 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
|
|||
obj->lock_cwnd,
|
||||
obj->lock_initcwnd,
|
||||
obj->lock_initrwnd,
|
||||
obj->lock_mtu));
|
||||
obj->lock_mtu,
|
||||
obj->is_external));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -8095,6 +8100,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, is_external);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
@ -8186,7 +8193,8 @@ nm_platform_ip6_route_hash_update(const NMPlatformIP6Route *obj,
|
|||
obj->lock_cwnd,
|
||||
obj->lock_initcwnd,
|
||||
obj->lock_initrwnd,
|
||||
obj->lock_mtu),
|
||||
obj->lock_mtu,
|
||||
obj->is_external),
|
||||
obj->window,
|
||||
obj->cwnd,
|
||||
obj->initcwnd,
|
||||
|
@ -8269,6 +8277,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, is_external);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -462,6 +462,14 @@ typedef union {
|
|||
* the "table_coerced" field is ignored (unlike for the metric). */ \
|
||||
bool table_any : 1; \
|
||||
\
|
||||
/* This route is tracked as external route, that is not a route that NetworkManager
|
||||
* actively wants to add, but a route that was added externally. In some cases, such
|
||||
* a route should be ignored.
|
||||
*
|
||||
* Note that unlike most other fields here, this flag only exists inside NetworkManager
|
||||
* and is not reflected on netlink. */ \
|
||||
bool is_external : 1; \
|
||||
\
|
||||
/* rtnh_flags
|
||||
*
|
||||
* Routes with rtm_flags RTM_F_CLONED are hidden by platform and
|
||||
|
|
Loading…
Reference in a new issue