diff options
author | Thomas Haller <thaller@redhat.com> | 2014-11-04 14:57:57 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-11-05 23:54:19 +0100 |
commit | 060d9711c1ed4651f40314c6cbf3a43e650274ae (patch) | |
tree | 780a505f6694ea54e2ae7c83c3bfcb85e4f17af9 | |
parent | fb806756fff2d4f40fb41fc6a71b23414f7fc60d (diff) | |
download | NetworkManager-060d9711c1ed4651f40314c6cbf3a43e650274ae.tar.gz |
fixup! core: overwrite the default route priority via connection setting
-rw-r--r-- | src/vpn-manager/nm-vpn-connection.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index 913266c4af..012d584269 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -1056,29 +1056,41 @@ 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->ip_ifindex) - return NM_PLATFORM_ROUTE_METRIC_DEFAULT; - else { - NMDevice *parent_dev = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (connection)); + if (priv->connection) { + gint64 route_metric = nm_setting_ip4_config_get_route_metric (nm_connection_get_setting_ip4_config (priv->connection)); - return nm_device_get_ip4_route_metric (parent_dev); + if (route_metric >= 0) + 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); } guint32 nm_vpn_connection_get_ip6_route_metric (NMVpnConnection *connection) { + NMDevice *parent_dev; NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection); - if (priv->ip_ifindex) - return NM_PLATFORM_ROUTE_METRIC_DEFAULT; - else { - NMDevice *parent_dev = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (connection)); + if (priv->connection) { + gint64 route_metric = nm_setting_ip6_config_get_route_metric (nm_connection_get_setting_ip6_config (priv->connection)); - return nm_device_get_ip6_route_metric (parent_dev); + if (route_metric >= 0) + 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); } static void |