mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 15:50:07 +01:00
platform: add _NM_IP_CONFIG_SOURCE_RTPROT_KERNEL source
Later we will need this flag to distinguish routes from kernel
that have source RTPROT_KERNEL.
This flag is still unused.
(cherry picked from commit 64d918293b)
This commit is contained in:
parent
01d20783ed
commit
fa7acaef83
3 changed files with 14 additions and 4 deletions
|
|
@ -46,6 +46,10 @@ typedef struct _NMSleepMonitor NMSleepMonitor;
|
|||
typedef enum {
|
||||
/* In priority order; higher number == higher priority */
|
||||
NM_IP_CONFIG_SOURCE_UNKNOWN,
|
||||
|
||||
/* platform internal flag used to mark routes with protocol RTPROT_KERNEL. */
|
||||
_NM_IP_CONFIG_SOURCE_RTPROT_KERNEL,
|
||||
|
||||
NM_IP_CONFIG_SOURCE_KERNEL,
|
||||
NM_IP_CONFIG_SOURCE_SHARED,
|
||||
NM_IP_CONFIG_SOURCE_IP4LL,
|
||||
|
|
|
|||
|
|
@ -1277,6 +1277,7 @@ source_to_rtprot (NMIPConfigSource source)
|
|||
case NM_IP_CONFIG_SOURCE_UNKNOWN:
|
||||
return RTPROT_UNSPEC;
|
||||
case NM_IP_CONFIG_SOURCE_KERNEL:
|
||||
case _NM_IP_CONFIG_SOURCE_RTPROT_KERNEL:
|
||||
return RTPROT_KERNEL;
|
||||
case NM_IP_CONFIG_SOURCE_DHCP:
|
||||
return RTPROT_DHCP;
|
||||
|
|
@ -1289,13 +1290,16 @@ source_to_rtprot (NMIPConfigSource source)
|
|||
}
|
||||
|
||||
static NMIPConfigSource
|
||||
rtprot_to_source (guint rtprot)
|
||||
rtprot_to_source (guint rtprot, gboolean preserve_rtprot)
|
||||
{
|
||||
switch (rtprot) {
|
||||
case RTPROT_UNSPEC:
|
||||
return NM_IP_CONFIG_SOURCE_UNKNOWN;
|
||||
case RTPROT_REDIRECT:
|
||||
case RTPROT_KERNEL:
|
||||
if (preserve_rtprot)
|
||||
return _NM_IP_CONFIG_SOURCE_RTPROT_KERNEL;
|
||||
/* fall through */
|
||||
case RTPROT_REDIRECT:
|
||||
return NM_IP_CONFIG_SOURCE_KERNEL;
|
||||
case RTPROT_RA:
|
||||
return NM_IP_CONFIG_SOURCE_RDISC;
|
||||
|
|
@ -1352,7 +1356,7 @@ init_ip4_route (NMPlatformIP4Route *route, struct rtnl_route *rtnlroute)
|
|||
}
|
||||
route->metric = rtnl_route_get_priority (rtnlroute);
|
||||
rtnl_route_get_metric (rtnlroute, RTAX_ADVMSS, &route->mss);
|
||||
route->source = rtprot_to_source (rtnl_route_get_protocol (rtnlroute));
|
||||
route->source = rtprot_to_source (rtnl_route_get_protocol (rtnlroute), FALSE);
|
||||
route->scope_inv = nm_platform_route_scope_inv (rtnl_route_get_scope (rtnlroute));
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -1393,7 +1397,7 @@ init_ip6_route (NMPlatformIP6Route *route, struct rtnl_route *rtnlroute)
|
|||
}
|
||||
route->metric = rtnl_route_get_priority (rtnlroute);
|
||||
rtnl_route_get_metric (rtnlroute, RTAX_ADVMSS, &route->mss);
|
||||
route->source = rtprot_to_source (rtnl_route_get_protocol (rtnlroute));
|
||||
route->source = rtprot_to_source (rtnl_route_get_protocol (rtnlroute), FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2588,6 +2588,8 @@ static const char *
|
|||
source_to_string (NMIPConfigSource source)
|
||||
{
|
||||
switch (source) {
|
||||
case _NM_IP_CONFIG_SOURCE_RTPROT_KERNEL:
|
||||
return "rtprot-kernel";
|
||||
case NM_IP_CONFIG_SOURCE_KERNEL:
|
||||
return "kernel";
|
||||
case NM_IP_CONFIG_SOURCE_SHARED:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue