Huawei MS2732h-517 in NCM mode

Had some time for a bit more testing today. I can confirm ncm mode is working on a MT300N, MT300N-V2, and an AR300M all using stock gl-inet firmware version 2.264.

Here is the syslog on the MT300N-V1 with firmware 2.264… modem is initialized (after what looks like one failed attempt first?), AT commands sent, and connection established automatically at boot:

Sun Dec 16 17:58:19 2018 daemon.notice netifd: modem (1521): Timeout running AT-command
Sun Dec 16 17:58:19 2018 daemon.notice netifd: modem (1521): Failed to connect
Sun Dec 16 17:58:19 2018 daemon.notice netifd: modem (1963): Stopping network
Sun Dec 16 17:58:21 2018 daemon.err insmod: module is already loaded - xt_multiport
Sun Dec 16 17:58:21 2018 daemon.err insmod: module is already loaded - xt_comment
Sun Dec 16 17:58:21 2018 daemon.err insmod: module is already loaded - xt_length
Sun Dec 16 17:58:22 2018 daemon.notice netifd: modem (1963): sending -> AT^NDISDUP=1,0
Sun Dec 16 17:58:22 2018 daemon.notice netifd: modem (1963): Command failed: Permission denied
Sun Dec 16 17:58:22 2018 daemon.notice netifd: Interface 'modem' is now down
Sun Dec 16 17:58:22 2018 daemon.notice netifd: Interface 'modem' is setting up now
Sun Dec 16 17:58:25 2018 daemon.notice netifd: modem (2110): sending -> AT
Sun Dec 16 17:58:26 2018 daemon.crit xl2tpd[2149]: setsockopt recvref[30]: Protocol not available
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Using l2tp kernel support.
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: xl2tpd version xl2tpd-1.3.6 started on GL-MT300N PID:2149
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Forked by Scott Balmos and David Stipp, (C) 2001
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Inherited by Jeff McAdams, (C) 2002
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Forked again by Xelerance (www.xelerance.com) (C) 2006
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Listening on IP address 0.0.0.0, port 1701
Sun Dec 16 17:58:26 2018 user.emerg syslog: setting up led wifi
Sun Dec 16 17:58:27 2018 daemon.notice netifd: modem (2110): sending -> ATZ
Sun Dec 16 17:58:28 2018 daemon.notice netifd: modem (2110): sending -> ATQ0
Sun Dec 16 17:58:30 2018 daemon.notice netifd: modem (2110): sending -> ATV1
Sun Dec 16 17:58:30 2018 user.emerg syslog: 
Sun Dec 16 17:58:30 2018 daemon.info procd: - init complete -
Sun Dec 16 17:58:31 2018 daemon.notice netifd: modem (2110): sending -> ATE1
Sun Dec 16 17:58:32 2018 daemon.notice netifd: modem (2110): sending -> ATS0=0
Sun Dec 16 17:58:32 2018 daemon.notice netifd: modem (2110): sending -> AT^NDISDUP=1,1,"fast.t-mobile.com"
Sun Dec 16 17:58:33 2018 daemon.notice netifd: modem (2110): Connected, starting DHCP
Sun Dec 16 17:58:33 2018 kern.err kernel: [   85.240000] huawei_cdc_ncm 1-1:1.3 wwan0: kevent 12 may have been dropped
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Interface 'modem' is now up
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Interface 'modem_4' is enabled
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Network device 'wwan0' link is up
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Network alias 'wwan0' link is up
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Interface 'modem_4' has link connectivity 
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Interface 'modem_4' is setting up now
Sun Dec 16 17:58:33 2018 daemon.notice netifd: modem (2110): Command failed: Unknown error
Sun Dec 16 17:58:34 2018 daemon.notice netifd: Interface 'modem_6' is enabled
Sun Dec 16 17:58:34 2018 daemon.notice netifd: Interface 'modem_6' has link connectivity 
Sun Dec 16 17:58:34 2018 daemon.notice netifd: Interface 'modem_6' is setting up now
Sun Dec 16 17:58:34 2018 daemon.notice netifd: modem (2110): Command failed: Unknown error
Sun Dec 16 17:58:34 2018 daemon.notice netifd: modem_4 (2380): udhcpc (v1.24.1) started
Sun Dec 16 17:58:34 2018 daemon.notice netifd: modem_4 (2380): Sending discover...
Sun Dec 16 17:58:37 2018 daemon.notice netifd: modem_4 (2380): Sending discover...
Sun Dec 16 17:58:37 2018 daemon.notice netifd: modem_4 (2380): Sending select for 25.73.119.28...
Sun Dec 16 17:58:37 2018 daemon.notice netifd: modem_4 (2380): Lease of 25.73.119.28 obtained, lease time 518400
Sun Dec 16 17:58:37 2018 daemon.notice netifd: Interface 'modem_4' is now up
Sun Dec 16 17:58:37 2018 daemon.info dnsmasq[1732]: reading /tmp/resolv.conf.auto
Sun Dec 16 17:58:37 2018 daemon.info dnsmasq[1732]: using local addresses only for domain lan
Sun Dec 16 17:58:37 2018 daemon.info dnsmasq[1732]: using nameserver 10.177.0.34#53
Sun Dec 16 17:58:37 2018 daemon.info dnsmasq[1732]: using nameserver 10.177.0.210#53
Sun Dec 16 17:58:38 2018 user.notice mwan3: ifup interface modem (wwan0)
Sun Dec 16 17:58:40 2018 user.notice firewall: Reloading firewall due to ifup of modem (wwan0)

