summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-12-20 14:26:57 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-12-21 09:35:40 +0100
commitec32edb21f7b34064731c737594643a3b9bda337 (patch)
tree8e62969a6f950b2833b562d80f85ae734f055580
parent8ddc6caf98e2c4f1e796f50cdbeee567aba9be9d (diff)
downloadNetworkManager-ec32edb21f7b34064731c737594643a3b9bda337.tar.gz
wwan: add default route even if modem didn't return a gateway
If the modem didn't return a gateway, add a device route. Fixes: 5c299454b49b165f645c25fd3e083c0bb747ad91
-rw-r--r--src/devices/wwan/nm-modem-broadband.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
index 9fc147da93..cd7c48ef3c 100644
--- a/src/devices/wwan/nm-modem-broadband.c
+++ b/src/devices/wwan/nm-modem-broadband.c
@@ -875,6 +875,8 @@ static_stage3_ip4_done (NMModemBroadband *self)
NMPlatformIP4Address address;
const gchar **dns;
guint i;
+ guint32 ip4_route_table, ip4_route_metric;
+ NMPlatformIP4Route *r;
g_assert (self->_priv.ipv4_config);
g_assert (self->_priv.bearer);
@@ -920,26 +922,20 @@ static_stage3_ip4_done (NMModemBroadband *self)
_LOGI (" address %s/%d", address_string, address.plen);
- if (gw) {
- guint32 ip4_route_table, ip4_route_metric;
- nm_modem_get_route_parameters (NM_MODEM (self),
- &ip4_route_table,
- &ip4_route_metric,
- NULL,
- NULL);
- {
- const NMPlatformIP4Route r = {
- .rt_source = NM_IP_CONFIG_SOURCE_WWAN,
- .gateway = gw,
- .table_coerced = nm_platform_route_table_coerce (ip4_route_table),
- .metric = ip4_route_metric,
- };
-
- _LOGI (" gateway %s", gw_string);
- nm_ip4_config_add_route (config, &r, NULL);
- }
- }
+ nm_modem_get_route_parameters (NM_MODEM (self),
+ &ip4_route_table,
+ &ip4_route_metric,
+ NULL,
+ NULL);
+ r = &(NMPlatformIP4Route) {
+ .rt_source = NM_IP_CONFIG_SOURCE_WWAN,
+ .gateway = gw,
+ .table_coerced = nm_platform_route_table_coerce (ip4_route_table),
+ .metric = ip4_route_metric,
+ };
+ nm_ip4_config_add_route (config, r, NULL);
+ _LOGI (" gateway %s", gw_string);
/* DNS servers */
dns = mm_bearer_ip_config_get_dns (self->_priv.ipv4_config);