gluon-respondd: add delay to mesh-wide multicast requests

Mesh-wide multicast requests are answered with a random delay of up to 10s.
This commit is contained in:
Matthias Schiffer 2016-12-11 00:42:41 +01:00
parent f2524ee179
commit 9a06a98651
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -4,17 +4,22 @@ USE_PROCD=1
START=50
DAEMON=/usr/bin/respondd
MAXDELAY=10
start_service() {
DEVS=""
for dev in $( ubus call network.interface dump | jsonfilter \
-e "@.interface[@.proto='gluon_mesh' && @.up=true].device" \
-e "@.interface[@.interface='$(cat /lib/gluon/respondd/client.dev 2>/dev/null)' && @.up=true].device")
do
DEVS="$DEVS -i $dev"
local ifdump="$(ubus call network.interface dump)"
local devs=''
local dev
for dev in $(echo "$ifdump" | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device"); do
devs="$devs -i $dev"
done
for dev in $(echo "$ifdump" | jsonfilter -e "@.interface[@.interface='$(cat /lib/gluon/respondd/client.dev 2>/dev/null)' && @.up=true].device"); do
devs="$devs -i $dev -t $MAXDELAY"
done
procd_open_instance
procd_set_param command $DAEMON -g ff02::2:1001 -p 1001 -d /lib/gluon/respondd $DEVS
procd_set_param command $DAEMON -g ff02::2:1001 -p 1001 -d /lib/gluon/respondd $devs
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
procd_set_param stderr 1
procd_close_instance