Blame SOURCES/0007-wwan-default-device-route-rh1527934.patch

c48088
From 19ba1a19f4d3261e47420deb2882d8533bdbc5d8 Mon Sep 17 00:00:00 2001
c48088
From: Beniamino Galvani <bgalvani@redhat.com>
c48088
Date: Wed, 20 Dec 2017 13:53:56 +0100
c48088
Subject: [PATCH 1/3] wwan: fix checks on IP configuration
c48088
c48088
Don't call nm_utils_parse_inaddr_bin() if the string returned by
c48088
mm_bearer_ip_config_get_address() and mm_bearer_ip_config_get_gateway()
c48088
is NULL, as the function requires a valid pointer. Throw an error if the
c48088
address is NULL, but allow an empty gateway.
c48088
c48088
Fixes: 7837afe87f0f269c0cc4de1c9c217529d760e83b
c48088
(cherry picked from commit 8ddc6caf98e2c4f1e796f50cdbeee567aba9be9d)
c48088
(cherry picked from commit f4dc5bd782e709c541174aac3fd3a160ca5f53ba)
c48088
---
c48088
 src/devices/wwan/nm-modem-broadband.c | 15 ++++++++-------
c48088
 1 file changed, 8 insertions(+), 7 deletions(-)
c48088
c48088
diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
c48088
index 6e5f10a06..9fc147da9 100644
c48088
--- a/src/devices/wwan/nm-modem-broadband.c
c48088
+++ b/src/devices/wwan/nm-modem-broadband.c
c48088
@@ -883,24 +883,25 @@ static_stage3_ip4_done (NMModemBroadband *self)
c48088
 
c48088
 	/* Fully fail if invalid IP address retrieved */
c48088
 	address_string = mm_bearer_ip_config_get_address (self->_priv.ipv4_config);
c48088
-	if (!nm_utils_parse_inaddr_bin (AF_INET, address_string, &address_network)) {
c48088
+	if (   !address_string
c48088
+	    || !nm_utils_parse_inaddr_bin (AF_INET, address_string, &address_network)) {
c48088
 		error = g_error_new (NM_DEVICE_ERROR,
c48088
 		                     NM_DEVICE_ERROR_INVALID_CONNECTION,
c48088
-		                     "(%s) retrieving IP4 configuration failed: invalid address given '%s'",
c48088
+		                     "(%s) retrieving IP4 configuration failed: invalid address given %s%s%s",
c48088
 		                     nm_modem_get_uid (NM_MODEM (self)),
c48088
-		                     address_string);
c48088
+		                     NM_PRINT_FMT_QUOTE_STRING (address_string));
c48088
 		goto out;
c48088
 	}
c48088
 
c48088
 	/* Missing gateway not a hard failure */
c48088
 	gw_string = mm_bearer_ip_config_get_gateway (self->_priv.ipv4_config);
c48088
-	if (   !gw_string
c48088
-	    || !nm_utils_parse_inaddr_bin (AF_INET, gw_string, &gw)) {
c48088
+	if (   gw_string
c48088
+	    && !nm_utils_parse_inaddr_bin (AF_INET, gw_string, &gw)) {
c48088
 		error = g_error_new (NM_DEVICE_ERROR,
c48088
 		                     NM_DEVICE_ERROR_INVALID_CONNECTION,
c48088
-		                     "(%s) retrieving IP4 configuration failed: invalid gateway address %s%s%s",
c48088
+		                     "(%s) retrieving IP4 configuration failed: invalid gateway address \"%s\"",
c48088
 		                     nm_modem_get_uid (NM_MODEM (self)),
c48088
-		                     NM_PRINT_FMT_QUOTE_STRING (gw_string));
c48088
+		                     gw_string);
c48088
 		goto out;
c48088
 	}
c48088
 
c48088
-- 
c48088
2.14.3
c48088
c48088
From 0be2bf3ca528a02237665b3c34ac00e6a6a89d7b Mon Sep 17 00:00:00 2001
c48088
From: Beniamino Galvani <bgalvani@redhat.com>
c48088
Date: Wed, 20 Dec 2017 14:26:57 +0100
c48088
Subject: [PATCH 2/3] wwan: add default route even if modem didn't return a
c48088
 gateway
c48088
c48088
If the modem didn't return a gateway, add a device route.
c48088
c48088
Fixes: 5c299454b49b165f645c25fd3e083c0bb747ad91
c48088
(cherry picked from commit ec32edb21f7b34064731c737594643a3b9bda337)
c48088
(cherry picked from commit d9512bc807f103fe891409629d1b17ff4594d9c4)
c48088
---
c48088
 src/devices/wwan/nm-modem-broadband.c | 34 +++++++++++++++-------------------
c48088
 1 file changed, 15 insertions(+), 19 deletions(-)
