summary refs log tree commit diff
path: root/src/vpn-manager
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2016-04-12 17:33:05 +0200
committerMichael Biebl <biebl@debian.org>2016-04-12 17:33:05 +0200
commit288a08a3672a89a9bfdb8354b6863cc039759fc2 (patch)
tree351ac159de25507ba7eeab003153dabb1c6652a2 /src/vpn-manager
parent2bfb3eb7d0323e69affca154395f51d8b577414d (diff)
Imported Upstream version 1.1.94 upstream/1.1.94
Diffstat (limited to 'src/vpn-manager')
-rw-r--r--src/vpn-manager/nm-vpn-connection.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index cbc7c69d..2945ad34 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -1387,11 +1387,11 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
 	if (g_variant_lookup (dict, NM_VPN_PLUGIN_IP4_CONFIG_PREFIX, "u", &u32))
 		address.plen = u32;
 
-	if (address.address && address.plen) {
+	if (address.address && address.plen && address.plen <= 32) {
 		address.source = NM_IP_CONFIG_SOURCE_VPN;
 		nm_ip4_config_add_address (config, &address);
 	} else {
-		_LOGE ("invalid IP4 config received!");
+		_LOGW ("invalid IP4 config received!");
 		g_object_unref (config);
 		nm_vpn_connection_config_maybe_complete (self, FALSE);
 		return;
@@ -1439,6 +1439,9 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
 				route.metric = route_metric;
 				route.source = NM_IP_CONFIG_SOURCE_VPN;
 
+				if (route.plen > 32)
+					break;
+
 				/* 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
@@ -1448,7 +1451,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
 					nm_ip4_config_add_route (config, &route);
 				break;
 			default:
-				_LOGW ("VPN connection: received invalid IPv4 route");
+				break;
 			}
 			g_variant_unref (v);
 		}
@@ -1521,11 +1524,11 @@ nm_vpn_connection_ip6_config_get (NMVpnConnection *self, GVariant *dict)
 	if (g_variant_lookup (dict, NM_VPN_PLUGIN_IP6_CONFIG_PREFIX, "u", &u32))
 		address.plen = u32;
 
-	if (!IN6_IS_ADDR_UNSPECIFIED (&address.address) && address.plen) {
+	if (!IN6_IS_ADDR_UNSPECIFIED (&address.address) && address.plen && address.plen <= 128) {
 		address.source = NM_IP_CONFIG_SOURCE_VPN;
 		nm_ip6_config_add_address (config, &address);
 	} else {
-		_LOGE ("invalid IP6 config received!");
+		_LOGW ("invalid IP6 config received!");
 		g_object_unref (config);
 		nm_vpn_connection_config_maybe_complete (self, FALSE);
 		return;
@@ -1565,10 +1568,11 @@ nm_vpn_connection_ip6_config_get (NMVpnConnection *self, GVariant *dict)
 
 			memset (&route, 0, sizeof (route));
 
-			if (!ip6_addr_from_variant (dest, &route.network)) {
-				_LOGW ("VPN connection: received invalid IPv6 dest address");
+			if (!ip6_addr_from_variant (dest, &route.network))
+				goto next;
+
+			if (prefix > 128)
 				goto next;
-			}
 
 			route.plen = prefix;
 			ip6_addr_from_variant (next_hop, &route.gateway);