libremesh / lime-packages

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

batman-adv-auto-gw-mode sets non-existing batman-adv uci setting #972

Open ilario opened 1 year ago

ilario commented 1 year ago

When installing batman-adv-auto-gw-mode on OpenWrt 19.07 or on OpenWrt 22.03 I get:

# opkg install batman-adv-auto-gw-mode
Installing batman-adv-auto-gw-mode (2023-01-18-1674064414) to root...
Downloading http://10.13.0.2:8000/packages/mipsel_24kc/libremesh/batman-adv-auto-gw-mode_2023-01-18-1674064414_all.ipk
Configuring batman-adv-auto-gw-mode.
uci: Entry not found
uci: Entry not found

and the two errors are caused by these commands: https://github.com/libremesh/lime-packages/blob/acc9166c4ddf4e2db9598b5a15ea8c0877292fd4/packages/batman-adv-auto-gw-mode/files/etc/uci-defaults/91_batman-adv-auto-gw-mode#L4-L5

ilario commented 1 year ago

Quoting OpenWrt's wiki:

Configuration for batman-adv from 2019.1 and onward is done in /etc/config/network (only). There is no /etc/config/batman-adv file used with current versions.

https://openwrt.org/docs/guide-user/network/wifi/mesh/batman#general

So this is broken since some time, as OpenWrt 19.07 used batman-adv 2019.2 https://github.com/openwrt/routing/blob/openwrt-19.07/batman-adv/Makefile#L12

But it was working on OpenWrt 18.06 as it used batman-adv 2018.1 https://github.com/openwrt/routing/blob/openwrt-18.06/batman-adv/Makefile#L12

ilario commented 1 year ago

From here it seems easy to fix just setting the same option in /etc/config/network under the bat0 interface:

config interface 'bat0'
    option proto 'batadv'
    [...]
    option gw_mode 'off'

https://openwrt.org/docs/guide-user/network/wifi/mesh/batman#associate_batman-adv_with_mesh

Some other interesting info can be located in the documentation of gw_mode:

Gateway mode, if set to server other nodes are notified of that node's internet connection and must be complemented by gw_bandwidth, that notifies the algorithm that server is one of the best paths for internet access. If set to client, the criteria by which batman-adv will choose a gateway(other nodes with gw_mode set as server) is required to be set with gw_sel_class.

https://openwrt.org/docs/guide-user/network/wifi/mesh/batman#batman-adv_options_for_bat0_the_main_mesh_interface

So it is possible that it will not work without gw_bandwidth and gw_sel_class.

ilario commented 1 year ago

Also, and this was broken also in LibreMesh 2020.1, this line https://github.com/libremesh/lime-packages/blob/63630ba7e2818e2147d3477a8f33aa9d97b7dbd7/packages/batman-adv-auto-gw-mode/files/etc/watchping/wan-ok.d/batman-gw#L4

has to point to network.bat0.gw_mode='client' (at least on OpenWrt 19.07, I did not try on other versions).

ilario commented 1 year ago

And this file is not there anymore, still have to check where it went: https://github.com/libremesh/lime-packages/blob/06399e5de7fb7b9d3cf13c19f7bf70accb11299a/packages/batman-adv-auto-gw-mode/files/etc/watchping/wan-ok.d/batman-gw#L5

ilario commented 1 year ago

And this file is not there anymore, still have to check where it went:

https://github.com/libremesh/lime-packages/blob/06399e5de7fb7b9d3cf13c19f7bf70accb11299a/packages/batman-adv-auto-gw-mode/files/etc/watchping/wan-ok.d/batman-gw#L5

Surprise: it is not there because this package does not select-depend on CONFIG_BATMAN_ADV_DEBUGFS, so it has never been there and the /etc/hotplug.d/net/99-batman-gw in:

https://github.com/libremesh/lime-packages/blob/06399e5de7fb7b9d3cf13c19f7bf70accb11299a/packages/batman-adv-auto-gw-mode/files/etc/watchping/wan-ok.d/batman-gw#L5-L8

has never been executed.

I was looking a bit on the rest of the code and a new interface gets generated here https://github.com/libremesh/lime-packages/blob/master/packages/batman-adv-auto-gw-mode/files/etc/uci-defaults/91_batman-adv-auto-gw-mode

with DHCP (so it starts looking for an IP). And stops offering for an IP. But stops offering on the br-lan interface, not on the Anygw's lm_net_br_lan_anygw_if where dnsmasq is running nowadays.

Basically this is an outdated package and unless anyone is willing to adopt it I would propose to eliminate it (or move to an archive directory in this same repository) in favor of the more recent babeld-auto-gw-mode https://github.com/libremesh/lime-packages/tree/06399e5de7fb7b9d3cf13c19f7bf70accb11299a/packages/babeld-auto-gw-mode

Opinions @spiccinini @selankon @G10h4ck @altergui ?