E1750 Reloaded - QMI - STATIC - DHCP - IPv4

poma pomidorabelisima at gmail.com
Mon Aug 11 23:23:47 PDT 2014


On 11.08.2014 10:13, Aleksander Morgado wrote:
> On Sun, Aug 10, 2014 at 10:41 PM, poma <pomidorabelisima at gmail.com> wrote:
>> Fallback to MM_BEARER_IP_METHOD_DHCP if can't "ping-pong" with the Google Public DNS
>>
>> ---
>>  src/mm-bearer-qmi.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c
>> index c25b9f7..b632b69 100644
>> --- a/src/mm-bearer-qmi.c
>> +++ b/src/mm-bearer-qmi.c
>> @@ -337,6 +337,13 @@ get_ipv4_config (QmiMessageWdsGetCurrentSettingsOutput *output, guint32 mtu)
>>          mm_dbg ("       MTU: %d", mtu);
>>      }
>>
>> +    if (system("ping -q -c2 8.8.8.8")) {
>> +        mm_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_DHCP);
>> +        mm_info ("STATIC ain't workin, let's go DHCP");
>> +    } else {
>> +        mm_info ("we're staying STATIC, but here we're already connected so someone should check does STATIC actually works");
>> +    }
>> +
>>      return config;
> 
> :) No, that won't work. Not every APN gives you access to the
> Internet, some users may use APNs that give them access to private
> networks managed by the operators. I've worked with such a case in the
> past.

Oh yes it does, for the config here.
So you cover that case, but not others? :)

> I'd rather just fall back to DHCP for IPv4 instead of adding that ping
> (Huawei-only?). I tried to test the issue with my Huawei QMI modem but
> unfortunately it seems to be broken (doesn't detect the SIM properly);
> Dan also said that he would check that with his modems.

El zapatero siempre tiene los peores zapatos.
Pero al menos sabemos que eres un zapatero. :)

Besides rather than two months later, it should be checked before the patch is applied.


Fallback to MM_BEARER_IP_METHOD_DHCP if default gateway doesn't pong

---
 src/mm-bearer-qmi.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c
index c25b9f7..12b8cfd 100644
--- a/src/mm-bearer-qmi.c
+++ b/src/mm-bearer-qmi.c
@@ -309,6 +309,15 @@ get_ipv4_config (QmiMessageWdsGetCurrentSettingsOutput *output, guint32 mtu)
         g_clear_error (&error);
     }
 
+    /* IPv4 test default gateway */
+    if (system("ping -q -c2 $(ip route show | awk '{print $3; exit}')")) {
+        mm_info ("default gateway doesn't pong in STATIC");
+        mm_info ("Let's Rock 'n' Roll!");
+        mm_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_DHCP);
+    } else {
+        mm_info ("Continue with STATIC");
+    }
+
     /* IPv4 DNS #1 */
     if (qmi_message_wds_get_current_settings_output_get_primary_ipv4_dns_address (output, &addr, &error)) {
         qmi_inet4_ntop (addr, buf, sizeof (buf));
@@ -319,7 +328,7 @@ get_ipv4_config (QmiMessageWdsGetCurrentSettingsOutput *output, guint32 mtu)
         g_clear_error (&error);
     }
 
-    /* IPv6 DNS #2 */
+    /* IPv4 DNS #2 */
     if (qmi_message_wds_get_current_settings_output_get_secondary_ipv4_dns_address (output, &addr, &error)) {
         qmi_inet4_ntop (addr, buf2, sizeof (buf2));
         dns[dns_idx++] = buf2;
-- 
2.0.4


poma




More information about the ModemManager-devel mailing list