summary refs log tree commit diff
path: root/src/core/devices/wwan
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/devices/wwan')
-rw-r--r--src/core/devices/wwan/nm-device-modem.c22
-rw-r--r--src/core/devices/wwan/nm-modem-broadband.c7
-rw-r--r--src/core/devices/wwan/nm-modem-manager.c6
-rw-r--r--src/core/devices/wwan/nm-modem.c49
-rw-r--r--src/core/devices/wwan/nm-modem.h2
5 files changed, 22 insertions, 64 deletions
diff --git a/src/core/devices/wwan/nm-device-modem.c b/src/core/devices/wwan/nm-device-modem.c
index 4d892e6f..1b285469 100644
--- a/src/core/devices/wwan/nm-device-modem.c
+++ b/src/core/devices/wwan/nm-device-modem.c
@@ -616,18 +616,20 @@ act_stage3_ip_config_start(NMDevice *           device,
                            gpointer *           out_config,
                            NMDeviceStateReason *out_failure_reason)
 {
-    NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE(device);
-
-    nm_assert_addr_family(addr_family);
+    NMDeviceModemPrivate *priv    = NM_DEVICE_MODEM_GET_PRIVATE(device);
+    gboolean              autoip4 = FALSE;
+    NMActStageReturn      ret;
 
-    if (addr_family == AF_INET) {
-        return nm_modem_stage3_ip4_config_start(priv->modem,
-                                                device,
-                                                NM_DEVICE_CLASS(nm_device_modem_parent_class),
-                                                out_failure_reason);
-    } else {
+    if (!NM_IS_IPv4(addr_family))
         return nm_modem_stage3_ip6_config_start(priv->modem, device, out_failure_reason);
-    }
+
+    ret = nm_modem_stage3_ip4_config_start(priv->modem, device, &autoip4, out_failure_reason);
+
+    if (ret != NM_ACT_STAGE_RETURN_SUCCESS || !autoip4)
+        return ret;
+
+    return NM_DEVICE_CLASS(nm_device_modem_parent_class)
+        ->act_stage3_ip_config_start(device, addr_family, out_config, out_failure_reason);
 }
 
 static void
diff --git a/src/core/devices/wwan/nm-modem-broadband.c b/src/core/devices/wwan/nm-modem-broadband.c
index 0872a8a1..a5139f08 100644
--- a/src/core/devices/wwan/nm-modem-broadband.c
+++ b/src/core/devices/wwan/nm-modem-broadband.c
@@ -11,6 +11,7 @@
 #include <arpa/inet.h>
 #include <libmm-glib.h>
 
+#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
 #include "libnm-core-intern/nm-core-internal.h"
 #include "NetworkManagerUtils.h"
 #include "devices/nm-device-private.h"
