libremesh / lime-packages

LibreMesh packages configuring OpenWrt for wireless mesh networking
https://libremesh.org/
GNU Affero General Public License v3.0
280 stars 96 forks source link

Consider new interface names #1132

Open ilario opened 1 month ago

ilario commented 1 month ago

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:

https://github.com/libremesh/lime-packages/blob/d5befee61083bea0af7a29b6f0119f35dfdd7473/packages/lime-system/files/usr/lib/lua/lime/network.lua#L234-L271

ilario commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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

ilario commented 5 days ago

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