Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider new interface names #1132

Open
ilario opened this issue Sep 24, 2024 · 7 comments · May be fixed by #1154
Open

Consider new interface names #1132

ilario opened this issue Sep 24, 2024 · 7 comments · May be fixed by #1154
Milestone

Comments

@ilario
Copy link
Member

ilario commented Sep 24, 2024

In the swconfig era (OpenWrt 19.07 and previous), interfaces had usually a name like eth0.2.
With DSA, interfaces can have funny names like ethblue, game, lan1, ethernet1...

So we either find a general way to deal with arbitrary interface names, or we extract a list of the interface names from the targets we care about (for example, these: https://repo.libremesh.org/releases/2020.4-ow19/targets/).

The code that needs adaptation is the dev_parser in network.lua in lime-system:

if dev:match("^eth%d+$") then
devices[dev] = devices[dev] or {}
utils.log( "network.scandevices.dev_parser found plain Ethernet " ..
"device %s", dev )
end
if dev:match("^eth%d+%.%d+$") then
local rawif = dev:match("^eth%d+")
devices[rawif] = { nobridge = true }
devices[dev] = {}
utils.log( "network.scandevices.dev_parser found vlan device %s " ..
"and marking %s as nobridge", dev, rawif )
end
--! With DSA, the LAN ports are not anymore eth0.1 but lan1, lan2...
--! or just lan.
if dev:match("^lan%d*$") then
local lower_if = network._get_lower(dev)
if lower_if then
devices[lower_if] = { nobridge = true }
devices[dev] = {}
utils.log( "network.scandevices.dev_parser found LAN port %s " ..
"and marking %s as nobridge", dev, lower_if )
end
end
--! With DSA, the WAN is named wan. Copying the code from the lan case.
if dev:match("^wan$") then
local lower_if = network._get_lower(dev)
if lower_if then
devices[lower_if] = { nobridge = true }
devices[dev] = {}
utils.log( "network.scandevices.dev_parser found WAN port %s " ..
"and marking %s as nobridge", dev, lower_if )
end
end
if dev:match("^wlan%d+"..wireless.wifiModeSeparator.."%w+$") then

@ilario
Copy link
Member Author

ilario commented Sep 24, 2024

Analysing the targets that we usually use (ath79|ipq40xx|ipq806x|mediatek|ramips|x86), I found these strings that looks like interface names:

"eth5" | https://github.com/openwrt/openwrt/tree/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts#L72
"ethblack" "ethblue" | https://github.com/openwrt/openwrt/tree/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts#L150-L155
"ethernet" | https://github.com/openwrt/openwrt/tree/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/ramips/dts/mt7621_dlink_covr-x1860-a1.dts#L200
"ethernet2" | https://github.com/openwrt/openwrt/blob/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-pa2200.dts#L235
"game" | https://github.com/openwrt/openwrt/tree/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts#L350
"internet" | https://github.com/openwrt/openwrt/tree/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/ramips/dts/mt7621_dlink_covr-x1860-a1.dts#L195
"lan" | https://github.com/openwrt/openwrt/tree/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/ramips/dts/mt7621_zyxel_nr7101.dts#L170
"lan8" | https://github.com/openwrt/openwrt/tree/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/ath79/dts/ar7242_ubnt_edgeswitch-8xp.dts#L158
"modem" | https://github.com/openwrt/openwrt/tree/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/ramips/dts/mt7621_bolt_arion.dts#L173
"sw-eth3" | https://github.com/openwrt/openwrt/blob/main/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c2.dts#L179
"swp1" | https://github.com/openwrt/openwrt/tree/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/ramips/dts/mt7621_arcadyan_we420223-99.dts#L195
"wan" | https://github.com/openwrt/openwrt/tree/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts#L79
"wan1" | https://github.com/openwrt/openwrt/tree/d84fecfaf2f140786ad4dd971c69660b1deae942/target/linux/ramips/dts/mt7621_mqmaker_witi.dts@L161

@G10h4ck
Copy link
Member

G10h4ck commented Sep 24, 2024

I hope at some point all, ethernet, wireless and usable devices which are embedded into the boeard, will be reported in board.json or in device tree, at that point we will not need anymore this filtering euristic, except maybe for pluggagle wifi or ethernet interfaces which usually doesn't have much complication like swconfig based switches (which we need to keep supporting as not all devices are DSA enabled)

@pony1k
Copy link
Contributor

pony1k commented Sep 26, 2024

I propose we extract interface names from /etc/board.json.

Every device that I encountered so far had their ethernet interfaces correctly listed in board.json.

Here is a bash script that generates an approximate board.json for a given board_name using the openwrt/rootfs docker image: https://gist.github.com/pony1k/589cabfe3afa710adc8ec07d5ba2165a

All devices @ilario listed seem to have correct board.json:

./board-generate.sh ubnt,edgerouter-x-sfp
./board-generate.sh gnubee,gb-pc2
./board-generate.sh dlink,covr-x1860-a1
./board-generate.sh plasmacloud,pa2200
./board-generate.sh acer,predator-w6
./board-generate.sh dlink,covr-x1860-a1
./board-generate.sh zyxel,nr7101
./board-generate.sh ubnt,edgeswitch-8xp ath79/generic
./board-generate.sh qxwlan,e2600ac-c2
./board-generate.sh arcadyan,we420223-99
./board-generate.sh tplink,tl-wr941-v2 ath79/tiny
./board-generate.sh mqmaker,witi

@G10h4ck , do you have an example of a device where board.json is incorrect for ethernet interfaces?

@G10h4ck
Copy link
Member

G10h4ck commented Sep 27, 2024

As an example a device with an extra USB ethernet device plugged by the user.

@ilario
Copy link
Member Author

ilario commented Nov 7, 2024

Amazing work @pony1k , thanks!
Regarding the USB ethernet, which would be the interface name? Does the current code manages it correctly?

@ilario
Copy link
Member Author

ilario commented Dec 7, 2024

Regarding the USB ethernet, which would be the interface name? Does the current code manages it correctly?

@G10h4ck if the board.json solution is better than the current one and has no drawbacks (the USB sticks are not supported currently) I would support the board.json approach.

The user experience when using a router with these interface names is terrible, see #1151.

So I would say we should fix this before making the release.

@ilario ilario added this to Releases Dec 7, 2024
@ilario ilario added this to the 2024.1 milestone Dec 7, 2024
@pony1k
Copy link
Contributor

pony1k commented Dec 8, 2024

I'm only 99% sure, but I think the additional interfaces from USB dongles get names like eth0, eth1, etc. Those could be additionally collected to the ports found in board.json. Ideally, DSA conduit ports should be ignored. It would also be nice just in case to accept arbitrary names in port specific configurations, as long as they exist in /sys/class/net. So, if for whatever reason, there is a network interface called 'foo' that isn't listed in board.json, it would still be possible to configure it using config net and option linux_name foo.

pony1k added a commit to pony1k/lime-packages that referenced this issue Dec 10, 2024
- Scrape configurable network devices from /etc/board.json.
- Avoid configuration on DSA conduit devices.
- Allow device specific configuration for network devices with
  arbitrary names.
- Remove 'nobridge' tag.
- Add 'dsa' tag for DSA user ports.

fixes libremesh#1132
@pony1k pony1k linked a pull request Dec 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants