From 7d973599eff3a3c52eb558823da1329e311f75f4 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Fri, 22 Feb 2019 21:47:40 +0100 Subject: [PATCH] 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 --- batman-adv/Makefile | 2 +- batman-adv/files/lib/batman-adv/config.sh | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/batman-adv/Makefile b/batman-adv/Makefile index 9ad8210..b47e3b6 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -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 diff --git a/batman-adv/files/lib/batman-adv/config.sh b/batman-adv/files/lib/batman-adv/config.sh index 3d6b884..a74c9d8 100644 --- a/batman-adv/files/lib/batman-adv/config.sh +++ b/batman-adv/files/lib/batman-adv/config.sh @@ -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" -- 2.30.2