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

draft: Scrape device names from board.json #1154

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pony1k
Copy link
Contributor

@pony1k pony1k commented 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. This is more intuitive from a users perpective. Before, devices whose names don't match certain patterns were ignored. This could be helpful for network devices with unforseen names.
  • Remove 'nobridge' tag, as this seems no longer be needed.
  • Add optional parameter 'port' to utils.is_dsa().
  • Add 'dsa' tag for DSA user ports. This could be used to fi_x Problems with ethernet connections between routers in default configuration #1121 like suggested by @ilario in this comment.

fixes #1132

Allow to check if a specific port is a DSA user port. Without arguments
the function behaviour does not change.
- 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.
@pony1k
Copy link
Contributor Author

pony1k commented Dec 10, 2024

I have tested the following:

  • DSA ports with specific configuration.
  • DSA ports without specific configuration.
  • DSA conduit does not get configured.
  • dummy ethernet port 'eth9' gets automatically configured.
  • dummy network device called 'foobar' gets configured iff there is a specific config net option linux_name 'foobar' section for it.
  • 'eth0' is ignored on a swconfig device.
  • 'eth0.1' and 'eth0.2' are configured with and without specific configuration.

To create the dummy devices, I installed 'kmod-dummy' and then ran ip link add foobar type dummy.
It would be good to test this a little bit more. Maybe also on a PlasmaCloud PA1200, if someone has one available.

@ilario
Copy link
Member

ilario commented Dec 16, 2024

This looks amazing :D

I flashed 3 routers with this and here you are the outputs of lime-report (beware that I included in the flashed images all the pull requests currently open):

A PlasmaCloud PA1200:
lime-report-20241215-PA1200-libremesh.txt
There is a 192.168.1.2 IPv4, but I vaguely recall I may have set it manually myself.
You can take as a reference the file here: #1151 (comment)

A TP-Link WDR3600:
lime-report-20241215-WDR3600-libremesh.txt

A YouHua WR1200JS:
lime-report-20241215-YouHua-libremesh.txt

If you consider useful to have some references good for comparisons, I can flash images with and without this pull request, just let me know!

With this code, the ethernet1 and ethernet2 interfaces from the PlasmaCloud device are correctly configured! :D

One doubt:
In the TP-Link WDR3600, the batctl if output includes the ethernet interfaces, while in the YouHua WR1200JS it includes just the WAN port (additionally to the wifi interfaces that are always there) and on the PlasmaCloud PA1200 it does not include any cabled interface. I suppose this is because the YouHua WAN port was connected to the ISP router while the LAN ports were unused? And also on the PA1200, while I tested there was nothing connected via cable. I will have to check connecting cables.

@ilario
Copy link
Member

ilario commented Dec 16, 2024

Adding the report from a Ubiquiti NanoStation LoCo M2 XM (with just 32 MB of RAM, so I had to create a very minimal image).
The device has only one ethernet interface, identified in OpenWrt as LAN.

lime-report-20241216-NanoStation_Loco_M2_XM-libremesh_bis.txt

@pony1k
Copy link
Contributor Author

pony1k commented Dec 18, 2024

One doubt:
In the TP-Link WDR3600, the batctl if output includes the ethernet interfaces, while in the YouHua WR1200JS it includes just the WAN port (additionally to the wifi interfaces that are always there) and on the PlasmaCloud PA1200 it does not include any cabled interface. I suppose this is because the YouHua WAN port was connected to the ISP router while the LAN ports were unused? And also on the PA1200, while I tested there was nothing connected via cable. I will have to check connecting cables.

Interfaces are added to batadv when they are up and removed when they are down. On WDR3600, eth0 is always up, because it's connected to the switch. So this is expected.

One thing that at first striked me as odd is that with PlasmaCloud PA1200, without patch it has

config interface 'wan'
	option device 'ethernet2'
	option proto 'none'

and with patch it has

config interface 'wan'
	option device 'ethernet2'
	option proto 'dhcp'

. But this is expected too, because

function wan.configure(args)
if wan.configured then return end
wan.configured = true
local uci = libuci:cursor()
uci:set("network", "wan", "interface")
uci:set("network", "wan", "proto", "dhcp")
uci:save("network")
end

is only run when there is an actual interface configured with lime-proto-wan (which does not happen without the patch), while
function network.clean()
utils.log("Clearing network config...")
local uci = config.get_uci_cursor()
uci:delete("network", "globals", "ula_prefix")
uci:set("network", "wan", "proto", "none")
uci:set("network", "wan6", "proto", "none")

is always run.

All reports look good to me.

@ilario
Copy link
Member

ilario commented Dec 18, 2024

Great!
I tried small network with some cabled connections and I can confirm that it works as it should :D

The network was like this:

ISP router --cable-- TP-Link WDR3600 --wifi-- (Ubiquiti NanoStation LoCo M2 XM --cable-- LAN3 YouHua WR1200JS LAN1 --cable-- LAN PlasmaCloud PA1200)

I did not configure the ethernet interfaces manually, so I would also expect some issues due to #1121.

The internet connection was not working due to a new issue #1157. No idea what caused this new issue.

The report from the Ubiquiti NanoStation LoCo M2 XM is incomplete as, in this network, it was frequently rebooting.

lime-report-20241218-YouHua-libremesh.txt

lime-report-20241218-WDR3600-libremesh.txt

lime-report-20241218-PA1200-libremesh.txt

lime-report-20241218-NanoStation_Loco_M2_XM-libremesh.txt

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.

Consider new interface names
2 participants