From 3210bb93a10303ee701d2f2eea96855c57ccfce8 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 26 Nov 2014 17:58:29 +0100 Subject: [PATCH] vpn: don't choose route priority for VPN connections based on the parent device The parent device is just the device that happens to be the best device. It does not mean, that its route metric should be inherited to the VPN connection. This also makes the resulting route metric for VPN connections much more predictable: now it is either ipv4.route-metric from the connection, or it falls back to NM_VPN_ROUTE_METRIC_DEFAULT (10). --- src/vpn-manager/nm-vpn-connection.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index adb287cb04..cb07c7f9ad 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -1123,7 +1123,6 @@ nm_vpn_connection_config_get (DBusGProxy *proxy, guint32 nm_vpn_connection_get_ip4_route_metric (NMVpnConnection *connection) { - NMDevice *parent_dev; NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection); if (priv->connection) { @@ -1133,17 +1132,12 @@ nm_vpn_connection_get_ip4_route_metric (NMVpnConnection *connection) return route_metric; } - if ( priv->ip_ifindex - || !(parent_dev = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (connection)))) - return NM_VPN_ROUTE_METRIC_DEFAULT; - - return nm_device_get_ip4_route_metric (parent_dev); + return NM_VPN_ROUTE_METRIC_DEFAULT; } guint32 nm_vpn_connection_get_ip6_route_metric (NMVpnConnection *connection) { - NMDevice *parent_dev; NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection); if (priv->connection) { @@ -1153,11 +1147,7 @@ nm_vpn_connection_get_ip6_route_metric (NMVpnConnection *connection) return route_metric; } - if ( priv->ip_ifindex - || !(parent_dev = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (connection)))) - return NM_VPN_ROUTE_METRIC_DEFAULT; - - return nm_device_get_ip6_route_metric (parent_dev); + return NM_VPN_ROUTE_METRIC_DEFAULT; } static void