summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-11-26 00:18:48 +0100
committerThomas Haller <thaller@redhat.com>2014-11-26 00:18:49 +0100
commitf32075d2fc11252e5661166b2f46c18c017929e9 (patch)
treece5bf0af410b2445d4db997661532711ca76b38e
parentad73a7a1e9035fb30c8a5c03143ef1c41da90f6f (diff)
parent5dfad33823d6ccbf1fa10a4e808fb84d33861639 (diff)
downloadNetworkManager-f32075d2fc11252e5661166b2f46c18c017929e9.tar.gz
core: merge branch 'th/bgo723178_device_route_metric'
https://bugzilla.gnome.org/show_bug.cgi?id=723178
-rw-r--r--src/devices/nm-device.c18
-rw-r--r--src/nm-default-route-manager.c1
-rw-r--r--src/nm-iface-helper.c9
-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.c44
-rw-r--r--src/platform/nm-platform.h10
-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, 90 insertions, 37 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 8e7e710d2e..5e2a0803fb 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,
@@ -2782,6 +2783,7 @@ ip4_config_merge_and_apply (NMDevice *self,
NMConnection *connection;
gboolean success;
NMIP4Config *composite;
+ const guint32 default_route_metric = nm_device_get_ip4_route_metric (self);
/* Merge all the configs into the composite config */
if (config) {
@@ -2817,7 +2819,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.
@@ -2848,7 +2850,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;
@@ -2878,7 +2880,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;
}
@@ -5602,6 +5604,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)
{
@@ -5623,7 +5626,12 @@ nm_device_set_ip4_config (NMDevice *self,
/* Always commit to nm-platform to update lifetimes */
if (commit && new_config) {
- success = nm_ip4_config_commit (new_config, ip_ifindex);
+ gboolean assumed = nm_device_uses_assumed_connection (self);
+
+ /* for assumed devices we set the device_route_metric to the default which will
+ * stop nm_platform_ip4_address_sync() to replace the device routes. */
+ success = nm_ip4_config_commit (new_config, ip_ifindex,
+ assumed ? NM_PLATFORM_ROUTE_METRIC_IP4_DEVICE_ROUTE : default_route_metric);
if (!success)
reason_local = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
}
@@ -6994,7 +7002,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 4dec5853dd..5cc1bcd2b5 100644
--- a/src/nm-default-route-manager.c
+++ b/src/nm-default-route-manager.c
@@ -256,6 +256,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..4d62c9c0ec 100644
--- a/src/nm-iface-helper.c
+++ b/src/nm-iface-helper.c
@@ -56,7 +56,7 @@ static int ifindex = -1;
static gboolean slaac_required = FALSE;
static gboolean dhcp4_required = FALSE;
static int tempaddr = NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN;
-static int priority = -1;
+static guint32 priority;
static void
dhcp4_state_changed (NMDhcpClient *client,
@@ -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, priority))
nm_log_warn (LOGD_DHCP4, "(%s): failed to apply DHCPv4 config", ifname);
if (last_config) {
@@ -287,6 +287,7 @@ main (int argc, char *argv[])
size_t hwaddr_len = 0;
gconstpointer tmp;
gs_free NMUtilsIPv6IfaceId *iid = NULL;
+ gint64 priority64 = -1;
GOptionEntry options[] = {
/* Interface/IP config */
@@ -299,7 +300,7 @@ main (int argc, char *argv[])
{ "dhcp4-required", '4', 0, G_OPTION_ARG_NONE, &dhcp4_required, N_("Whether DHCPv4 must be successful"), NULL },
{ "dhcp4-clientid", 'c', 0, G_OPTION_ARG_STRING, &dhcp4_clientid, N_("Hex-encoded DHCPv4 client ID"), NULL },
{ "dhcp4-hostname", 'h', 0, G_OPTION_ARG_STRING, &dhcp4_hostname, N_("Hostname to send to DHCP server"), N_("barbar") },
- { "priority", 'p', 0, G_OPTION_ARG_INT, &priority, N_("Route priority"), N_("10") },
+ { "priority", 'p', 0, G_OPTION_ARG_INT64, &priority64, N_("Route priority"), N_("10") },
{ "iid", 'e', 0, G_OPTION_ARG_STRING, &iid_str, N_("Hex-encoded Interface Identifier"), N_("") },
/* Logging/debugging */
@@ -417,7 +418,7 @@ main (int argc, char *argv[])
iid = g_bytes_unref_to_data (bytes, &ignored);
}
- priority = MAX (0, priority);
+ priority = (guint32) CLAMP (priority64, 0, G_MAXUINT32);
if (dhcp4_address) {
nm_platform_sysctl_set (nm_utils_ip4_property_path (ifname, "promote_secondaries"), "1");
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index 63336711d1..fd46678026 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -251,7 +251,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);
@@ -261,7 +261,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 391f1758db..954edec3b7 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..7433ccd186 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
+ * @device_route_metric: the route metric for adding subnet routes (replaces
+ * 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,7 +1746,7 @@ _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 device_route_metric)
{
GArray *addresses;
NMPlatformIP4Address *address;
@@ -1768,6 +1770,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 +1778,31 @@ 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 || known_address->plen == 32)
+ continue;
+
+ if (device_route_metric == NM_PLATFORM_ROUTE_METRIC_IP4_DEVICE_ROUTE) {
+ /* Kernel already adds routes for us with this metric. */
+ continue;
+ }
+
+ /* Kernel automatically adds a device route for us with metric 0. That is not what we want.
+ * Remove it, and re-add it.
+ *
+ * In face of having the same subnets on two different interfaces with the same metric,
+ * this is a problem. Surprisingly, kernel is able to add two routes for the same subnet/prefix,metric
+ * to different interfaces. We cannot. Adding one, will replace the other. Indeed we will
+ * toggle the routes between the interfaces.
+ *
+ * Indeed we have that problem for all our routes, that if another interface wants the same route
+ * we don't coordinate them. See bug 740064.
+ *
+ * The workaround is to configure different device priorities via ipv4.route-metric. */
+
+ 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, device_route_metric, 0);
+ nm_platform_ip4_route_delete (ifindex, network, known_address->plen, NM_PLATFORM_ROUTE_METRIC_IP4_DEVICE_ROUTE);
}
return TRUE;
@@ -1837,7 +1865,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 +1896,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 +1907,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 +1917,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 +2099,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..12198c79f4 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -188,6 +188,10 @@ typedef union {
* Thus, the value is not choosen arbitraily, but matches kernel IPv6 default. */
#define NM_PLATFORM_ROUTE_METRIC_DEFAULT 1024
+/* For IPv4, kernel adds a device route (subnet routes) with metric 0 when user
+ * configures addresses. */
+#define NM_PLATFORM_ROUTE_METRIC_IP4_DEVICE_ROUTE 0
+
#define __NMPlatformIPRoute_COMMON \
__NMPlatformObject_COMMON; \
NMIPConfigSource source; \
@@ -417,7 +421,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 +560,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 device_route_metric);
gboolean nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses);
gboolean nm_platform_address_flush (int ifindex);
@@ -564,7 +568,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 be1ce60f93..adb287cb04 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -936,7 +936,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;
}