Re: [PATCH] wwan: don't assume DNS info is always available



On Tue, 2015-02-17 at 17:20 +0100, Aleksander Morgado wrote:
Fixes segfault with e.g. Ericsson modems that reply just with IP+gateway,
without DNS info.

Thanks, made a small change (reduced the patch to "for (i = 0; dns &&
dns[i]...") and pushed to 0.9.10, 1.0, and git master.

Dan

 [mm-port-serial-at.c:440] debug_log(): (ttyACM8): --> 'AT*E2IPCFG?<CR>'
 [mm-port-serial-at.c:440] debug_log(): (ttyACM8): <-- '<CR><LF>*E2IPCFG: 
(1,"10.191.64.12")(2,"10.191.64.10")<CR><LF>'
 [mm-port-serial-at.c:440] debug_log(): (ttyACM8): <-- '<CR><LF>OK<CR><LF>'
 [mm-port-serial.c:1296] mm_port_serial_close(): (ttyACM8) device open count is 1 (close)
 [mm-port.c:95] mm_port_set_connected(): (wwan0): port now connected
 [mm-base-bearer.c:488] connect_ready(): Connected bearer '/org/freedesktop/ModemManager1/Bearer/0'
 [mm-iface-modem.c:1392] __iface_modem_update_state_internal(): Modem 
/org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected)

 <info> Activation (ttyACM8) Stage 3 of 5 (IP Configure Start) started...
 <info> (ttyACM8): device state change: config -> ip-config (reason 'none') [50 70 0]
 <info> Activation (ttyACM8) Stage 4 of 5 (IPv6 Configure Timeout) scheduled...
 <info> Activation (ttyACM8) Stage 3 of 5 (IP Configure Start) complete.
 <info> (ttyACM8): IPv4 static configuration:
 <info>   address 10.191.64.12/28
 <info>   gateway 10.191.64.10
Errore di segmentazione

http://lists.freedesktop.org/archives/modemmanager-devel/2015-February/001758.html
---
 src/devices/wwan/nm-modem-broadband.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
index 97d05ee..696c43a 100644
--- a/src/devices/wwan/nm-modem-broadband.c
+++ b/src/devices/wwan/nm-modem-broadband.c
@@ -708,11 +708,13 @@ static_stage3_ip4_done (NMModemBroadband *self)
 
      /* DNS servers */
      dns = mm_bearer_ip_config_get_dns (self->priv->ipv4_config);
-     for (i = 0; dns[i]; i++) {
-             if (   ip4_string_to_num (dns[i], &address_network)
-                 && address_network > 0) {
-                     nm_ip4_config_add_nameserver (config, address_network);
-                     nm_log_info (LOGD_MB, "  DNS %s", dns[i]);
+     if (dns) {
+             for (i = 0; dns[i]; i++) {
+                     if (   ip4_string_to_num (dns[i], &address_network)
+                         && address_network > 0) {
+                             nm_ip4_config_add_nameserver (config, address_network);
+                             nm_log_info (LOGD_MB, "  DNS %s", dns[i]);
+                     }
              }
      }
 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]