Can't obtain IP on QMI Raw IP Connection

I'm attempting to use QMI on a GL.Inet MiFi equipped with a Quectel EC-25A cellular modem.

When I configure the interface using QMI I am able to connect to the cellular network at the radio layer, however my wwan0 interface is not assigned an IP address. Here's my configuration from /etc/config/network:

config interface 'modem'
        option proto 'qmi'
        option ifname 'wwan0'
        option device '/dev/cdc-wdm0'
        option country 'country11'
        option apn 'inet.bell.ca'

And some commands showing the device behaviour. You'll note that raw_ip needs to be set to Y. I've integrated this patch to have qmi.sh set the raw_ip mode when required.

root@OpenWrt:~# cat /sys/class/net/wwan0/qmi/raw_ip
Y
root@OpenWrt:~# ifup modem
root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-data-status
"connected"
root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-current-settings
{
    "pdp-type": "ipv4",
    "ip-family": "ipv4",
    "mtu": 1500,
    "ipv4": {
        "ip": "100.105.180.51",
        "dns1": "206.47.201.246",
        "dns2": "207.231.231.254",
        "gateway": "100.105.180.52",
        "subnet": "255.255.255.248"
    },
    "ipv6": {
        
    },
    "domain-names": {
        
    }
}
root@OpenWrt:~# ifconfig wwan0
wwan0     Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet6 addr: fe80::d789:480e:bfc8:2dac/64 Scope:Link
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:28 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5129 (5.0 KiB)  TX bytes:768 (768.0 B)

If I manually use the uqmi command to connect to the cellular network I can then drive the wwan0 interface using dhcp successfully. Here's my /etc/config/network.

config interface 'modem'
        option proto 'dhcp'
        option ifname 'wwan0'

And the resulting successful network connection:

root@OpenWrt:~# ifup modem
root@OpenWrt:~# ifconfig wwan0
wwan0     Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:100.105.180.51  P-t-P:100.105.180.51  Mask:255.255.255.248
          inet6 addr: fe80::d789:480e:bfc8:2dac/64 Scope:Link
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:80 errors:0 dropped:0 overruns:0 frame:0
          TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:24102 (23.5 KiB)  TX bytes:16842 (16.4 KiB)
root@OpenWrt:~# ping -c 1 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=54 time=31.805 ms

--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 31.805/31.805/31.805 ms

I believe that for some reason the dhcp client isn't being run on the wwan0 interface by qmi.sh once it's online but I'm not able to determine how this is supposed to work. I'm eager to address this issue and submit the resulting patches. Please let me know if you can help.

The same happens to me. I use a TP-Link TL-WR1043ND v2 and a Huawei E398 modem. Everything works if I use uqmi (with autoconnect switch) and DHCP as interface protocol. If I configure the interface with protocol qmi I get an address when I connect to the ISP, but the renew every 24 hours is not working.

If I use qmi as interface protocol, unplugging/replugging the modem the device /dev/cdc-wdm0 is locked, the same thing happens if I manually reset the modem using uqmi. Ifdown/ifup sometimes gets me a new IP address, but sadly not everytime.

I've been working on this over on the bug tracker, I've got a test patch that resolves my issue however I have yet to test the modem for a long period of time. Maybe you could test my patch if you're able to see if it helps you as well?

https://bugs.lede-project.org/index.php?do=details&task_id=1252

I am very sorry, but I can't test your patch.
We are 4 people here and and everyone is pissed because of this issue.
Of course it's my fault, because I am the tech guy at home -.-

I have the same issue with my D-Link DWR-921 running OpenWrt 19.07.1. This issue is stopping me from using a DDNS service as the service is unable to map the IPv4 as it's not even detected!