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>
PKG_NAME:=batman-adv
PKG_VERSION:=2019.0
PKG_NAME:=batman-adv
PKG_VERSION:=2019.0
PKG_HASH:=3e97d8a771cdbd7b2df42c52b88e071eaa58b5d28eb4e17a4b13b6698debbdc0
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_HASH:=3e97d8a771cdbd7b2df42c52b88e071eaa58b5d28eb4e17a4b13b6698debbdc0
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
[ -n "$distributed_arp_table" ] && batctl -m "$mesh" distributed_arp_table "$distributed_arp_table" 2>&-
[ -n "$fragmentation" ] && batctl -m "$mesh" fragmentation "$fragmentation"
[ -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"
[ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty
[ -n "$isolation_mark" ] && batctl -m "$mesh" isolation_mark "$isolation_mark"