batman-adv: use batctl for configuration of gw_mode

The batctl tool should be used for modifying settings in the batman-adv
driver to keep the scripts consistent and allow to use the correct way of
communicating with the kernel (sysfs vs. netlink).

The gw_mode, gw_bandwidth and gw_sel_class options are all handled by
the same gw_mode command in batctl and thus have to be combined depending
on the "gw_mode" value.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
Sven Eckelmann 2019-02-22 21:47:40 +01:00
parent ad27ee7f9a
commit 7d973599ef
2 changed files with 21 additions and 4 deletions

View File

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=batman-adv
PKG_VERSION:=2019.0
PKG_RELEASE:=0
PKG_RELEASE:=1
PKG_HASH:=3e97d8a771cdbd7b2df42c52b88e071eaa58b5d28eb4e17a4b13b6698debbdc0
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz

View File

@ -40,9 +40,26 @@ bat_config()
[ -n "$distributed_arp_table" ] && batctl -m "$mesh" distributed_arp_table "$distributed_arp_table" 2>&-
[ -n "$fragmentation" ] && batctl -m "$mesh" fragmentation "$fragmentation"
[ -n "$gw_bandwidth" ] && echo $gw_bandwidth > /sys/class/net/$mesh/mesh/gw_bandwidth
[ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode
[ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class
case "$gw_mode" in
server)
if [ -n "$gw_bandwidth" ]; then
batctl -m "$mesh" gw_mode "server" "$gw_bandwidth"
else
batctl -m "$mesh" gw_mode "server"
fi
;;
client)
if [ -n "$gw_sel_class" ]; then
batctl -m "$mesh" gw_mode "client" "$gw_sel_class"
else
batctl -m "$mesh" gw_mode "client"
fi
;;
*)
batctl -m "$mesh" gw_mode "off"
;;
esac
[ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty
[ -n "$isolation_mark" ] && batctl -m "$mesh" isolation_mark "$isolation_mark"