Skip to content

device: skip VLAN chain lookup for existing kernel interfaces - #71

Open
ghoker143 wants to merge 1 commit into
openwrt:masterfrom
ghoker143:master
Open

ghoker143 wants to merge 1 commit into
openwrt:masterfrom
ghoker143:master

Conversation

@ghoker143

Copy link
Copy Markdown

netifd's __device_get() treats any interface name containing a '.' as a
VLAN-style device by immediately dispatching to get_vlan_device_chain().

Modern externally-managed interfaces such as the rmnet mux links created
by ModemManager for QMI QMAP multiplexing (e.g. qmapmux0.0, qmapmux0.1)
are legitimate kernel netdevices that happen to contain a dot. When
ModemManager calls notify_proto with such an ifname, netifd incorrectly
tries to resolve it as a VLAN device:

ubus call network.device status '{"name":"qmapmux0.0"}'
=> { "type": "VLAN", "present": false }

This causes notify_proto to fail with "Unknown error" and the interface
never comes up under netifd control.

Fix: before dispatching to get_vlan_device_chain(), probe the kernel with
if_nametoindex(). If the full dotted name already exists as a real netdev,
skip the VLAN path and fall through to the normal device lookup / creation
path. This preserves all existing VLAN behaviour: when eth0.10 does not
yet exist in the kernel, if_nametoindex("eth0.10") returns 0 and netifd
still creates it as a VLAN device as before.

@neon12345

Copy link
Copy Markdown

I have made a pull request here #73 (old version #69) for the same problem, but I don't know the internals enough to judge what the proper fix is.

@LS3434

LS3434 commented Sep 26, 2026 •

Copy link
Copy Markdown

This patch helped me fix my problem with lack of traffic through modem on my Xunison Exigo D50 5G. It has Quectel RM500Q-AE modem, and i'm using Quectel packages, but it works. For me modem works on PCIe and uses MHI. It creates rmnet_mhi0 and rmnet_mhi0.1:

