[PATCH] umbim: apply MBIM DNS independent of dhcp

Di An di.an at direconnet.iasoc.org
Wed Sep 23 02:08:38 PDT 2026


Symptoms (China Unicom style PDP: IPv4 from MBIM OOB, IPv6 via
DHCPv6; dhcp/dhcpv6 left at "auto"):

  # umbim -d /dev/cdc-wdm0 config
    ipv4address: 10.233.5.171/8
    ipv4gateway: 10.233.5.172
    ipv4mtu: 1500
    ipv4dnsserver: 202.99.96.68
    ipv4dnsserver: 202.99.104.68
    ipv6address: fe80:0:0:0:0:0:0:1/64
    ipv6gateway: fe80:0:0:0:0:0:0:1
    ipv6mtu: 1432
    ipv6dnsserver: 2408:8888:0:8888:0:0:0:8
    ipv6dnsserver: 2408:8899:0:8899:0:0:0:8

  # ubus call network.interface.wwan1_4 status
    "proto": "static",
    "ipv4-address": [ { "address": "10.233.5.171", "mask": 8 } ],
    "route": [ { "target": "0.0.0.0", "mask": 0,
                 "nexthop": "10.233.5.172", "source": "0.0.0.0/0" } ],
    "dns-server": [ ],

  # ifstatus wwan1_4
    ... same: address and default route installed,
        "dns-server": [ ]

  # cat /tmp/resolv.conf.d/resolv.conf.auto
  #

MBIM_CID_IP_CONFIGURATION delivers DNS servers OOB, but wwan1_4 has
an empty dns-server list and resolv.conf.auto is empty. Name resolution
fails even though the bearer is up and the default route is installed.
The same gate hits the DHCPv6 fallback: with dhcpv6=auto, wwan1_6 also
drops ipv6dnsserver from MBIM, so neither family gets resolver entries.
Setting dhcp=1 / dhcpv6=1 as a workaround leaves the OOB path and drops
IPv4 on this PDP instead.

MBIM_CID_IP_CONFIGURATION delivers DNS servers as independent
information elements. They can be present even when the address is
configured in-band (DHCP/DHCPv6), and they must still be recorded when
the address is taken from the OOB/static path. Commit d256ab7309
("umbim: include MBIM-provided DNS servers also with DHCP mode")
already moved DNS out of the static/dhcp branches for that reason.

Later commits re-gated that block on the address-acquisition option:

  - 1108f6cb8b ("umbim: allow forcing DHCP/DHCPv6 configuration")
    introduced dhcp/dhcpv6 = auto|0|1 and skipped DNS when
    peerdns=0 *and* dhcp != 1.

  - 03e0a608e0 ("umbim: add dns servers independent of peerdns")
    intended to drop the peerdns gate and always publish DNS in ifstatus
    (leaving selection to netifd). The condition was rewritten as
    [ "$dhcp" != 1 ] || { ... }, which still runs the block only when
    dhcp is exactly 1.

With the default dhcp=auto (OOB-first), DNS is therefore never applied
on the static path, and also never applied on the DHCP(v6) fallback
unless the user forces dhcp=1 / dhcpv6=1. Hybrid core networks that
hand out IPv4 via MBIM OOB and IPv6 via DHCPv6 — China Unicom is a
typical example — hit both sides at once: static IPv4 skips
ipv4dnsserver and dhcpv6=auto skips ipv6dnsserver.

Always add the MBIM-provided DNS servers to the dynamic interface
config. This restores the model from d256ab7309 and matches the qmi
sibling fix 75824a7524 ("package: utils: uqmi: add dns servers
independent of peerdns"), which removes the peerdns gate outright
instead of re-encoding it as a dhcp check. peerdns / noresolv still
control whether netifd adopts the servers.

After the fix, ifstatus wwan1_4 reports:

  "dns-server": [ "202.99.96.68", "202.99.104.68" ]

and both families are published to the resolver, including the DHCPv6
fallback path:

  # cat /tmp/resolv.conf.d/resolv.conf.auto
  # Interface wwan1_4
  nameserver 202.99.96.68
  nameserver 202.99.104.68
  # Interface wwan1_6
  nameserver 2408:8888:0:8888::8
  nameserver 2408:8899:0:8899::8

Fixes: 03e0a608e0 ("umbim: add dns servers independent of peerdns")
Fixes: 1108f6cb8b ("umbim: allow forcing DHCP/DHCPv6 configuration")
Signed-off-by: Di An <di.an at direconnet.iasoc.org>
---
 .../network/utils/umbim/files/lib/netifd/proto/mbim.sh | 24 ++++--------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
index 2553ada406..87fe91bb30 100755
--- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
+++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
@@ -253,13 +253,11 @@ _proto_mbim_setup() {
 			json_add_string proto "dhcp"
 		fi

-		[ "$dhcp" != 1 ] || {
-			json_add_array dns
-			for server in $(_proto_mbim_get_field ipv4dnsserver "$mbimconfig"); do
-				json_add_string "" "$server"
-			done
-			json_close_array
-		}
+		json_add_array dns
+		for server in $(_proto_mbim_get_field ipv4dnsserver "$mbimconfig"); do
+			json_add_string "" "$server"
+		done
+		json_close_array

 		proto_add_dynamic_defaults
 		[ -n "$zone" ] && json_add_string zone "$zone"
@@ -298,13 +296,11 @@ _proto_mbim_setup() {
 			[ "$sourcefilter" = "0" ] && json_add_boolean sourcefilter "0"
 		fi

-		[ "$dhcpv6" != 1 ] || {
-			json_add_array dns
-			for server in $(_proto_mbim_get_field ipv6dnsserver "$mbimconfig"); do
-				json_add_string "" "$server"
-			done
-			json_close_array
-		}
+		json_add_array dns
+		for server in $(_proto_mbim_get_field ipv6dnsserver "$mbimconfig"); do
+			json_add_string "" "$server"
+		done
+		json_close_array

 		proto_add_dynamic_defaults
 		[ -n "$zone" ] && json_add_string zone "$zone"
--
2.43.0



More information about the openwrt-devel mailing list