From b35a2f62ca859749c316d612603b153fdf389df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20L=C3=BCssing?= Date: Sat, 27 Jul 2019 07:40:28 +0200 Subject: [PATCH] gluon-mesh-batman-adv: let gluon_bat0 netifd proto dynamically load module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The module autoload of batman-adv and batman-adv-legacy was removed. Instead the gluon_bat0 netifd protocol script now takes care of loading either the batman-adv or batman-adv-legacy kernel module depending on whether BATMAN_IV/BATMAN_V or BATMAN_IV_LEGACY was selected. Signed-off-by: Linus Lüssing --- .../files/lib/netifd/proto/gluon_bat0.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 5ce051ea..77dba232 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 @@ -42,10 +42,16 @@ proto_gluon_bat0_setup() { echo 1 > /proc/sys/net/ipv6/conf/primary0/disable_ipv6 ip link set primary0 address "$primary0_mac" mtu 1532 up - local routing_algo="$(uci -q get batman-adv.bat0.routing_algo || echo 'BATMAN_IV')" - (echo "$routing_algo" >/sys/module/batman_adv/parameters/routing_algo) 2>/dev/null + local routing_algo="$(lua -e 'print(require("gluon.site").mesh.batman_adv.routing_algo())' || echo 'BATMAN_IV')" - echo bat0 > /sys/class/net/primary0/batman_adv/mesh_iface + if [ "$routing_algo" = "BATMAN_IV_LEGACY" ]; then + modprobe batman-adv-legacy + echo bat0 > /sys/class/net/primary0/batman_adv_legacy/mesh_iface + else + modprobe batman-adv + (echo "$routing_algo" >/sys/module/batman_adv/parameters/routing_algo) 2>/dev/null + echo bat0 > /sys/class/net/primary0/batman_adv/mesh_iface + fi proto_init_update primary0 1 proto_send_update "$config" @@ -58,6 +64,8 @@ proto_gluon_bat0_teardown() { ip link del bat0 ip link del primary0 + + rmmod batman-adv } add_protocol gluon_bat0