From 778bf905610b80b8d735ad5902e2bee29e75b833 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 20 Apr 2020 23:35:07 +0200 Subject: [PATCH] gluon-mesh-batman-adv: add UCI setting for hop penalty Add a UCI setting gluon.mesh_batman_adv.hop_penalty Example UCI commands: uci set gluon.mesh_batman_adv=mesh_batman_adv uci set gluon.mesh_batman_adv.hop_penalty=20 uci commit `/etc/config/gluon` config section: config mesh_batman_adv 'mesh_batman_adv' option hop_penalty '20' Fixes: #1942 --- .../files/lib/netifd/proto/gluon_bat0.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh b/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh index f5c54ea342..dfcdebdd71 100755 --- a/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh +++ b/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh @@ -17,6 +17,11 @@ lookup_site() { lua -e "print(require('gluon.site').$path('$default'))" } +lookup_uci() { + local path="$1" default="$2" + uci -q get "$path" || echo "$default" +} + proto_gluon_bat0_renew() { local config="$1" @@ -41,7 +46,7 @@ proto_gluon_bat0_setup() { batctl interface create batctl orig_interval 5000 - batctl hop_penalty 15 + batctl hop_penalty "$(lookup_uci 'gluon.mesh_batman_adv.hop_penalty' 15)" batctl multicast_mode 0 case "$gw_mode" in