@@ -829,11 +830,7 @@ complete_connection(NMModem *            modem,
     if (MODEM_CAPS_3GPP2(modem_caps)) {
         NMSettingCdma *s_cdma;
 
-        s_cdma = nm_connection_get_setting_cdma(connection);
-        if (!s_cdma) {
-            s_cdma = (NMSettingCdma *) nm_setting_cdma_new();
-            nm_connection_add_setting(connection, NM_SETTING(s_cdma));
-        }
+        s_cdma = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_CDMA);
 
         if (!nm_setting_cdma_get_number(s_cdma))
             g_object_set(G_OBJECT(s_cdma), NM_SETTING_CDMA_NUMBER, "#777", NULL);
diff --git a/src/core/devices/wwan/nm-modem-manager.c b/src/core/devices/wwan/nm-modem-manager.c
index 4fb9a378..8d087d13 100644
--- a/src/core/devices/wwan/nm-modem-manager.c
+++ b/src/core/devices/wwan/nm-modem-manager.c
@@ -12,9 +12,9 @@
 #include <libmm-glib.h>
 
 #if HAVE_LIBSYSTEMD
-    #include <systemd/sd-daemon.h>
+#include <systemd/sd-daemon.h>
 #else
-    #define sd_booted() FALSE
+#define sd_booted() FALSE
 #endif
 
 #include "libnm-std-aux/nm-dbus-compat.h"
@@ -22,7 +22,7 @@
 #include "nm-modem-broadband.h"
 
 #if WITH_OFONO
-    #include "nm-modem-ofono.h"
+#include "nm-modem-ofono.h"
 #endif
 
 #define MODEM_POKE_INTERVAL 120
diff --git a/src/core/devices/wwan/nm-modem.c b/src/core/devices/wwan/nm-modem.c
index 15baa677..ccea69db 100644
--- a/src/core/devices/wwan/nm-modem.c
+++ b/src/core/devices/wwan/nm-modem.c
@@ -526,48 +526,6 @@ static void
 ppp_ip4_config(NMPPPManager *ppp_manager, NMIP4Config *config, gpointer user_data)
 {
     NMModem *self = NM_MODEM(user_data);
-    guint32  i, num;
-    guint32  bad_dns1       = htonl(0x0A0B0C0D);
-    guint32  good_dns1      = htonl(0x04020201); /* GTE nameserver */
-    guint32  bad_dns2       = htonl(0x0A0B0C0E);
-    guint32  good_dns2      = htonl(0x04020202); /* GTE nameserver */
-    gboolean dns_workaround = FALSE;
-
-    /* Work around a PPP bug (#1732) which causes many mobile broadband
-     * providers to return 10.11.12.13 and 10.11.12.14 for the DNS servers.
-     * Apparently fixed in ppp-2.4.5 but we've had some reports that this is
-     * not the case.
-     *
-     * http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=2e09ef6886bbf00bc5a9a641110f801e372ffde6
-     * http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=f8191bf07df374f119a07910a79217c7618f113e
-     */
-
-    num = nm_ip4_config_get_num_nameservers(config);
-    if (num == 2) {
-        gboolean found1 = FALSE, found2 = FALSE;
-
-        for (i = 0; i < num; i++) {
-            guint32 ns = nm_ip4_config_get_nameserver(config, i);
-
-            if (ns == bad_dns1)
-                found1 = TRUE;
-            else if (ns == bad_dns2)
-                found2 = TRUE;
-        }
-
-        /* Be somewhat conservative about substitutions; the "bad" nameservers
-         * could actually be valid in some cases, so only substitute if ppp
-         * returns *only* the two bad nameservers.
-         */
-        dns_workaround = (found1 && found2);
-    }
-
-    if (!num || dns_workaround) {
-        _LOGW("compensating for invalid PPP-provided nameservers");
-        nm_ip4_config_reset_nameservers(config);
-        nm_ip4_config_add_nameserver(config, good_dns1);
-        nm_ip4_config_add_nameserver(config, good_dns2);
-    }
 
     g_signal_emit(self, signals[IP4_CONFIG_RESULT], 0, config, NULL);
 }
@@ -727,7 +685,7 @@ ppp_stage3_ip_config_start(NMModem *            self,
 NMActStageReturn
 nm_modem_stage3_ip4_config_start(NMModem *            self,
                                  NMDevice *           device,
-                                 NMDeviceClass *      device_class,
+                                 gboolean *           out_autoip4,
                                  NMDeviceStateReason *out_failure_reason)
 {
     NMModemPrivate * priv;
@@ -740,7 +698,7 @@ nm_modem_stage3_ip4_config_start(NMModem *            self,
 
     g_return_val_if_fail(NM_IS_MODEM(self), NM_ACT_STAGE_RETURN_FAILURE);
     g_return_val_if_fail(NM_IS_DEVICE(device), NM_ACT_STAGE_RETURN_FAILURE);
-    g_return_val_if_fail(NM_IS_DEVICE_CLASS(device_class), NM_ACT_STAGE_RETURN_FAILURE);
+    nm_assert(out_autoip4 && !*out_autoip4);
 
     req = nm_device_get_act_request(device);
     g_return_val_if_fail(req, NM_ACT_STAGE_RETURN_FAILURE);
@@ -774,7 +732,8 @@ nm_modem_stage3_ip4_config_start(NMModem *            self,
         break;
     case NM_MODEM_IP_METHOD_AUTO:
         _LOGD("MODEM_IP_METHOD_AUTO");
-        ret = device_class->act_stage3_ip_config_start(device, AF_INET, NULL, out_failure_reason);
+        *out_autoip4 = TRUE;
+        ret          = NM_ACT_STAGE_RETURN_SUCCESS;
         break;
     default:
         _LOGI("IPv4 configuration disabled");
diff --git a/src/core/devices/wwan/nm-modem.h b/src/core/devices/wwan/nm-modem.h
index 87162cfc..4bc81ff8 100644
--- a/src/core/devices/wwan/nm-modem.h
+++ b/src/core/devices/wwan/nm-modem.h
@@ -210,7 +210,7 @@ void nm_modem_act_stage2_config(NMModem *modem);
 
 NMActStageReturn nm_modem_stage3_ip4_config_start(NMModem *            modem,
                                                   NMDevice *           device,
-                                                  NMDeviceClass *      device_class,
+                                                  gboolean *           out_autoip4,
                                                   NMDeviceStateReason *out_failure_reason);
 
 NMActStageReturn nm_modem_stage3_ip6_config_start(NMModem *            modem,