luci-compat network.lua: get_interfaces() crashes on MLO wifi-iface device lists ("bad argument #2 (string expected, got table)")
Is there an existing issue for this?
- I have searched among all existing issues (including closed issues)
Screenshots or captures
Not needed - the failure is a server-side HTTP 500 with a text traceback.
Actual behaviour
With an MLO wifi-iface section (option mlo '1' plus list device 'radio0' 'radio1'), pages built on the luci-compat network model fail with HTTP 500:
ucodebridge.lua:23: .../luasrc/model/network.lua:760: bad argument #2 (string expected, got table)The _uci:foreach("wireless", "wifi-iface", ...) handler in get_interfaces() formats the synthetic interface name with "%s.network%d" %{ s.device, num[s.device] }, but for MLO sections s.device is a list (table), not a string.
Expected behaviour
MLO wifi-iface sections should be enumerated like any other section; the synthetic name should be built from the first device of the list instead of raising a formatting error.
Steps to reproduce
- Configure any MLO wifi-iface:
option mlo '1'+list device 'radio0' 'radio1'. - Open a LuCI page rendered through
luci-compat's network model (observed on a plugin settings page rendered via ucodebridge). - The page returns HTTP 500 with the traceback above.
Additional Information
Fork build (iStoreOS-based) of OpenWrt master:
kernel 6.18.53, target airoha/an7581
device: Airoha AN7581 (Econet XR1710G, MT7996)
luci feed @ fb6b224 (current master)
image kind: self-builtThe JS side of the same problem was already addressed for network.js/wireless.js in PRs #9040 and #8893 - the Lua model used by luci-compat is not covered by either.
Fix - normalise the device to its first element when it is a table:
--- a/modules/luci-compat/luasrc/model/network.lua
+++ b/modules/luci-compat/luasrc/model/network.lua
@@ -756,8 +756,13 @@ function get_interfaces(self)
_uci:foreach("wireless", "wifi-iface",
function(s)
if s.device then
- num[s.device] = num[s.device] and num[s.device] + 1 or 1
- local i = "%s.network%d" %{ s.device, num[s.device] }
+ -- MLO wifi-iface sections carry a device LIST (table); the
+ -- synthetic name must be built from a string or formatting
+ -- raises "string expected, got table".
+ local dev = s.device
+ if type(dev) == "table" then dev = dev[1] end
+ num[dev] = num[dev] and num[dev] + 1 or 1
+ local i = "%s.network%d" %{ dev, num[dev] }
wfs[i] = interface(i)
end
end)Verified with a live 2.4+5 GHz / 5+6 GHz MLO configuration: previously the affected page returned HTTP 500 with the traceback above; after the one-line normalisation the page renders (HTTP 200), and non-MLO sections behave unchanged.
Source: openwrt/luci