luci-base: network.js: consider uci config for Device.getType()/getParent()
authorJo-Philipp Wich <[email protected]>
Thu, 16 Jun 2022 07:47:47 +0000 (09:47 +0200)
committerJo-Philipp Wich <[email protected]>
Thu, 16 Jun 2022 07:53:14 +0000 (09:53 +0200)
commit8a4486a7921ad5993fed4713ec2d986575825171
treead4063c506838f3f9ec03f623c5ec55e66b76736
parent2b78a18d7b500513d4f1142d14219c4ec1f83240
luci-base: network.js: consider uci config for Device.getType()/getParent()

For network devices declared in uci but not yet created by netifd, the
runtime status information will be unavailable, causing methods such as
`getType()` to assume plain ethernet interfaces and `getParent()` to fail
resolving parent devices.

Fall back to infer the information from uci configuration settings in such
cases to give accurate type hints to callers.

In particular, this prevents LuCI from turning wireless target networks
containing a to-be-created bridge device into bridges themselves.

Fixes: https://github.com/openwrt/packages/issues/18768
Signed-off-by: Jo-Philipp Wich <[email protected]>
(cherry picked from commit 8effea58d7281fd4f2b6c31d534195dba27a850b)
modules/luci-base/htdocs/luci-static/resources/network.js