summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-07-10 18:56:41 +0200
committerThomas Haller <thaller@redhat.com>2015-07-13 13:39:34 +0200
commit1465c1d3260712fbe2fd0c78c7a1fcf0fb8ce753 (patch)
tree28629688d3c2f825dc9ca68b39b5ce6a7a90acfc
parent5cd131610088c3b54fde02aa1ecd06ce69fbb2a8 (diff)
downloadNetworkManager-1465c1d3260712fbe2fd0c78c7a1fcf0fb8ce753.tar.gz
vpn: fix overwriting gateway of parent device for non-tunnel based VPNs
For non-tunnel based VPNs (openswan, libreswan), we must clear the gateway setting. The default route is managed by NMDefaultRouteManager, and we must not overwrite the gateway of the parent device. This fixes a bug if the VPN connection specifies a gateway, it would have overwritten the gateway of the underlying device.
-rw-r--r--src/vpn-manager/nm-vpn-connection.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index f3ff541c9c..47879f2a6f 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -891,10 +891,17 @@ apply_parent_device_config (NMVpnConnection *connection)
* be done on the parent interface instead.
*/
- if (vpn4_parent_config)
+ /* Also clear the gateway. We don't configure the gateway as part of the
+ * vpn-config. Instead we tell NMDefaultRouteManager directly about the
+ * default route. */
+ if (vpn4_parent_config) {
nm_ip4_config_merge (vpn4_parent_config, priv->ip4_config);
- if (vpn6_parent_config)
+ nm_ip4_config_set_gateway (vpn4_parent_config, 0);
+ }
+ if (vpn6_parent_config) {
nm_ip6_config_merge (vpn6_parent_config, priv->ip6_config);
+ nm_ip6_config_set_gateway (vpn6_parent_config, NULL);
+ }
}
if (vpn4_parent_config) {