diff options
author | Dan Winship <danw@gnome.org> | 2014-05-08 14:50:02 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-06-06 10:24:43 -0400 |
commit | 662ade1e47bf2612dbd0087804441a854cc4122a (patch) | |
tree | af68fefeae1ef21b9bc81178005a99fa731369c9 /src | |
parent | e644745d85a20529c6bbb0f6f479acfa45edca86 (diff) | |
download | NetworkManager-662ade1e47bf2612dbd0087804441a854cc4122a.tar.gz |
platform: improve tracking of route sources
NMIP[46]Route had a "source" field, but it was always set to KERNEL
for routes read from the kernel (even if they were originally added by
NM).
Fix things a bit by translating between our "source" field and the
kernel's "protocol" field.
https://bugzilla.gnome.org/show_bug.cgi?id=729203
Diffstat (limited to 'src')
-rw-r--r-- | src/nm-policy.c | 24 | ||||
-rw-r--r-- | src/platform/nm-fake-platform.c | 6 | ||||
-rw-r--r-- | src/platform/nm-linux-platform.c | 64 | ||||
-rw-r--r-- | src/platform/nm-platform.c | 12 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 8 | ||||
-rw-r--r-- | src/platform/tests/platform.c | 8 | ||||
-rw-r--r-- | src/platform/tests/test-cleanup.c | 12 | ||||
-rw-r--r-- | src/platform/tests/test-route.c | 20 |
8 files changed, 100 insertions, 54 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c index 13099e3693..f307f999c6 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -658,13 +658,13 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update) if (ip_ifindex <= 0) ip_ifindex = parent_ifindex; - if (!nm_platform_ip4_route_add (ip_ifindex, + if (!nm_platform_ip4_route_add (ip_ifindex, NM_PLATFORM_SOURCE_VPN, 0, 0, int_gw, NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) { - (void) nm_platform_ip4_route_add (parent_ifindex, + (void) nm_platform_ip4_route_add (parent_ifindex, NM_PLATFORM_SOURCE_VPN, gw_addr, 32, 0, NM_PLATFORM_ROUTE_METRIC_DEFAULT, parent_mss); - if (!nm_platform_ip4_route_add (ip_ifindex, + if (!nm_platform_ip4_route_add (ip_ifindex, NM_PLATFORM_SOURCE_VPN, 0, 0, int_gw, NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) nm_log_err (LOGD_IP4 | LOGD_VPN, "Failed to set default route."); @@ -675,13 +675,13 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update) int mss = nm_ip4_config_get_mss (ip4_config); g_assert (ip_iface); - if (!nm_platform_ip4_route_add (ip_ifindex, + if (!nm_platform_ip4_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER, 0, 0, gw_addr, NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) { - (void) nm_platform_ip4_route_add (ip_ifindex, + (void) nm_platform_ip4_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER, gw_addr, 32, 0, NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss); - if (!nm_platform_ip4_route_add (ip_ifindex, + if (!nm_platform_ip4_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER, 0, 0, gw_addr, NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) { nm_log_err (LOGD_IP4, "Failed to set default route."); @@ -864,13 +864,13 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update) if (ip_ifindex <= 0) ip_ifindex = parent_ifindex; - if (!nm_platform_ip6_route_add (ip_ifindex, + if (!nm_platform_ip6_route_add (ip_ifindex, NM_PLATFORM_SOURCE_VPN, in6addr_any, 0, *int_gw, NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) { - (void) nm_platform_ip6_route_add (parent_ifindex, + (void) nm_platform_ip6_route_add (parent_ifindex, NM_PLATFORM_SOURCE_VPN, *gw_addr, 128, in6addr_any, NM_PLATFORM_ROUTE_METRIC_DEFAULT, parent_mss); - if (!nm_platform_ip6_route_add (ip_ifindex, + if (!nm_platform_ip6_route_add (ip_ifindex, NM_PLATFORM_SOURCE_VPN, in6addr_any, 0, *int_gw, NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) { nm_log_err (LOGD_IP6 | LOGD_VPN, "Failed to set default route."); @@ -881,13 +881,13 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update) } else { int mss = nm_ip6_config_get_mss (ip6_config); - if (!nm_platform_ip6_route_add (ip_ifindex, + if (!nm_platform_ip6_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER, in6addr_any, 0, *gw_addr, NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) { - (void) nm_platform_ip6_route_add (ip_ifindex, + (void) nm_platform_ip6_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER, *gw_addr, 128, in6addr_any, NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss); - if (!nm_platform_ip6_route_add (ip_ifindex, + if (!nm_platform_ip6_route_add (ip_ifindex, NM_PLATFORM_SOURCE_USER, in6addr_any, 0, *gw_addr, NM_PLATFORM_ROUTE_METRIC_DEFAULT, mss)) nm_log_err (LOGD_IP6, "Failed to set default route."); diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c index 1fe11bdd31..46272217d0 100644 --- a/src/platform/nm-fake-platform.c +++ b/src/platform/nm-fake-platform.c @@ -1039,7 +1039,7 @@ ip6_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default) } static gboolean -ip4_route_add (NMPlatform *platform, int ifindex, +ip4_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source, in_addr_t network, int plen, in_addr_t gateway, int metric, int mss) { @@ -1050,6 +1050,7 @@ ip4_route_add (NMPlatform *platform, int ifindex, memset (&route, 0, sizeof (route)); route.source = NM_PLATFORM_SOURCE_KERNEL; route.ifindex = ifindex; + route.source = source; route.network = network; route.plen = plen; route.gateway = gateway; @@ -1078,7 +1079,7 @@ ip4_route_add (NMPlatform *platform, int ifindex, } static gboolean -ip6_route_add (NMPlatform *platform, int ifindex, +ip6_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source, struct in6_addr network, int plen, struct in6_addr gateway, int metric, int mss) { @@ -1089,6 +1090,7 @@ ip6_route_add (NMPlatform *platform, int ifindex, memset (&route, 0, sizeof (route)); route.source = NM_PLATFORM_SOURCE_KERNEL; route.ifindex = ifindex; + route.source = source; route.network = network; route.plen = plen; route.gateway = gateway; diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 5831a6eceb..f5911c8b70 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -1048,6 +1048,43 @@ init_ip6_address (NMPlatformIP6Address *address, struct rtnl_addr *rtnladdr) return TRUE; } +static guint +source_to_rtprot (NMPlatformSource source) +{ + switch (source) { + case NM_PLATFORM_SOURCE_UNKNOWN: + return RTPROT_UNSPEC; + case NM_PLATFORM_SOURCE_KERNEL: + return RTPROT_KERNEL; + case NM_PLATFORM_SOURCE_DHCP: + return RTPROT_DHCP; + case NM_PLATFORM_SOURCE_RDISC: + return RTPROT_RA; + + default: + return RTPROT_STATIC; + } +} + +static NMPlatformSource +rtprot_to_source (guint rtprot) +{ + switch (rtprot) { + case RTPROT_UNSPEC: + return NM_PLATFORM_SOURCE_UNKNOWN; + case RTPROT_REDIRECT: + case RTPROT_KERNEL: + return NM_PLATFORM_SOURCE_KERNEL; + case RTPROT_RA: + return NM_PLATFORM_SOURCE_RDISC; + case RTPROT_DHCP: + return NM_PLATFORM_SOURCE_DHCP; + + default: + return NM_PLATFORM_SOURCE_USER; + } +} + static gboolean init_ip4_route (NMPlatformIP4Route *route, struct rtnl_route *rtnlroute) { @@ -1083,6 +1120,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)); return TRUE; } @@ -1122,6 +1160,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)); return TRUE; } @@ -3263,7 +3302,6 @@ ip4_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default) for (object = nl_cache_get_first (priv->route_cache); object; object = nl_cache_get_next (object)) { if (_route_match ((struct rtnl_route *) object, AF_INET, ifindex)) { if (init_ip4_route (&route, (struct rtnl_route *) object)) { - route.source = NM_PLATFORM_SOURCE_KERNEL; if (route.plen != 0 || include_default) g_array_append_val (routes, route); } @@ -3286,7 +3324,6 @@ ip6_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default) for (object = nl_cache_get_first (priv->route_cache); object; object = nl_cache_get_next (object)) { if (_route_match ((struct rtnl_route *) object, AF_INET6, ifindex)) { if (init_ip6_route (&route, (struct rtnl_route *) object)) { - route.source = NM_PLATFORM_SOURCE_KERNEL; if (route.plen != 0 || include_default) g_array_append_val (routes, route); } @@ -3315,7 +3352,7 @@ clear_host_address (int family, const void *network, int plen, void *dst) } static struct nl_object * -build_rtnl_route (int family, int ifindex, +build_rtnl_route (int family, int ifindex, NMPlatformSource source, gconstpointer network, int plen, gconstpointer gateway, int metric, int mss) { @@ -3341,6 +3378,7 @@ build_rtnl_route (int family, int ifindex, rtnl_route_set_dst (rtnlroute, dst); rtnl_route_set_priority (rtnlroute, metric); rtnl_route_set_family (rtnlroute, family); + rtnl_route_set_protocol (rtnlroute, source_to_rtprot (source)); nexthop = _nm_rtnl_route_nh_alloc (); rtnl_route_nh_set_ifindex (nexthop, ifindex); @@ -3355,19 +3393,19 @@ build_rtnl_route (int family, int ifindex, } static gboolean -ip4_route_add (NMPlatform *platform, int ifindex, +ip4_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source, in_addr_t network, int plen, in_addr_t gateway, int metric, int mss) { - return add_object (platform, build_rtnl_route (AF_INET, ifindex, &network, plen, &gateway, metric, mss)); + return add_object (platform, build_rtnl_route (AF_INET, ifindex, source, &network, plen, &gateway, metric, mss)); } static gboolean -ip6_route_add (NMPlatform *platform, int ifindex, +ip6_route_add (NMPlatform *platform, int ifindex, NMPlatformSource source, struct in6_addr network, int plen, struct in6_addr gateway, int metric, int mss) { - return add_object (platform, build_rtnl_route (AF_INET6, ifindex, &network, plen, &gateway, metric, mss)); + return add_object (platform, build_rtnl_route (AF_INET6, ifindex, source, &network, plen, &gateway, metric, mss)); } static struct rtnl_route * @@ -3424,7 +3462,7 @@ ip4_route_delete (NMPlatform *platform, int ifindex, in_addr_t network, int plen { in_addr_t gateway = 0; struct rtnl_route *cached_object; - struct nl_object *route = build_rtnl_route (AF_INET, ifindex, &network, plen, &gateway, metric, 0); + struct nl_object *route = build_rtnl_route (AF_INET, ifindex, NM_PLATFORM_SOURCE_UNKNOWN, &network, plen, &gateway, metric, 0); uint8_t scope = RT_SCOPE_NOWHERE; struct nl_cache *cache; @@ -3465,9 +3503,6 @@ ip4_route_delete (NMPlatform *platform, int ifindex, in_addr_t network, int plen } rtnl_route_set_scope ((struct rtnl_route *) route, scope); - /* protocol defaults to RTPROT_STATIC, set to zero so that the kernel ignores the value */ - rtnl_route_set_protocol ((struct rtnl_route *) route, 0); - if (cached_object) rtnl_route_set_tos ((struct rtnl_route *) route, rtnl_route_get_tos (cached_object)); @@ -3487,15 +3522,16 @@ ip6_route_delete (NMPlatform *platform, int ifindex, struct in6_addr network, in { struct in6_addr gateway = IN6ADDR_ANY_INIT; - return delete_object (platform, build_rtnl_route (AF_INET6, ifindex, &network, plen, &gateway, metric, 0), FALSE) && + return delete_object (platform, build_rtnl_route (AF_INET6, ifindex, NM_PLATFORM_SOURCE_UNKNOWN ,&network, plen, &gateway, metric, 0), FALSE) && refresh_route (platform, AF_INET6, ifindex, &network, plen, metric); } static gboolean ip_route_exists (NMPlatform *platform, int family, int ifindex, gpointer network, int plen, int metric) { - auto_nl_object struct nl_object *object = build_rtnl_route (family, ifindex, network, - plen, NULL, metric, 0); + auto_nl_object struct nl_object *object = build_rtnl_route (family, ifindex, + NM_PLATFORM_SOURCE_UNKNOWN, + network, plen, NULL, metric, 0); struct nl_cache *cache = choose_cache (platform, object); auto_nl_object struct nl_object *cached_object = nl_cache_search (cache, object); diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 35525cf5d7..463822c7d9 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -1711,7 +1711,7 @@ nm_platform_ip6_route_get_all (int ifindex, gboolean include_default) } gboolean -nm_platform_ip4_route_add (int ifindex, +nm_platform_ip4_route_add (int ifindex, NMPlatformSource source, in_addr_t network, int plen, in_addr_t gateway, int metric, int mss) { @@ -1727,6 +1727,7 @@ nm_platform_ip4_route_add (int ifindex, NMPlatformIP4Route route = { 0 }; route.ifindex = ifindex; + route.source = source; route.network = network; route.plen = plen; route.gateway = gateway; @@ -1735,11 +1736,11 @@ nm_platform_ip4_route_add (int ifindex, debug ("route: adding or updating IPv4 route: %s", nm_platform_ip4_route_to_string (&route)); } - return klass->ip4_route_add (platform, ifindex, network, plen, gateway, metric, mss); + return klass->ip4_route_add (platform, ifindex, source, network, plen, gateway, metric, mss); } gboolean -nm_platform_ip6_route_add (int ifindex, +nm_platform_ip6_route_add (int ifindex, NMPlatformSource source, struct in6_addr network, int plen, struct in6_addr gateway, int metric, int mss) { @@ -1753,6 +1754,7 @@ nm_platform_ip6_route_add (int ifindex, NMPlatformIP6Route route = { 0 }; route.ifindex = ifindex; + route.source = source; route.network = network; route.plen = plen; route.gateway = gateway; @@ -1761,7 +1763,7 @@ nm_platform_ip6_route_add (int ifindex, debug ("route: adding or updating IPv6 route: %s", nm_platform_ip6_route_to_string (&route)); } - return klass->ip6_route_add (platform, ifindex, network, plen, gateway, metric, mss); + return klass->ip6_route_add (platform, ifindex, source, network, plen, gateway, metric, mss); } gboolean @@ -1896,6 +1898,7 @@ nm_platform_ip4_route_sync (int ifindex, const GArray *known_routes) /* Ignore routes that already exist */ if (!array_contains_ip4_route (routes, known_route)) { success = nm_platform_ip4_route_add (ifindex, + known_route->source, known_route->network, known_route->plen, known_route->gateway, @@ -1963,6 +1966,7 @@ nm_platform_ip6_route_sync (int ifindex, const GArray *known_routes) /* Ignore routes that already exist */ if (!array_contains_ip6_route (routes, known_route)) { success = nm_platform_ip6_route_add (ifindex, + known_route->source, known_route->network, known_route->plen, known_route->gateway, diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index d6f3fe0ba2..cde551b258 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -428,10 +428,10 @@ typedef struct { GArray * (*ip4_route_get_all) (NMPlatform *, int ifindex, gboolean include_default); GArray * (*ip6_route_get_all) (NMPlatform *, int ifindex, gboolean include_default); - gboolean (*ip4_route_add) (NMPlatform *, int ifindex, + gboolean (*ip4_route_add) (NMPlatform *, int ifindex, NMPlatformSource source, in_addr_t network, int plen, in_addr_t gateway, int prio, int mss); - gboolean (*ip6_route_add) (NMPlatform *, int ifindex, + gboolean (*ip6_route_add) (NMPlatform *, int ifindex, NMPlatformSource source, struct in6_addr network, int plen, struct in6_addr gateway, int prio, int mss); gboolean (*ip4_route_delete) (NMPlatform *, int ifindex, in_addr_t network, int plen, int metric); @@ -572,10 +572,10 @@ gboolean nm_platform_address_flush (int ifindex); GArray *nm_platform_ip4_route_get_all (int ifindex, gboolean include_default); GArray *nm_platform_ip6_route_get_all (int ifindex, gboolean include_default); gboolean nm_platform_route_set_metric (int ifindex, int metric); -gboolean nm_platform_ip4_route_add (int ifindex, +gboolean nm_platform_ip4_route_add (int ifindex, NMPlatformSource source, in_addr_t network, int plen, in_addr_t gateway, int metric, int mss); -gboolean nm_platform_ip6_route_add (int ifindex, +gboolean nm_platform_ip6_route_add (int ifindex, NMPlatformSource source, struct in6_addr network, int plen, struct in6_addr gateway, int metric, int mss); gboolean nm_platform_ip4_route_delete (int ifindex, in_addr_t network, int plen, int metric); diff --git a/src/platform/tests/platform.c b/src/platform/tests/platform.c index 1802ac2c08..ea8bd0e3b3 100644 --- a/src/platform/tests/platform.c +++ b/src/platform/tests/platform.c @@ -677,7 +677,9 @@ do_ip4_route_add (char **argv) metric = strtol (*argv++, NULL, 10); mss = strtol (*argv++, NULL, 10); - return nm_platform_ip4_route_add (ifindex, network, plen, gateway, metric, mss); + return nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, + network, plen, gateway, + metric, mss); } static gboolean @@ -691,7 +693,9 @@ do_ip6_route_add (char **argv) parse_ip6_address (*argv++, &gateway, NULL); metric = strtol (*argv++, NULL, 10); mss = strtol (*argv++, NULL, 10); - return nm_platform_ip6_route_add (ifindex, network, plen, gateway, metric, mss); + return nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, + network, plen, gateway, + metric, mss); } static gboolean diff --git a/src/platform/tests/test-cleanup.c b/src/platform/tests/test-cleanup.c index 5d6036ca44..e60d82f0ed 100644 --- a/src/platform/tests/test-cleanup.c +++ b/src/platform/tests/test-cleanup.c @@ -43,12 +43,12 @@ test_cleanup_internal () /* Add routes and addresses */ g_assert (nm_platform_ip4_address_add (ifindex, addr4, 0, plen4, lifetime, preferred, NULL)); g_assert (nm_platform_ip6_address_add (ifindex, addr6, in6addr_any, plen6, lifetime, preferred, flags)); - g_assert (nm_platform_ip4_route_add (ifindex, gateway4, 32, INADDR_ANY, metric, mss)); - g_assert (nm_platform_ip4_route_add (ifindex, network4, plen4, gateway4, metric, mss)); - g_assert (nm_platform_ip4_route_add (ifindex, 0, 0, gateway4, metric, mss)); - g_assert (nm_platform_ip6_route_add (ifindex, gateway6, 128, in6addr_any, metric, mss)); - g_assert (nm_platform_ip6_route_add (ifindex, network6, plen6, gateway6, metric, mss)); - g_assert (nm_platform_ip6_route_add (ifindex, in6addr_any, 0, gateway6, metric, mss)); + g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, gateway4, 32, INADDR_ANY, metric, mss)); + g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network4, plen4, gateway4, metric, mss)); + g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, 0, 0, gateway4, metric, mss)); + g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, gateway6, 128, in6addr_any, metric, mss)); + g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network6, plen6, gateway6, metric, mss)); + g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, in6addr_any, 0, gateway6, metric, mss)); addresses4 = nm_platform_ip4_address_get_all (ifindex); addresses6 = nm_platform_ip6_address_get_all (ifindex); diff --git a/src/platform/tests/test-route.c b/src/platform/tests/test-route.c index 24bd089cf8..6ad4ba3089 100644 --- a/src/platform/tests/test-route.c +++ b/src/platform/tests/test-route.c @@ -66,35 +66,35 @@ test_ip4_route () inet_pton (AF_INET, "198.51.100.1", &gateway); /* Add route to gateway */ - g_assert (nm_platform_ip4_route_add (ifindex, gateway, 32, INADDR_ANY, metric, mss)); + g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, gateway, 32, INADDR_ANY, metric, mss)); no_error (); accept_signal (route_added); /* Add route */ g_assert (!nm_platform_ip4_route_exists (ifindex, network, plen, metric)); no_error (); - g_assert (nm_platform_ip4_route_add (ifindex, network, plen, gateway, metric, mss)); + g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network, plen, gateway, metric, mss)); no_error (); g_assert (nm_platform_ip4_route_exists (ifindex, network, plen, metric)); no_error (); accept_signal (route_added); /* Add route again */ - g_assert (nm_platform_ip4_route_add (ifindex, network, plen, gateway, metric, mss)); + g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network, plen, gateway, metric, mss)); no_error (); accept_signal (route_changed); /* Add default route */ g_assert (!nm_platform_ip4_route_exists (ifindex, 0, 0, metric)); no_error (); - g_assert (nm_platform_ip4_route_add (ifindex, 0, 0, gateway, metric, mss)); + g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, 0, 0, gateway, metric, mss)); no_error (); g_assert (nm_platform_ip4_route_exists (ifindex, 0, 0, metric)); no_error (); accept_signal (route_added); /* Add default route again */ - g_assert (nm_platform_ip4_route_add (ifindex, 0, 0, gateway, metric, mss)); + g_assert (nm_platform_ip4_route_add (ifindex, NM_PLATFORM_SOURCE_USER, 0, 0, gateway, metric, mss)); no_error (); accept_signal (route_changed); @@ -161,35 +161,35 @@ test_ip6_route () inet_pton (AF_INET6, "2001:db8:c:d:1:2:3:4", &gateway); /* Add route to gateway */ - g_assert (nm_platform_ip6_route_add (ifindex, gateway, 128, in6addr_any, metric, mss)); + g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, gateway, 128, in6addr_any, metric, mss)); no_error (); accept_signal (route_added); /* Add route */ g_assert (!nm_platform_ip6_route_exists (ifindex, network, plen, metric)); no_error (); - g_assert (nm_platform_ip6_route_add (ifindex, network, plen, gateway, metric, mss)); + g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network, plen, gateway, metric, mss)); no_error (); g_assert (nm_platform_ip6_route_exists (ifindex, network, plen, metric)); no_error (); accept_signal (route_added); /* Add route again */ - g_assert (nm_platform_ip6_route_add (ifindex, network, plen, gateway, metric, mss)); + g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, network, plen, gateway, metric, mss)); no_error (); accept_signal (route_changed); /* Add default route */ g_assert (!nm_platform_ip6_route_exists (ifindex, in6addr_any, 0, metric)); no_error (); - g_assert (nm_platform_ip6_route_add (ifindex, in6addr_any, 0, gateway, metric, mss)); + g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, in6addr_any, 0, gateway, metric, mss)); no_error (); g_assert (nm_platform_ip6_route_exists (ifindex, in6addr_any, 0, metric)); no_error (); accept_signal (route_added); /* Add default route again */ - g_assert (nm_platform_ip6_route_add (ifindex, in6addr_any, 0, gateway, metric, mss)); + g_assert (nm_platform_ip6_route_add (ifindex, NM_PLATFORM_SOURCE_USER, in6addr_any, 0, gateway, metric, mss)); no_error (); accept_signal (route_changed); |