From b4101e54e0122099619b70310456ef5dca0bd2c1 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 24 Nov 2019 01:10:59 +0100 Subject: [PATCH] gluon-mesh-batman-adv: remove remaining deprecated sysfs usage While we're at it, also slightly optimize proto_gluon_bat0_renew. --- .../core/mesh/teardown.d/70-gluon-mesh-batman-adv | 2 +- .../files/lib/netifd/proto/gluon_bat0.sh | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/core/mesh/teardown.d/70-gluon-mesh-batman-adv b/package/gluon-mesh-batman-adv/files/lib/gluon/core/mesh/teardown.d/70-gluon-mesh-batman-adv index 355b89b0..a8850f18 100755 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/core/mesh/teardown.d/70-gluon-mesh-batman-adv +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/core/mesh/teardown.d/70-gluon-mesh-batman-adv @@ -1,5 +1,5 @@ #!/bin/sh lock /var/lock/gluon_bat0.lock -(echo 'none' > "/sys/class/net/$IFNAME/batman_adv/mesh_iface") 2>/dev/null +batctl interface del "$IFNAME" 2>/dev/null lock -u /var/lock/gluon_bat0.lock 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 97cd343a..f5c54ea3 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 @@ -22,15 +22,9 @@ proto_gluon_bat0_renew() { lock /var/lock/gluon_bat0.lock - local ifdump="$(ubus call network.interface dump)" - - echo "$ifdump" | jsonfilter \ - -e "@.interface[@.proto='gluon_mesh' && @.up=true]['device','data']" \ - | while read dev; do - read data - - echo bat0 > "/sys/class/net/$dev/batman_adv/mesh_iface" - done + ubus call network.interface dump | jsonfilter \ + -e "@.interface[@.proto='gluon_mesh' && @.up=true].device" \ + | xargs -r -n 1 batctl interface add lock -u /var/lock/gluon_bat0.lock }