c48088
c48088
diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
c48088
index 9fc147da9..cd7c48ef3 100644
c48088
--- a/src/devices/wwan/nm-modem-broadband.c
c48088
+++ b/src/devices/wwan/nm-modem-broadband.c
c48088
@@ -875,6 +875,8 @@ static_stage3_ip4_done (NMModemBroadband *self)
c48088
 	NMPlatformIP4Address address;
c48088
 	const gchar **dns;
c48088
 	guint i;
c48088
+	guint32 ip4_route_table, ip4_route_metric;
c48088
+	NMPlatformIP4Route *r;
c48088
 
c48088
 	g_assert (self->_priv.ipv4_config);
c48088
 	g_assert (self->_priv.bearer);
c48088
@@ -920,26 +922,20 @@ static_stage3_ip4_done (NMModemBroadband *self)
c48088
 
c48088
 	_LOGI ("  address %s/%d", address_string, address.plen);
c48088
 
c48088
-	if (gw) {
c48088
-		guint32 ip4_route_table, ip4_route_metric;
c48088
 
c48088
-		nm_modem_get_route_parameters (NM_MODEM (self),
c48088
-		                               &ip4_route_table,
c48088
-		                               &ip4_route_metric,
c48088
-		                               NULL,
c48088
-		                               NULL);
c48088
-		{
c48088
-			const NMPlatformIP4Route r = {
c48088
-				.rt_source = NM_IP_CONFIG_SOURCE_WWAN,
c48088
-				.gateway = gw,
c48088
-				.table_coerced = nm_platform_route_table_coerce (ip4_route_table),
c48088
-				.metric = ip4_route_metric,
c48088
-			};
c48088
-
c48088
-			_LOGI ("  gateway %s", gw_string);
c48088
-			nm_ip4_config_add_route (config, &r, NULL);
c48088
-		}
c48088
-	}
c48088
+	nm_modem_get_route_parameters (NM_MODEM (self),
c48088
+	                               &ip4_route_table,
c48088
+	                               &ip4_route_metric,
c48088
+	                               NULL,
c48088
+	                               NULL);
c48088
+	r = &(NMPlatformIP4Route) {
c48088
+		.rt_source = NM_IP_CONFIG_SOURCE_WWAN,
c48088
+		.gateway = gw,
c48088
+		.table_coerced = nm_platform_route_table_coerce (ip4_route_table),
c48088
+		.metric = ip4_route_metric,
c48088
+	};
c48088
+	nm_ip4_config_add_route (config, r, NULL);
c48088
+	_LOGI ("  gateway %s", gw_string);
c48088
 
c48088
 	/* DNS servers */
c48088
 	dns = mm_bearer_ip_config_get_dns (self->_priv.ipv4_config);
c48088
-- 
c48088
2.14.3
c48088
c48088
From 345d3abb0ae2a322bc1a19c59c2a229a06657ce6 Mon Sep 17 00:00:00 2001
c48088
From: Beniamino Galvani <bgalvani@redhat.com>
c48088
Date: Wed, 20 Dec 2017 14:28:05 +0100
c48088
Subject: [PATCH 3/3] wwan: clear idle source id when the callback runs
c48088
c48088
Fixes: f0996d0eb82254ea794cf9607e4a9b4e2dc3d029
c48088
(cherry picked from commit 5d372fd30ea71e8f3e6bb8b77c1e7a680165a3ce)
c48088
(cherry picked from commit 4ca7e3d0cfb6a75b02e183b369bf2d35c38ca6a6)
c48088
---
c48088
 src/devices/wwan/nm-modem-broadband.c | 3 +++
c48088
 1 file changed, 3 insertions(+)
c48088
c48088
diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
c48088
index cd7c48ef3..dc0ce303c 100644
c48088
--- a/src/devices/wwan/nm-modem-broadband.c
c48088
+++ b/src/devices/wwan/nm-modem-broadband.c
c48088
@@ -881,6 +881,8 @@ static_stage3_ip4_done (NMModemBroadband *self)
c48088
 	g_assert (self->_priv.ipv4_config);
c48088
 	g_assert (self->_priv.bearer);
c48088
 
c48088
+	self->_priv.idle_id_ip4 = 0;
c48088
+
c48088
 	_LOGI ("IPv4 static configuration:");
c48088
 
c48088
 	/* Fully fail if invalid IP address retrieved */
c48088
@@ -986,6 +988,7 @@ stage3_ip6_done (NMModemBroadband *self)
c48088
 
c48088
 	g_assert (self->_priv.ipv6_config);
c48088
 
c48088
+	self->_priv.idle_id_ip6 = 0;
c48088
 	memset (&address, 0, sizeof (address));
c48088
 
c48088
 	ip_method = get_bearer_ip_method (self->_priv.ipv6_config);
c48088
-- 
c48088
2.14.3
c48088