[26 wrz 2026, 17:24:27 CEST] daemon.notice: netifd: Interface '5g_pcie' is setting up now
[26 wrz 2026, 17:24:42 CEST] daemon.notice: netifd: 5g_pcie (6236): Waiting for control device: /dev/mhi_QMI0
[26 wrz 2026, 17:24:42 CEST] daemon.notice: netifd: 5g_pcie (6236): Detecting QMI control device
[26 wrz 2026, 17:24:42 CEST] daemon.notice: netifd: 5g_pcie (6236): Using QMI device: /dev/mhi_QMI0
[26 wrz 2026, 17:24:42 CEST] daemon.notice: netifd: 5g_pcie (6236): MHI device detected, waiting for rmnet interface
[26 wrz 2026, 17:24:42 CEST] daemon.notice: netifd: 5g_pcie (6236): Found MHI base interface: rmnet_mhi0
[26 wrz 2026, 17:24:42 CEST] daemon.notice: netifd: 5g_pcie (6236): Starting quectel-cm with QMI configuration for interface 5g_pcie
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:018] QConnectManager_Linux_V1.6.5
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:019] Find /sys/bus/usb/devices/1-1 idVendor=0x2c7c idProduct=0x800, bus=0x001, dev=0x002
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:020] network interface 'rmnet_mhi0' or qmidev '' is not exist
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:021] netcard driver = pcie_mhi, driver version = V1.3.8
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:022] qmap_mode = 1, qmap_version = 9, qmap_size = 15360, muxid = 0x81, qmap_netcard = rmnet_mhi0.1
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:022] Modem works in QMI mode
[26 wrz 2026, 17:24:43 CEST] kern.debug: [  165.356956] [I][mhi0][__mhi_prepare_channel] Entered: preparing channel:14
[26 wrz 2026, 17:24:43 CEST] kern.debug: [  165.362632] [I][mhi0][mhi_dump_tre] carl_ev evt_cmd_comp code=1, type=33
[26 wrz 2026, 17:24:43 CEST] kern.debug: [  165.362689] [I][mhi0][__mhi_prepare_channel] Chan:14 successfully moved to start state
[26 wrz 2026, 17:24:43 CEST] kern.debug: [  165.362720] [I][mhi0][__mhi_prepare_channel] Entered: preparing channel:15
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:055] cdc_wdm_fd = 7
[26 wrz 2026, 17:24:43 CEST] kern.debug: [  165.376115] [I][mhi0][mhi_dump_tre] carl_ev evt_cmd_comp code=1, type=33
[26 wrz 2026, 17:24:43 CEST] kern.debug: [  165.376171] [I][mhi0][__mhi_prepare_channel] Chan:15 successfully moved to start state
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:155] Get clientWDS = 14
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:158] Get clientDMS = 1
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:161] Get clientNAS = 3
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:164] Get clientUIM = 1
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:166] Get clientWDA = 1
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:169] requestBaseBandVersion RM500QAEAAR13A03M4G
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:169] Modem model RM500QAEAAR13A03M4G does not require FCC authentication
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:171] qmap_settings.rx_urb_size = 15360
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:172] qmap_settings.ul_data_aggregation_max_datagrams  = 11
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:172] qmap_settings.ul_data_aggregation_max_size       = 8192
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:172] qmap_settings.dl_minimum_padding                 = 0
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:182] Skipping FCC authentication - not required for this modem model
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:184] requestGetSIMStatus SIMStatus: SIM_READY
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:190] requestGetProfile[pdp:1 index:1] internet///0/IPV4
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:190] requestSetProfile[pdp:1 index:1] internet///0/IPV4
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:190] no need to set skip the rest
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:193] requestRegistrationState2 MCC: 260, MNC: 6, PS: Attached, DataCap: 5G_NSA
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:197] requestQueryDataCall IPv4ConnectionStatus: DISCONNECTED
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:197] ip link set dev rmnet_mhi0 down
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:205] ip addr flush dev rmnet_mhi0.1
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:212] ip link set dev rmnet_mhi0.1 down
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:238] requestSetupDataCall WdsConnectionIPv4Handle: 0x2291be70
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:256] ip link set dev rmnet_mhi0 up
[26 wrz 2026, 17:24:43 CEST] kern.info: [  165.576954] net rmnet_mhi0: link_state 0x0 -> 0x1
[26 wrz 2026, 17:24:43 CEST] kern.err: [  165.584498] [I][mhi_netdev_open] Opened net dev interface
[26 wrz 2026, 17:24:43 CEST] kern.err: [  165.586135] debugfs: 'rmnet_rx' already exists in 'stats'
[26 wrz 2026, 17:24:43 CEST] kern.alert: [  165.589119] rmnet_mhi0: raw-IP interface already has a receive handler
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:275] ip link set dev rmnet_mhi0.1 up
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:291] ip -4 address flush dev rmnet_mhi0.1
[26 wrz 2026, 17:24:43 CEST] kern.err: [  165.604885] debugfs: 'rmnet_rx' already exists in 'stats'
[26 wrz 2026, 17:24:43 CEST] kern.alert: [  165.605232] rmnet_mhi0.1: raw-IP interface already has a receive handler
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:299] ip -4 address add XXXXXX dev rmnet_mhi0.1
[26 wrz 2026, 17:24:43 CEST] daemon.notice: netifd: 5g_pcie (6249): [09-26_17:24:43:308] ip -4 route add default via XXXXXX dev rmnet_mhi0.1 metric 0
[26 wrz 2026, 17:24:47 CEST] daemon.notice: netifd: 5g_pcie (6236): Finding actual interface for IP configuration
[26 wrz 2026, 17:24:47 CEST] daemon.notice: netifd: 5g_pcie (6236): Using interface: rmnet_mhi0.1 for IP configuration
[26 wrz 2026, 17:24:47 CEST] daemon.notice: netifd: 5g_pcie (6236): Waiting for DHCP configuration on rmnet_mhi0.1 (timeout: 30s, attempt: 1)
[26 wrz 2026, 17:24:48 CEST] daemon.notice: netifd: 5g_pcie (6236): Interface configuration detected
[26 wrz 2026, 17:24:48 CEST] daemon.notice: netifd: 5g_pcie (6236): IPv4: XXXXXXX
[26 wrz 2026, 17:24:48 CEST] daemon.notice: netifd: 5g_pcie (6236): DNS: XXXXXXX
[26 wrz 2026, 17:24:48 CEST] daemon.notice: netifd: 5g_pcie (6236): Configuring netifd interface 5g_pcie
[26 wrz 2026, 17:24:48 CEST] kern.err: [  170.510765] debugfs: 'rmnet_rx' already exists in 'stats'
[26 wrz 2026, 17:24:48 CEST] kern.alert: [  170.511000] rmnet_mhi0.1: raw-IP interface already has a receive handler
[26 wrz 2026, 17:24:48 CEST] daemon.notice: netifd: Interface '5g_pcie' is now up
[26 wrz 2026, 17:24:48 CEST] daemon.notice: netifd: Network device 'rmnet_mhi0.1' link is up
[26 wrz 2026, 17:24:48 CEST] daemon.notice: netifd: 5g_pcie (6236): Updating IPv4 configuration
[26 wrz 2026, 17:24:48 CEST] daemon.info: dnsmasq[1]: reading /tmp/resolv.conf.d/resolv.conf.auto
[26 wrz 2026, 17:24:48 CEST] daemon.info: dnsmasq[1]: using nameserver XXXXX
[26 wrz 2026, 17:24:48 CEST] daemon.info: dnsmasq[1]: using nameserver XXXXX
[26 wrz 2026, 17:24:48 CEST] daemon.info: dnsmasq[1]: using only locally-known addresses for test
[26 wrz 2026, 17:24:48 CEST] daemon.info: dnsmasq[1]: using only locally-known addresses for onion
[26 wrz 2026, 17:24:48 CEST] daemon.info: dnsmasq[1]: using only locally-known addresses for localhost
[26 wrz 2026, 17:24:48 CEST] daemon.info: dnsmasq[1]: using only locally-known addresses for local
[26 wrz 2026, 17:24:48 CEST] daemon.info: dnsmasq[1]: using only locally-known addresses for invalid
[26 wrz 2026, 17:24:48 CEST] daemon.info: dnsmasq[1]: using only locally-known addresses for bind
[26 wrz 2026, 17:24:48 CEST] daemon.info: dnsmasq[1]: using only locally-known addresses for lan
[26 wrz 2026, 17:24:48 CEST] user.notice: firewall: Reloading firewall due to ifup of 5g_pcie (rmnet_mhi0.1)
[26 wrz 2026, 17:24:49 CEST] user.notice: nlbwmon: Reloading nlbwmon due to ifup of 5g_pcie (rmnet_mhi0.1)
[26 wrz 2026, 17:24:49 CEST] daemon.warn: odhcpd[2386]: No default route present, setting ra_lifetime to 0!
[26 wrz 2026, 17:24:49 CEST] user.notice: firewall: Reloading firewall due to ifupdate of 5g_pcie (rmnet_mhi0.1)
[26 wrz 2026, 17:24:50 CEST] daemon.notice: netifd: 5g_pcie (6236): Starting interface monitoring for 5g_pcie
[26 wrz 2026, 17:24:50 CEST] daemon.notice: netifd: 5g_pcie (6236): Setup complete for interface 5g_pcie 

