Skip to content

fix: anygw not working via cable in dsa devices#1214

Open
a-gave wants to merge 2 commits intolibremesh:masterfrom
a-gave:fix/anygw-dsa-mac
Open

fix: anygw not working via cable in dsa devices#1214
a-gave wants to merge 2 commits intolibremesh:masterfrom
a-gave:fix/anygw-dsa-mac

Conversation

@a-gave
Copy link
Contributor

@a-gave a-gave commented Aug 27, 2025

Fix #1192. In dsa devices if another libremesh node is connected via cable
anygw starts working intermittently for hosts connected via cable

Manually adjust the bridge fdb, as suggested here [0], with an /etc/hotplug.d/net trigger
adding an entry that states that the anygw mac address can be found locally on device br-lan

Then add a nftables guard rule that drop packets with ether source address equal to the anygw_mac
on every dsa user ports that is member of br-lan to prevent icmp6 broadcast loops.

To use the command bridge it is necessary to add the package ip-bridge ~30KB.
This wouldn't be required in swconfig devices but an easy way to distinguish between dsa and swconfig devices
at compile time doesn't exists at the moment.

[0] https://www.kernel.org/doc/html/latest/networking/dsa/configuration.html#forwarding-database-fdb-management

@a-gave a-gave force-pushed the fix/anygw-dsa-mac branch 2 times, most recently from 1340203 to 6830dfe Compare August 27, 2025 20:33
@a-gave a-gave force-pushed the fix/anygw-dsa-mac branch from 6830dfe to e346bf9 Compare August 27, 2025 20:56
@a-gave
Copy link
Contributor Author

a-gave commented Sep 15, 2025

fixed a typo ip-bridge to +ip-bridge
edit: and rebased

Fix libremesh#1192. In dsa devices if another libremesh node is connected via cable
anygw starts working intermittently for hosts connected via cable

Manually adjust the bridge fdb, as suggested here [0], with an /etc/hotplug.d/net trigger
adding an entry that states that the anygw mac address can be found locally on device br-lan

Then add a nftables guard rule that drop packets with ether source address equal to the anygw_mac
on every dsa user ports that is member of br-lan to prevent icmp6 broadcast loops.

To use the command bridge it is necessary to add the package ip-bridge ~30KB.
This wouldn't be required in swconfig devices but an easy way to distinguish between dsa and swconfig devices
at compile time doesn't exists at the moment.

[0] https://www.kernel.org/doc/html/latest/networking/dsa/configuration.html#forwarding-database-fdb-management
some devices using dsa, don't have an bridge called br-lan
instead it is present a configuration like

```
config device 'switch'
	option name 'switch'
	option type 'bridge'

config bridge-vlan 'lan_vlan'
	option device 'switch'
	option vlan '1'
	option ports 'lan1 lan2 lan3 lan4'

config interface 'lan'
	option device 'switch.1'
	...
```

utils.lua should then check lan_vlan's device first, or fallback to br-lan

anygw.lua should configure it's macvlan on top of the device `switch.1` if present
or using the most common 'br-lan'
added then a dynamic retrieval of the right device from `network.lan.device`

tested on:
- dlink,dsl-2750b-b1 (bmips/bcm6328) dsa with switch.1
- tp-link,td-w8968-v3 (bmips/bcm6318) dsa with switch.1
- cudy,wr3000s-v1 (mediatek/filogic) dsa with br-lan
@a-gave
Copy link
Contributor Author

a-gave commented Feb 20, 2026

added a fix for some dsa devices which come up without anygw, and so without a dhcp server, because they miss an interface named 'br-lan' and protocols anygw and lan fail to be configured.

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.

Default anygw route working intermittently via cable

1 participant