aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2017-10-02 10:42:33 -0500
committerDan Williams <dcbw@redhat.com>2017-10-02 10:49:32 -0500
commit3e15dc15efd118a2e7af8f60727afc7fbb7db3a3 (patch)
tree8b827b90f672a2e03252b2f8d4b297e05d372780 /src
parentb252ab668f705cf23694ca693f524e2292320a56 (diff)
bearer-mbim: don't crash when modem doesn't send gateways
When the Ericsson F5321 with firmware R3C11/R4D04 is told to make an IPv6-only connection, it reports that it has IPv4 configuration but then returns no actual addresses. Check both the flags and actual data before trying to use them. ModemManager[25850]: <debug> [1506958721.914717] IPv4 configuration available: 'address, gateway, dns, mtu' ModemManager[25850]: <debug> [1506958721.914731] IP addresses (0) ModemManager[25850]: <debug> [1506958721.914741] DNS addresses (0) ModemManager[25850]: <debug> [1506958721.914748] MTU: '0' ModemManager[25850]: <debug> [1506958721.914758] IPv6 configuration available: 'address, dns, mtu' ModemManager[25850]: <debug> [1506958721.914767] IP addresses (1) ModemManager[25850]: <debug> [1506958721.914852] IP [0]: 'fe80::39:f622:7d01/64' ModemManager[25850]: <debug> [1506958721.914866] DNS addresses (2) ModemManager[25850]: <debug> [1506958721.914883] DNS [0]: 'fd00:976a::9' ModemManager[25850]: <debug> [1506958721.914896] MTU: '1500' ModemManager[25850]: <debug> [1506958721.914947] (wwp0s20u1i6): port now connected
Diffstat (limited to 'src')
-rw-r--r--src/mm-bearer-mbim.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c
index 86e08d4c..949edfbe 100644
--- a/src/mm-bearer-mbim.c
+++ b/src/mm-bearer-mbim.c
@@ -304,7 +304,7 @@ ip_configuration_query_ready (MbimDevice *device,
mm_dbg ("IPv4 configuration available: '%s'", str);
g_free (str);
- if (ipv4configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_ADDRESS) {
+ if ((ipv4configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_ADDRESS) && ipv4addresscount) {
guint i;
mm_dbg (" IP addresses (%u)", ipv4addresscount);
@@ -317,7 +317,7 @@ ip_configuration_query_ready (MbimDevice *device,
}
}
- if (ipv4configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_GATEWAY) {
+ if ((ipv4configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_GATEWAY) && ipv4gateway) {
addr = g_inet_address_new_from_bytes ((guint8 *)ipv4gateway, G_SOCKET_FAMILY_IPV4);
str = g_inet_address_to_string (addr);
mm_dbg (" Gateway: '%s'", str);
@@ -325,7 +325,7 @@ ip_configuration_query_ready (MbimDevice *device,
g_object_unref (addr);
}
- if (ipv4configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_DNS) {
+ if ((ipv4configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_DNS) && ipv4dnsservercount) {
guint i;
mm_dbg (" DNS addresses (%u)", ipv4dnsservercount);
@@ -340,7 +340,7 @@ ip_configuration_query_ready (MbimDevice *device,
}
}
- if (ipv4configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_MTU) {
+ if ((ipv4configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_MTU) && ipv4mtu) {
mm_dbg (" MTU: '%u'", ipv4mtu);
}
@@ -350,7 +350,7 @@ ip_configuration_query_ready (MbimDevice *device,
mm_dbg ("IPv6 configuration available: '%s'", str);
g_free (str);
- if (ipv6configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_ADDRESS) {
+ if ((ipv6configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_ADDRESS) && ipv6addresscount) {
guint i;
mm_dbg (" IP addresses (%u)", ipv6addresscount);
@@ -363,7 +363,7 @@ ip_configuration_query_ready (MbimDevice *device,
}
}
- if (ipv6configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_GATEWAY) {
+ if ((ipv6configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_GATEWAY) && ipv6gateway) {
addr = g_inet_address_new_from_bytes ((guint8 *)ipv6gateway, G_SOCKET_FAMILY_IPV6);
str = g_inet_address_to_string (addr);
mm_dbg (" Gateway: '%s'", str);
@@ -371,7 +371,7 @@ ip_configuration_query_ready (MbimDevice *device,
g_object_unref (addr);
}
- if (ipv6configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_DNS) {
+ if ((ipv6configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_DNS) && ipv6dnsservercount) {
guint i;
mm_dbg (" DNS addresses (%u)", ipv6dnsservercount);
@@ -386,7 +386,7 @@ ip_configuration_query_ready (MbimDevice *device,
}
}
- if (ipv6configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_MTU) {
+ if ((ipv6configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_MTU) && ipv6mtu) {
mm_dbg (" MTU: '%u'", ipv6mtu);
}