Skip to content

Commit

Permalink
gluon-mesh-batman-adv: enable routing algorithm configuration through…
Browse files Browse the repository at this point in the history
… site.conf

[Matthias Schiffer: move to proto_gluon_bat0_setup() and default to BATMAN_IV]
  • Loading branch information
ambassador86 authored and neocturne committed Jul 19, 2017
1 parent e8a7332 commit 582d096
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package/gluon-mesh-batman-adv/check_site.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
if need_table('mesh', nil, false) and need_table('mesh.batman_adv', nil, false) then
need_number('mesh.batman_adv.gw_sel_class', false)
need_number('mesh.batman_adv.gw_sel_class', false)
need_one_of('mesh.batman_adv.routing_algo', {'BATMAN_IV', 'BATMAN_V'}, false)
end
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ proto_gluon_bat0_setup() {
ip link add primary0 type dummy
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

echo bat0 > /sys/class/net/primary0/batman_adv/mesh_iface

proto_init_update primary0 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ if site.mesh and site.mesh.batman_adv then
gw_sel_class = site.mesh.batman_adv.gw_sel_class
end

local routing_algo
if site.mesh and site.mesh.batman_adv then
routing_algo = site.mesh.batman_adv.routing_algo
end

uci:delete('batman-adv', 'bat0')
uci:section('batman-adv', 'mesh', 'bat0', {
orig_interval = 5000,
gw_mode = 'client',
gw_sel_class = gw_sel_class,
hop_penalty = 15,
routing_algo = routing_algo,
multicast_mode = false,
})
uci:save('batman-adv')
Expand Down

0 comments on commit 582d096

Please sign in to comment.