summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-11-13 20:58:12 -0600
committerDan Williams <dcbw@redhat.com>2014-11-13 20:58:12 -0600
commitd8c7c4e7cfde3ef941d529342248069498ebe68c (patch)
tree39748fa2bbdc7629792c370c7d50cbc6f6713eaf
parent0c8952b0e7a6055d60bf31f0f444108a29472947 (diff)
parent3642404f769fe9dc97d6ca653635369bf0fbe403 (diff)
downloadNetworkManager-dcbw/nm-1-0-integration.tar.gz
Merge branch 'th/bgo723178_device_route_metric' into dcbw/nm-1-0-integrationdcbw/nm-1-0-integration
-rw-r--r--src/devices/nm-device.c16
-rw-r--r--src/nm-default-route-manager.c1
-rw-r--r--src/nm-iface-helper.c2
-rw-r--r--src/nm-ip4-config.c4
-rw-r--r--src/nm-ip4-config.h2
-rw-r--r--src/platform/nm-fake-platform.c2
-rw-r--r--src/platform/nm-linux-platform.c16
-rw-r--r--src/platform/nm-platform.c32
-rw-r--r--src/platform/nm-platform.h6
-rw-r--r--src/platform/tests/platform.c2
-rw-r--r--src/platform/tests/test-cleanup.c6
-rw-r--r--src/platform/tests/test-route.c10
-rw-r--r--src/vpn-manager/nm-vpn-connection.c3
13 files changed, 67 insertions, 35 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 19c43f2588..cfb47e6bf8 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -314,6 +314,7 @@ typedef struct {
static gboolean nm_device_set_ip4_config (NMDevice *self,
NMIP4Config *config,
+ guint32 default_route_metric,
gboolean commit,
NMDeviceStateReason *reason);
static gboolean ip4_config_merge_and_apply (NMDevice *self,
@@ -2763,6 +2764,7 @@ ip4_config_merge_and_apply (NMDevice *self,
NMConnection *connection;
gboolean success;
NMIP4Config *composite;
+ guint32 default_route_metric = nm_device_get_ip4_route_metric (self);
/* Merge all the configs into the composite config */
if (config) {
@@ -2797,7 +2799,7 @@ ip4_config_merge_and_apply (NMDevice *self,
if (!nm_settings_connection_get_nm_generated_assumed (NM_SETTINGS_CONNECTION (connection))) {
nm_ip4_config_merge_setting (composite,
nm_connection_get_setting_ip4_config (connection),
- nm_device_get_ip4_route_metric (self));
+ default_route_metric);
}
/* Add the default route.
@@ -2827,7 +2829,7 @@ ip4_config_merge_and_apply (NMDevice *self,
memset (route, 0, sizeof (*route));
route->source = NM_IP_CONFIG_SOURCE_USER;
route->gateway = gateway;
- route->metric = nm_device_get_ip4_route_metric (self);
+ route->metric = default_route_metric;
route->mss = nm_ip4_config_get_mss (composite);
priv->default_route.v4_has = TRUE;
priv->default_route.v4_is_assumed = FALSE;
@@ -2859,7 +2861,7 @@ ip4_config_merge_and_apply (NMDevice *self,
NM_DEVICE_GET_CLASS (self)->ip4_config_pre_commit (self, composite);
}
- success = nm_device_set_ip4_config (self, composite, commit, out_reason);
+ success = nm_device_set_ip4_config (self, composite, default_route_metric, commit, out_reason);
g_object_unref (composite);
return success;
}
@@ -5572,6 +5574,7 @@ nm_device_get_ip4_config (NMDevice *self)
static gboolean
nm_device_set_ip4_config (NMDevice *self,
NMIP4Config *new_config,
+ guint32 default_route_metric,
gboolean commit,
NMDeviceStateReason *reason)
{
@@ -5592,8 +5595,9 @@ nm_device_set_ip4_config (NMDevice *self,
old_config = priv->ip4_config;
/* Always commit to nm-platform to update lifetimes */
- if (commit && new_config) {
- success = nm_ip4_config_commit (new_config, ip_ifindex);
+ if ( commit && new_config
+ && !nm_device_uses_assumed_connection (self)) {
+ success = nm_ip4_config_commit (new_config, ip_ifindex, default_route_metric);
if (!success)
reason_local = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
}
@@ -6960,7 +6964,7 @@ _cleanup_generic_post (NMDevice *self, gboolean deconfigure)
/* Clean up IP configs; this does not actually deconfigure the
* interface; the caller must flush routes and addresses explicitly.
*/
- nm_device_set_ip4_config (self, NULL, TRUE, &ignored);
+ nm_device_set_ip4_config (self, NULL, 0, TRUE, &ignored);
nm_device_set_ip6_config (self, NULL, TRUE, &ignored);
g_clear_object (&priv->dev_ip4_config);
g_clear_object (&priv->ext_ip4_config);
diff --git a/src/nm-default-route-manager.c b/src/nm-default-route-manager.c
index ca9df7b59c..9ca61dd9c8 100644
--- a/src/nm-default-route-manager.c
+++ b/src/nm-default-route-manager.c
@@ -229,6 +229,7 @@ _platform_route_sync_add (const VTableIP *vtable, NMDefaultRouteManager *self, g
0,
0,
entry->route.r4.gateway,
+ 0,
entry->effective_metric,
entry->route.rx.mss);
} else {
diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c
index 5e5de1f71f..9b44f8391d 100644
--- a/src/nm-iface-helper.c
+++ b/src/nm-iface-helper.c
@@ -80,7 +80,7 @@ dhcp4_state_changed (NMDhcpClient *client,
nm_ip4_config_subtract (existing, last_config);
nm_ip4_config_merge (existing, ip4_config);
- if (!nm_ip4_config_commit (existing, ifindex))
+ if (!nm_ip4_config_commit (existing, ifindex, 0))
nm_log_warn (LOGD_DHCP4, "(%s): failed to apply DHCPv4 config", ifname);
if (last_config) {
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index 7b4ca19c8b..ee5d93d134 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -253,7 +253,7 @@ nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf)
}
gboolean
-nm_ip4_config_commit (const NMIP4Config *config, int ifindex)
+nm_ip4_config_commit (const NMIP4Config *config, int ifindex, guint32 default_route_metric)
{
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
guint32 mtu = nm_ip4_config_get_mtu (config);
@@ -263,7 +263,7 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex)
g_return_val_if_fail (config != NULL, FALSE);
/* Addresses */
- nm_platform_ip4_address_sync (ifindex, priv->addresses);
+ nm_platform_ip4_address_sync (ifindex, priv->addresses, default_route_metric);
/* Routes */
{
diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h
index afdd8d09a2..5ac455d84f 100644
--- a/src/nm-ip4-config.h
+++ b/src/nm-ip4-config.h
@@ -64,7 +64,7 @@ const char * nm_ip4_config_get_dbus_path (const NMIP4Config *config);
/* Integration with nm-platform and nm-setting */
NMIP4Config *nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf);
-gboolean nm_ip4_config_commit (const NMIP4Config *config, int ifindex);
+gboolean nm_ip4_config_commit (const NMIP4Config *config, int ifindex, guint32 default_route_metric);
void nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIPConfig *setting, guint32 default_route_metric);
NMSetting *nm_ip4_config_create_setting (const NMIP4Config *config);
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index bf0c9c4cd2..533b7a5e4a 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -1045,7 +1045,7 @@ ip6_route_get_all (NMPlatform *platform, int ifindex, NMPlatformGetRouteMode mod
static gboolean
ip4_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
in_addr_t network, int plen, in_addr_t gateway,
- guint32 metric, guint32 mss)
+ guint32 pref_src, guint32 metric, guint32 mss)
{
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform);
NMPlatformIP4Route route;
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 007e7953b2..9da5475647 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -3735,6 +3735,7 @@ clear_host_address (int family, const void *network, int plen, void *dst)
static struct nl_object *
build_rtnl_route (int family, int ifindex, NMIPConfigSource source,
gconstpointer network, int plen, gconstpointer gateway,
+ gconstpointer pref_src,
guint32 metric, guint32 mss)
{
guint32 network_clean[4];
@@ -3744,6 +3745,7 @@ build_rtnl_route (int family, int ifindex, NMIPConfigSource source,
/* Workaround a libnl bug by using zero destination address length for default routes */
auto_nl_addr struct nl_addr *dst = NULL;
auto_nl_addr struct nl_addr *gw = gateway ? _nm_nl_addr_build (family, gateway, addrlen) : NULL;
+ auto_nl_addr struct nl_addr *pref_src_nl = pref_src ? _nm_nl_addr_build (family, pref_src, addrlen) : NULL;
/* There seem to be problems adding a route with non-zero host identifier.
* Adding IPv6 routes is simply ignored, without error message.
@@ -3765,6 +3767,8 @@ build_rtnl_route (int family, int ifindex, NMIPConfigSource source,
rtnl_route_nh_set_ifindex (nexthop, ifindex);
if (gw && !nl_addr_iszero (gw))
rtnl_route_nh_set_gateway (nexthop, gw);
+ if (pref_src_nl)
+ rtnl_route_set_pref_src (rtnlroute, pref_src_nl);
rtnl_route_add_nexthop (rtnlroute, nexthop);
if (mss > 0)
@@ -3776,9 +3780,9 @@ build_rtnl_route (int family, int ifindex, NMIPConfigSource source,
static gboolean
ip4_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
in_addr_t network, int plen, in_addr_t gateway,
- guint32 metric, guint32 mss)
+ guint32 pref_src, guint32 metric, guint32 mss)
{
- return add_object (platform, build_rtnl_route (AF_INET, ifindex, source, &network, plen, &gateway, metric, mss));
+ return add_object (platform, build_rtnl_route (AF_INET, ifindex, source, &network, plen, &gateway, pref_src ? &pref_src : NULL, metric, mss));
}
static gboolean
@@ -3786,7 +3790,7 @@ ip6_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source,
struct in6_addr network, int plen, struct in6_addr gateway,
guint32 metric, guint32 mss)
{
- return add_object (platform, build_rtnl_route (AF_INET6, ifindex, source, &network, plen, &gateway, metric, mss));
+ return add_object (platform, build_rtnl_route (AF_INET6, ifindex, source, &network, plen, &gateway, NULL, metric, mss));
}
static struct rtnl_route *
@@ -3843,7 +3847,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, NM_IP_CONFIG_SOURCE_UNKNOWN, &network, plen, &gateway, metric, 0);
+ struct nl_object *route = build_rtnl_route (AF_INET, ifindex, NM_IP_CONFIG_SOURCE_UNKNOWN, &network, plen, &gateway, NULL, metric, 0);
uint8_t scope = RT_SCOPE_NOWHERE;
struct nl_cache *cache;
@@ -3903,7 +3907,7 @@ 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, NM_IP_CONFIG_SOURCE_UNKNOWN ,&network, plen, &gateway, metric, 0), FALSE) &&
+ return delete_object (platform, build_rtnl_route (AF_INET6, ifindex, NM_IP_CONFIG_SOURCE_UNKNOWN ,&network, plen, &gateway, NULL, metric, 0), FALSE) &&
refresh_route (platform, AF_INET6, ifindex, &network, plen, metric);
}
@@ -3912,7 +3916,7 @@ ip_route_exists (NMPlatform *platform, int family, int ifindex, gpointer network
{
auto_nl_object struct nl_object *object = build_rtnl_route (family, ifindex,
NM_IP_CONFIG_SOURCE_UNKNOWN,
- network, plen, NULL, metric, 0);
+ network, plen, NULL, 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 70c7e1f960..02a2a94fed 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1736,6 +1736,8 @@ _address_get_lifetime (const NMPlatformIPAddress *address, guint32 now, guint32
* nm_platform_ip4_address_sync:
* @ifindex: Interface index
* @known_addresses: List of addresses
+ * @route_metric: the route metric for adding subnet routes (overwrites
+ * the kernel added routes).
*
* A convenience function to synchronize addresses for a specific interface
* with the least possible disturbance. It simply removes addresses that are
@@ -1744,12 +1746,13 @@ _address_get_lifetime (const NMPlatformIPAddress *address, guint32 now, guint32
* Returns: %TRUE on success.
*/
gboolean
-nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses)
+nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses, guint32 route_metric)
{
GArray *addresses;
NMPlatformIP4Address *address;
guint32 now = nm_utils_get_monotonic_timestamp_s ();
int i;
+ const guint32 METRIC_KERNEL_ROUTE = 0;
/* Delete unknown addresses */
addresses = nm_platform_ip4_address_get_all (ifindex);
@@ -1768,6 +1771,7 @@ nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses)
for (i = 0; i < known_addresses->len; i++) {
const NMPlatformIP4Address *known_address = &g_array_index (known_addresses, NMPlatformIP4Address, i);
guint32 lifetime, preferred;
+ guint32 network;
/* add a padding of 5 seconds to avoid potential races. */
if (!_address_get_lifetime ((NMPlatformIPAddress *) known_address, now, 5, &lifetime, &preferred))
@@ -1775,6 +1779,18 @@ nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses)
if (!nm_platform_ip4_address_add (ifindex, known_address->address, known_address->peer_address, known_address->plen, lifetime, preferred, known_address->label))
return FALSE;
+
+ if (known_address->plen == 0)
+ continue;
+
+ if (route_metric == METRIC_KERNEL_ROUTE) {
+ /* Kernel already adds routes for us with this metric. */
+ continue;
+ }
+
+ network = nm_utils_ip4_address_clear_host_address (known_address->address, known_address->plen);
+ nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_KERNEL, network, known_address->plen, 0, known_address->address, route_metric, 0);
+ nm_platform_ip4_route_delete (ifindex, network, known_address->plen, METRIC_KERNEL_ROUTE);
}
return TRUE;
@@ -1837,7 +1853,7 @@ nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses)
gboolean
nm_platform_address_flush (int ifindex)
{
- return nm_platform_ip4_address_sync (ifindex, NULL)
+ return nm_platform_ip4_address_sync (ifindex, NULL, 0)
&& nm_platform_ip6_address_sync (ifindex, NULL);
}
@@ -1868,7 +1884,8 @@ nm_platform_ip6_route_get_all (int ifindex, NMPlatformGetRouteMode mode)
gboolean
nm_platform_ip4_route_add (int ifindex, NMIPConfigSource source,
in_addr_t network, int plen,
- in_addr_t gateway, guint32 metric, guint32 mss)
+ in_addr_t gateway, guint32 pref_src,
+ guint32 metric, guint32 mss)
{
reset_error ();
@@ -1878,6 +1895,7 @@ nm_platform_ip4_route_add (int ifindex, NMIPConfigSource source,
if (nm_logging_enabled (LOGL_DEBUG, LOGD_PLATFORM)) {
NMPlatformIP4Route route = { 0 };
+ char pref_src_buf[NM_UTILS_INET_ADDRSTRLEN];
route.ifindex = ifindex;
route.source = source;
@@ -1887,9 +1905,12 @@ nm_platform_ip4_route_add (int ifindex, NMIPConfigSource source,
route.metric = metric;
route.mss = mss;
- debug ("route: adding or updating IPv4 route: %s", nm_platform_ip4_route_to_string (&route));
+ debug ("route: adding or updating IPv4 route: %s%s%s%s", nm_platform_ip4_route_to_string (&route),
+ pref_src?" (src: ":"",
+ pref_src?nm_utils_inet4_ntop (pref_src, pref_src_buf):"",
+ pref_src?")":"");
}
- return klass->ip4_route_add (platform, ifindex, source, network, plen, gateway, metric, mss);
+ return klass->ip4_route_add (platform, ifindex, source, network, plen, gateway, pref_src, metric, mss);
}
gboolean
@@ -2066,6 +2087,7 @@ nm_platform_ip4_route_sync (int ifindex, const GArray *known_routes)
known_route->network,
known_route->plen,
known_route->gateway,
+ 0,
known_route->metric,
known_route->mss);
if (!success && known_route->source < NM_IP_CONFIG_SOURCE_USER) {
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 34ed384af7..c3cb3252ec 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -417,7 +417,7 @@ typedef struct {
GArray * (*ip6_route_get_all) (NMPlatform *, int ifindex, NMPlatformGetRouteMode mode);
gboolean (*ip4_route_add) (NMPlatform *, int ifindex, NMIPConfigSource source,
in_addr_t network, int plen, in_addr_t gateway,
- guint32 metric, guint32 mss);
+ guint32 pref_src, guint32 metric, guint32 mss);
gboolean (*ip6_route_add) (NMPlatform *, int ifindex, NMIPConfigSource source,
struct in6_addr network, int plen, struct in6_addr gateway,
guint32 metric, guint32 mss);
@@ -556,7 +556,7 @@ gboolean nm_platform_ip4_address_delete (int ifindex, in_addr_t address, int ple
gboolean nm_platform_ip6_address_delete (int ifindex, struct in6_addr address, int plen);
gboolean nm_platform_ip4_address_exists (int ifindex, in_addr_t address, int plen);
gboolean nm_platform_ip6_address_exists (int ifindex, struct in6_addr address, int plen);
-gboolean nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses);
+gboolean nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses, guint32 route_metric);
gboolean nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses);
gboolean nm_platform_address_flush (int ifindex);
@@ -564,7 +564,7 @@ GArray *nm_platform_ip4_route_get_all (int ifindex, NMPlatformGetRouteMode mode)
GArray *nm_platform_ip6_route_get_all (int ifindex, NMPlatformGetRouteMode mode);
gboolean nm_platform_ip4_route_add (int ifindex, NMIPConfigSource source,
in_addr_t network, int plen, in_addr_t gateway,
- guint32 metric, guint32 mss);
+ guint32 pref_src, guint32 metric, guint32 mss);
gboolean nm_platform_ip6_route_add (int ifindex, NMIPConfigSource source,
struct in6_addr network, int plen, struct in6_addr gateway,
guint32 metric, guint32 mss);
diff --git a/src/platform/tests/platform.c b/src/platform/tests/platform.c
index a4b10a1830..eea6610d37 100644
--- a/src/platform/tests/platform.c
+++ b/src/platform/tests/platform.c
@@ -684,7 +684,7 @@ do_ip4_route_add (char **argv)
mss = strtol (*argv++, NULL, 10);
return nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER,
- network, plen, gateway,
+ network, plen, gateway, 0,
metric, mss);
}
diff --git a/src/platform/tests/test-cleanup.c b/src/platform/tests/test-cleanup.c
index c15f0c14e2..afbb438cca 100644
--- a/src/platform/tests/test-cleanup.c
+++ b/src/platform/tests/test-cleanup.c
@@ -45,9 +45,9 @@ test_cleanup_internal (void)
/* 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, NM_IP_CONFIG_SOURCE_USER, gateway4, 32, INADDR_ANY, metric, mss));
- g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network4, plen4, gateway4, metric, mss));
- g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway4, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, gateway4, 32, INADDR_ANY, 0, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network4, plen4, gateway4, 0, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway4, 0, metric, mss));
g_assert (nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, gateway6, 128, in6addr_any, metric, mss));
g_assert (nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network6, plen6, gateway6, metric, mss));
g_assert (nm_platform_ip6_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, in6addr_any, 0, gateway6, metric, mss));
diff --git a/src/platform/tests/test-route.c b/src/platform/tests/test-route.c
index 7a7e5a8116..ea238f5d6c 100644
--- a/src/platform/tests/test-route.c
+++ b/src/platform/tests/test-route.c
@@ -68,35 +68,35 @@ test_ip4_route (void)
inet_pton (AF_INET, "198.51.100.1", &gateway);
/* Add route to gateway */
- g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, gateway, 32, INADDR_ANY, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, gateway, 32, INADDR_ANY, 0, 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, NM_IP_CONFIG_SOURCE_USER, network, plen, gateway, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, gateway, 0, 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, NM_IP_CONFIG_SOURCE_USER, network, plen, gateway, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, gateway, 0, 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, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway, 0, 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, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway, metric, mss));
+ g_assert (nm_platform_ip4_route_add (ifindex, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway, 0, metric, mss));
no_error ();
accept_signal (route_changed);
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index 682e1dc5b7..7e3a691ec2 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -941,7 +941,8 @@ nm_vpn_connection_apply_config (NMVpnConnection *connection)
nm_platform_link_set_up (priv->ip_ifindex);
if (priv->ip4_config) {
- if (!nm_ip4_config_commit (priv->ip4_config, priv->ip_ifindex))
+ if (!nm_ip4_config_commit (priv->ip4_config, priv->ip_ifindex,
+ nm_vpn_connection_get_ip4_route_metric (connection)))
return FALSE;
}