diff --git a/package/gluon-mesh-batman-adv-core/files/lib/gluon/respondd/client.dev b/package/gluon-mesh-batman-adv-core/files/lib/gluon/respondd/client.dev new file mode 100644 index 00000000..30594e2c --- /dev/null +++ b/package/gluon-mesh-batman-adv-core/files/lib/gluon/respondd/client.dev @@ -0,0 +1 @@ +br-client diff --git a/package/gluon-respondd/files/etc/hotplug.d/iface/10-gluon-respondd b/package/gluon-respondd/files/etc/hotplug.d/iface/10-gluon-respondd index 4f49be52..564559e7 100644 --- a/package/gluon-respondd/files/etc/hotplug.d/iface/10-gluon-respondd +++ b/package/gluon-respondd/files/etc/hotplug.d/iface/10-gluon-respondd @@ -1,34 +1,16 @@ #!/bin/sh -. /usr/share/libubox/jshn.sh . /lib/functions/service.sh -DEVLIST=/var/run/gluon-respondd.devs - ifname_to_dev () { - json_load "$(ubus call network.interface.$1 status)" - json_get_var dev device - - echo "$dev" + ifstatus client "$1"|jsonfilter -e "@.device" } case "$ACTION" in - ifdown) - sed "/ $INTERFACE$/d" $DEVLIST > $DEVLIST.new - mv $DEVLIST.new $DEVLIST - ;; ifup) DEVICE="$(ifname_to_dev "$INTERFACE")" - MESH="$(cat "/sys/class/net/$DEVICE/batman_adv/mesh_iface" 2>/dev/null)" - - [ "$MESH" = "bat0" -o "$INTERFACE" = "client" ] || exit 0 - - DEVS=$(cat $DEVLIST 2>/dev/null; echo $DEVICE $INTERFACE) - - echo "$DEVS" | sort -u > $DEVLIST.new - mv $DEVLIST.new $DEVLIST - - /etc/init.d/gluon-respondd restart_if_running & + [ "$DEVICE" != "$(cat /lib/gluon/respondd/client.dev 2>/dev/null)" ] || + /etc/init.d/gluon-respondd restart_if_running & ;; esac diff --git a/package/gluon-respondd/files/etc/init.d/gluon-respondd b/package/gluon-respondd/files/etc/init.d/gluon-respondd index a1bf979f..49afef4f 100755 --- a/package/gluon-respondd/files/etc/init.d/gluon-respondd +++ b/package/gluon-respondd/files/etc/init.d/gluon-respondd @@ -7,13 +7,16 @@ START=50 SERVICE_WRITE_PID=1 SERVICE_DAEMONIZE=1 -DEVLIST=/var/run/gluon-respondd.devs DAEMON=/usr/bin/respondd LOCK=/var/run/gluon-respondd.lock do_start() { - DEVS=$(cat $DEVLIST 2>/dev/null | while read dev iface; do echo -n " -i $dev"; done) + DEVS="" + for dev in $( ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device") $(cat /lib/gluon/respondd/client.dev 2>/dev/null) + do + DEVS="$DEVS -i $dev" + done service_start $DAEMON -g ff02::2:1001 -p 1001 -d /lib/gluon/respondd $DEVS } diff --git a/package/gluon-respondd/files/lib/gluon/core/mesh/setup.d/10-gluon-respondd b/package/gluon-respondd/files/lib/gluon/core/mesh/setup.d/10-gluon-respondd new file mode 100755 index 00000000..811386e0 --- /dev/null +++ b/package/gluon-respondd/files/lib/gluon/core/mesh/setup.d/10-gluon-respondd @@ -0,0 +1,2 @@ +#!/bin/sh +/etc/init.d/gluon-respondd restart_if_running &