summaryrefslogtreecommitdiff
path: root/src/vpn/nm-vpn-connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpn/nm-vpn-connection.c')
-rw-r--r--src/vpn/nm-vpn-connection.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c
index d19007c1e0..1ace03ae35 100644
--- a/src/vpn/nm-vpn-connection.c
+++ b/src/vpn/nm-vpn-connection.c
@@ -741,8 +741,9 @@ add_ip4_vpn_gateway_route (NMIP4Config *config,
* In which case, it pretends the destination is directly reachable.
*
* So, only accept direct routes, if @vpn_gw is a private network. */
- if ( r->gateway
- || nm_utils_ip_is_site_local (AF_INET, &vpn_gw)) {
+ if ( nm_platform_route_table_is_main (r->table_coerced)
+ && ( r->gateway
+ || nm_utils_ip_is_site_local (AF_INET, &vpn_gw))) {
parent_gw = r->gateway;
has_parent_gw = TRUE;
}
@@ -1472,6 +1473,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
NMPlatformIP4Address address;
NMIP4Config *config;
guint32 u32, route_metric;
+ guint32 route_table;
GVariantIter *iter;
const char *str;
GVariant *v;
@@ -1571,6 +1573,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
g_variant_iter_free (iter);
}
+ route_table = get_route_table (self, AF_INET, TRUE);
route_metric = nm_vpn_connection_get_ip4_route_metric (self);
if ( g_variant_lookup (dict, NM_VPN_PLUGIN_IP4_CONFIG_PRESERVE_ROUTES, "b", &b)
@@ -1596,6 +1599,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
g_variant_get_child (v, 1, "u", &plen);
g_variant_get_child (v, 2, "u", &route.gateway);
/* 4th item is unused route metric */
+ route.table_coerced = nm_platform_route_table_coerce (route_table);
route.metric = route_metric;
route.rt_source = NM_IP_CONFIG_SOURCE_VPN;
@@ -1626,7 +1630,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
/* Merge in user overrides from the NMConnection's IPv4 setting */
nm_ip4_config_merge_setting (config,
nm_connection_get_setting_ip4_config (_get_applied_connection (self)),
- get_route_table (self, AF_INET, TRUE),
+ route_table,
route_metric);
if (!nm_ip4_config_get_never_default (config)) {
@@ -1634,6 +1638,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
.ifindex = ip_ifindex,
.rt_source = NM_IP_CONFIG_SOURCE_VPN,
.gateway = nm_ip4_config_get_gateway (config),
+ .table_coerced = nm_platform_route_table_coerce (route_table),
.metric = route_metric,
.mss = nm_ip4_config_get_mss (config),
};
@@ -1644,6 +1649,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
g_clear_pointer (&priv->ip4_dev_route_blacklist, g_ptr_array_unref);
nm_ip4_config_add_device_routes (config,
+ route_table,
nm_vpn_connection_get_ip4_route_metric (self),
&priv->ip4_dev_route_blacklist);