However, if I upgrade to firmware version 2.27x, I can no longer get the modem to connect via NCM. Here is the syslog from firmware ver 2.27 on an AR300M. It looks sort of like the AT commands are sent to modem before wwan0 is initialized, and they are not retried after wwan0 is up, so no successful connection is made, and no dhcp assignment is handed to wwan0 from the modem. How can I fix this so I can use NCM with up-to-date firmware on these devices?

Sun Dec 16 18:40:54 2018 daemon.notice netifd: Interface 'modem' is setting up now
Sun Dec 16 18:40:54 2018 kern.info kernel: [   40.900891] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Sun Dec 16 18:40:54 2018 daemon.err insmod: module is already loaded - xt_connmark
Sun Dec 16 18:40:54 2018 daemon.notice netifd: Interface 'wan' is enabled
Sun Dec 16 18:40:54 2018 daemon.notice netifd: Interface 'wan6' is enabled
Sun Dec 16 18:40:54 2018 daemon.info odhcpd[1312]: Raising SIGUSR1 due to address change on br-lan
Sun Dec 16 18:40:54 2018 daemon.notice netifd: bridge 'br-lan' link is up
Sun Dec 16 18:40:54 2018 daemon.notice netifd: Interface 'lan' has link connectivity 
Sun Dec 16 18:40:54 2018 daemon.notice netifd: Network device 'lo' link is up
Sun Dec 16 18:40:54 2018 daemon.notice netifd: Interface 'loopback' has link connectivity 
Sun Dec 16 18:40:54 2018 daemon.err insmod: module is already loaded - xt_comment
Sun Dec 16 18:40:54 2018 daemon.err insmod: module is already loaded - xt_length
Sun Dec 16 18:40:55 2018 kern.info kernel: [   41.869107] br-lan: port 1(eth1) entered disabled state
Sun Dec 16 18:40:55 2018 daemon.notice netifd: bridge 'br-lan' link is down
Sun Dec 16 18:40:55 2018 daemon.notice netifd: Interface 'lan' has link connectivity loss
Sun Dec 16 18:40:55 2018 daemon.info odhcpd[1312]: Using a RA lifetime of 0 seconds on br-lan
Sun Dec 16 18:40:55 2018 user.notice firewall: Reloading firewall due to ifup of lan (br-lan)
Sun Dec 16 18:40:57 2018 daemon.notice netifd: modem (1794): sending -> AT
Sun Dec 16 18:40:58 2018 daemon.err hostapd: Configuration file: /var/run/hostapd-phy0.conf
Sun Dec 16 18:40:58 2018 kern.info kernel: [   44.760508] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
Sun Dec 16 18:40:58 2018 kern.info kernel: [   44.853335] device wlan0 entered promiscuous mode
Sun Dec 16 18:40:58 2018 daemon.err hostapd: Using interface wlan0 with hwaddr e4:95:6e:44:3a:90 and ssid "GL-AR300M-a90"
Sun Dec 16 18:40:58 2018 daemon.notice netifd: modem (1794): sending -> ATZ
Sun Dec 16 18:40:59 2018 daemon.err insmod: module is already loaded - xt_multiport
Sun Dec 16 18:40:59 2018 daemon.err insmod: module is already loaded - xt_connmark
Sun Dec 16 18:40:59 2018 daemon.notice netifd: modem (1794): sending -> ATQ0
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: started, version 2.78 cachesize 150
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: DNS service limited to local subnets
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-DNSSEC no-ID loop-detect inotify
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq-dhcp[2220]: DHCP, IP range 192.168.8.100 -- 192.168.8.249, lease time 12h
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: using local addresses only for domain lan
Sun Dec 16 18:40:59 2018 daemon.warn dnsmasq[2220]: no servers found in /tmp/resolv.conf.auto, will retry
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: read /etc/hosts - 1 addresses
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: read /tmp/hosts/odhcpd - 0 addresses
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: read /tmp/hosts/dhcp.cfg02411c - 3 addresses
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq-dhcp[2220]: read /etc/ethers - 0 addresses
Sun Dec 16 18:40:59 2018 daemon.err insmod: module is already loaded - xt_comment
Sun Dec 16 18:40:59 2018 daemon.err insmod: module is already loaded - xt_length
Sun Dec 16 18:40:59 2018 kern.info kernel: [   46.417441] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Sun Dec 16 18:40:59 2018 kern.info kernel: [   46.424244] br-lan: port 2(wlan0) entered forwarding state
Sun Dec 16 18:40:59 2018 kern.info kernel: [   46.430027] br-lan: port 2(wlan0) entered forwarding state
Sun Dec 16 18:40:59 2018 daemon.notice netifd: bridge 'br-lan' link is up
Sun Dec 16 18:40:59 2018 daemon.notice netifd: Interface 'lan' has link connectivity 
Sun Dec 16 18:40:59 2018 daemon.notice hostapd: wlan0: interface state UNINITIALIZED->ENABLED
Sun Dec 16 18:40:59 2018 daemon.notice hostapd: wlan0: AP-ENABLED 
Sun Dec 16 18:40:59 2018 daemon.notice netifd: modem (1794): sending -> ATV1
Sun Dec 16 18:41:00 2018 daemon.notice netifd: Network device 'wlan0' link is up
Sun Dec 16 18:41:00 2018 daemon.notice netifd: modem (1794): sending -> ATE1
Sun Dec 16 18:41:01 2018 daemon.notice netifd: modem (1794): sending -> ATS0=0
Sun Dec 16 18:41:01 2018 kern.info kernel: [   48.426695] br-lan: port 2(wlan0) entered forwarding state
Sun Dec 16 18:41:02 2018 daemon.notice netifd: modem (1794): sending -> AT+CGDCONT=1,"IP","fast.t-mobile.com"
Sun Dec 16 18:41:02 2018 daemon.notice procd: /etc/rc.d/S96led: setting up led WLAN
Sun Dec 16 18:41:03 2018 daemon.notice netifd: modem (1794): Starting network modem
Sun Dec 16 18:41:03 2018 daemon.notice procd: /etc/rc.d/S99ss-server: 
Sun Dec 16 18:41:03 2018 daemon.info procd: - init complete -
Sun Dec 16 18:41:03 2018 daemon.notice netifd: modem (1794): sending -> AT^NDISDUP=1,1,"fast.t-mobile.com"
Sun Dec 16 18:41:04 2018 daemon.notice netifd: modem (1794): Setting up wwan0
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Interface 'modem' is now up
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Network device 'wwan0' link is up
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Network alias 'wwan0' link is up
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Interface 'modem_4' is enabled
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Interface 'modem_4' has link connectivity 
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Interface 'modem_4' is setting up now
Sun Dec 16 18:41:04 2018 daemon.notice netifd: modem (1794): Command failed: Unknown error
Sun Dec 16 18:41:04 2018 daemon.notice netifd: modem_4 (2484): udhcpc: started, v1.25.1
Sun Dec 16 18:41:04 2018 daemon.notice netifd: modem_4 (2484): udhcpc: sending discover
Sun Dec 16 18:41:05 2018 daemon.info odhcpd[1312]: Using a RA lifetime of 0 seconds on br-lan
Sun Dec 16 18:41:07 2018 daemon.notice netifd: modem_4 (2484): udhcpc: sending discover
Sun Dec 16 18:41:08 2018 kern.notice kernel: [   55.310638] random: nonblocking pool is initialized
Sun Dec 16 18:41:10 2018 daemon.notice netifd: modem_4 (2484): udhcpc: sending discover
Sun Dec 16 18:41:15 2018 user.warn mwan3: Could not find gateway for interface modem (wwan0)
Sun Dec 16 18:41:15 2018 user.notice firewall: Reloading firewall due to ifup of modem (wwan0)