about summary refs log tree commit diff
path: root/src/vpn
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2020-05-08 21:41:46 +0200
committerMichael Biebl <biebl@debian.org>2020-05-08 21:41:46 +0200
commit14a437f08bfacbdbe3ed3d4e36dcf8a199df8e9e (patch)
tree036108c3f080f94e794f52be66cc2bab2158486e /src/vpn
parent9df39b936fcb2f3d27ff7e653e645c16900807e3 (diff)
parentd460892bbfece74fb6d3cd846bf6ef548290be41 (diff)
Update upstream source from tag 'upstream/1.24.0'
Update to upstream version '1.24.0'
with Debian dir 36f1778d11d8b638b63bd623816627ac76cb75ee
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/nm-vpn-connection.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c
index 35bf4afb..6d995dc4 100644
--- a/src/vpn/nm-vpn-connection.c
+++ b/src/vpn/nm-vpn-connection.c
@@ -1595,13 +1595,18 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
 				route.plen = plen;
 				route.network = nm_utils_ip4_address_clear_host_address (route.network, plen);
 
-				/* Ignore host routes to the VPN gateway since NM adds one itself
-				 * below.  Since NM knows more about the routing situation than
-				 * the VPN server, we want to use the NM created route instead of
-				 * whatever the server provides.
-				 */
-				if (!(priv->ip4_external_gw && route.network == priv->ip4_external_gw && route.plen == 32))
-					nm_ip4_config_add_route (config, &route, NULL);
+				if (   priv->ip4_external_gw
+				    && route.network == priv->ip4_external_gw
+				    && route.plen == 32) {
+					/* Ignore host routes to the VPN gateway since NM adds one itself
+					 * below.  Since NM knows more about the routing situation than
+					 * the VPN server, we want to use the NM created route instead of
+					 * whatever the server provides.
+					 */
+					break;
+				}
+
+				nm_ip4_config_add_route (config, &route, NULL);
 				break;
 			default:
 				break;
@@ -1790,13 +1795,20 @@ nm_vpn_connection_ip6_config_get (NMVpnConnection *self, GVariant *dict)
 			route.metric = route_metric;
 			route.rt_source = NM_IP_CONFIG_SOURCE_VPN;
 
-			/* Ignore host routes to the VPN gateway since NM adds one itself.
-			 * Since NM knows more about the routing situation than the VPN
-			 * server, we want to use the NM created route instead of whatever
-			 * the server provides.
-			 */
-			if (!(priv->ip6_external_gw && IN6_ARE_ADDR_EQUAL (&route.network, priv->ip6_external_gw) && route.plen == 128))
-				nm_ip6_config_add_route (config, &route, NULL);
+			nm_utils_ip6_address_clear_host_address (&route.network, &route.network, route.plen);
+
+			if (   priv->ip6_external_gw
+			    && IN6_ARE_ADDR_EQUAL (&route.network, priv->ip6_external_gw)
+			    && route.plen == 128) {
+				/* Ignore host routes to the VPN gateway since NM adds one itself.
+				 * Since NM knows more about the routing situation than the VPN
+				 * server, we want to use the NM created route instead of whatever
+				 * the server provides.
+				 */
+				goto next;
+			}
+
+			nm_ip6_config_add_route (config, &route, NULL);
 
 next:
 			g_variant_unref (dest);