"Tested-by: LS3434, Xunison Exigo D50, RM500Q-AE, pcie_mhi, rmnet_mhi0.1"

kuncy7 added a commit to kuncy7/openwrt-nss-edma that referenced this pull request Sep 26, 2026
Carry netifd PR #71 (open upstream since March) until it lands. netifd
reads any interface name with a dot as a VLAN on the part before it, so
the data device of a Quectel PCIe modem, rmnet_mhi0.1 - created by the
driver, not a VLAN - became "VLAN 1 on rmnet_mhi0", which the modem's
netdev cannot carry. The proto's link-up notify then failed with
"Unknown error", netifd released rmnet_mhi0 again and the modem passed
no traffic at all, with or without the NSS offload.

With the patch netifd checks if_nametoindex() first and takes a name
that already exists in the kernel as a plain device; a VLAN it has to
create (br-lan.10, wan.35) does not exist yet and still goes the VLAN
way. Confirmed on an Xunison D50 with an RM500Q on pcie_mhi (modem up,
rmnet_rx offload active); on a GL-B3000 the LAN, the WAN and a VLAN
created by netifd come up as before.

Link: openwrt/netifd#71

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kuncy7 added a commit to kuncy7/openwrt-nss-edma that referenced this pull request Oct 10, 2026
Carry netifd PR #71 (open upstream since March) until it lands. netifd
reads any interface name with a dot as a VLAN on the part before it, so
the data device of a Quectel PCIe modem, rmnet_mhi0.1 - created by the
driver, not a VLAN - became "VLAN 1 on rmnet_mhi0", which the modem's
netdev cannot carry. The proto's link-up notify then failed with
"Unknown error", netifd released rmnet_mhi0 again and the modem passed
no traffic at all, with or without the NSS offload.

With the patch netifd checks if_nametoindex() first and takes a name
that already exists in the kernel as a plain device; a VLAN it has to
create (br-lan.10, wan.35) does not exist yet and still goes the VLAN
way. Confirmed on an Xunison D50 with an RM500Q on pcie_mhi (modem up,
rmnet_rx offload active); on a GL-B3000 the LAN, the WAN and a VLAN
created by netifd come up as before.

Link: openwrt/netifd#71

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants