gluon-l3roamd: utilize node_client_prefix6 from site, add checks

* add check_site.lua to validate required field from site
* make use of node_client_prefix6 if defined in site
This commit is contained in:
Christof Schulze 2019-09-08 16:06:00 +02:00
parent a96f996e1b
commit 59b7625e54
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,3 @@
need_string_match(in_domain({'prefix6'}), '^[%x:]+/64$', true)
need_string_match(in_domain({'node_client_prefix6'}), '^[%x:]+/64$', false)
need_string_match(in_domain({'prefix4'}), '^%d+.%d+.%d+.%d+/%d+$', false)

View File

@ -39,6 +39,12 @@ start_service () {
for dev in $(gluon-list-mesh-interfaces); do echo " -m $dev"; done for dev in $(gluon-list-mesh-interfaces); do echo " -m $dev"; done
[ "$(ifstatus local_node | jsonfilter -e '@.up')" = 'true' ] && echo ' -i local-node' [ "$(ifstatus local_node | jsonfilter -e '@.up')" = 'true' ] && echo ' -i local-node'
) )
local prefix4="$(lua -e 'prefix4 = require("gluon.site").prefix4() if prefix4 then print(" -p " .. prefix4) end')"
local prefix6="$(lua -e 'print(" -p " .. require("gluon.site").prefix6())')"
local localip="$(uci get network.loopback.ip6addr | cut -d/ -f1)"
local roamingprefix="$(lua -e 'roamingprefix = require("gluon.site").node_client_prefix6() if roamingprefix then print(" -P " .. roamingprefix) end')"
/sbin/sysctl -w net.ipv6.neigh.default.gc_thresh1=2 /sbin/sysctl -w net.ipv6.neigh.default.gc_thresh1=2
/sbin/sysctl -w net.ipv4.neigh.default.gc_thresh1=2 /sbin/sysctl -w net.ipv4.neigh.default.gc_thresh1=2
@ -46,7 +52,7 @@ start_service () {
procd_set_param stdout 1 procd_set_param stdout 1
procd_set_param stderr 1 procd_set_param stderr 1
procd_set_param respawn ${respawn_threshold:-3660} ${respawn_timeout:-5} ${respawn_retry:-0} procd_set_param respawn ${respawn_threshold:-3660} ${respawn_timeout:-5} ${respawn_retry:-0}
procd_set_param command "$PROG" -s /var/run/l3roamd.sock -p $(lua -e 'print(require("gluon.site").prefix6())') $interfaces -t 254 -a $(uci get network.loopback.ip6addr | cut -d/ -f1) -4 0:0:0:0:0:ffff::/96 -b br-client procd_set_param command "$PROG" -s /var/run/l3roamd.sock $prefix4 $prefix6 $interfaces -t 254 -a $localip -b br-client $roamingprefix
procd_close_instance procd_close_instance
} }