Commit 6698bf58 authored by Thomas Haller's avatar Thomas Haller
Browse files

core: track routes with source RTPROT_KERNEL (rtm_protocol) in NMIP4Config/NMIP6Config

Let's not treat those routes special. I think this was originally done, because
we relied on kernel to add the IPv4 device route, so we would ignore RTPROT_KERNEL
routes and not delete them.

We want to track them for various reasons:

 - for consistency, there is nothing special except that they might be
   added by kernel.
 - we expose the routes of NMIP4Config/NMIP6Config on D-Bus. That should
   include also routes such as device routes. Note, this commit changes
   that we now expose device routes on D-Bus too.
parent 9a3117f1
......@@ -697,8 +697,6 @@ nm_ip4_config_capture (NMDedupMultiIndex *multi_idx, NMPlatform *platform, int i
if (route->table_coerced)
continue;
if (route->rt_source == NM_IP_CONFIG_SOURCE_RTPROT_KERNEL)
continue;
_add_route (self, plobj, NULL, NULL);
}
......@@ -838,7 +836,7 @@ nm_ip4_config_commit (const NMIP4Config *self,
AF_INET,
ifindex,
routes,
nm_platform_lookup_predicate_routes_main_skip_rtprot_kernel,
nm_platform_lookup_predicate_routes_main,
NULL))
success = FALSE;
......
......@@ -501,8 +501,6 @@ nm_ip6_config_capture (NMDedupMultiIndex *multi_idx, NMPlatform *platform, int i
if (route->table_coerced)
continue;
if (route->rt_source == NM_IP_CONFIG_SOURCE_RTPROT_KERNEL)
continue;
_add_route (self, plobj, NULL, NULL);
}
......@@ -553,7 +551,7 @@ nm_ip6_config_commit (const NMIP6Config *self,
AF_INET6,
ifindex,
routes,
nm_platform_lookup_predicate_routes_main_skip_rtprot_kernel,
nm_platform_lookup_predicate_routes_main,
NULL))
success = FALSE;
......
......@@ -2899,22 +2899,22 @@ nm_platform_lookup (NMPlatform *self,
}
gboolean
nm_platform_lookup_predicate_routes_main_skip_rtprot_kernel (const NMPObject *obj,
gpointer user_data)
nm_platform_lookup_predicate_routes_main (const NMPObject *obj,
gpointer user_data)
{
nm_assert (NM_IN_SET (NMP_OBJECT_GET_TYPE (obj), NMP_OBJECT_TYPE_IP4_ROUTE,
NMP_OBJECT_TYPE_IP6_ROUTE));
return !obj->ip_route.table_coerced
&& obj->ip_route.rt_source != NM_IP_CONFIG_SOURCE_RTPROT_KERNEL;
return !obj->ip_route.table_coerced;
}
gboolean
nm_platform_lookup_predicate_routes_skip_rtprot_kernel (const NMPObject *obj,
gpointer user_data)
nm_platform_lookup_predicate_routes_main_skip_rtprot_kernel (const NMPObject *obj,
gpointer user_data)
{
nm_assert (NM_IN_SET (NMP_OBJECT_GET_TYPE (obj), NMP_OBJECT_TYPE_IP4_ROUTE,
NMP_OBJECT_TYPE_IP6_ROUTE));
return obj->ip_route.rt_source != NM_IP_CONFIG_SOURCE_RTPROT_KERNEL;
return !obj->ip_route.table_coerced
&& obj->ip_route.rt_source != NM_IP_CONFIG_SOURCE_RTPROT_KERNEL;
}
/**
......
......@@ -957,10 +957,10 @@ struct _NMPLookup;
const struct _NMDedupMultiHeadEntry *nm_platform_lookup (NMPlatform *platform,
const struct _NMPLookup *lookup);
gboolean nm_platform_lookup_predicate_routes_main (const NMPObject *obj,
gpointer user_data);
gboolean nm_platform_lookup_predicate_routes_main_skip_rtprot_kernel (const NMPObject *obj,
gpointer user_data);
gboolean nm_platform_lookup_predicate_routes_skip_rtprot_kernel (const NMPObject *obj,
gpointer user_data);
GPtrArray *nm_platform_lookup_clone (NMPlatform *platform,
const struct _NMPLookup *lookup,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment