Skip to content

Commit

Permalink
eliminate double scans
Browse files Browse the repository at this point in the history
  • Loading branch information
Adorfer committed Oct 5, 2021
1 parent 1c15299 commit 87189ef
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions gluon-linkcheck/files/lib/gluon/linkcheck/linkcheck.sh
Expand Up @@ -80,17 +80,23 @@ for link in $links; do
linksexist="$linksexist $link"
fi
done
rm /tmp/linkcheck.iwscan.* 2>/dev/null

for linkexist in $linksexist; do
linkname=$(uci get $linkexist.ifname)
bsses=$(iw dev $linkname scan lowpri passive|grep $linkname|wc -l)
sleep 8
iwfile=/tmp/linkcheck.iwscan.$(uci get $linkexist.device)
if [ ! -f $iwfile ] ; then
sleep 4
iw dev $linkname scan lowpri passive > $iwfile
sleep 4
fi
bsses=$(cat $iwfile|grep "BSS .*:.*:.*:.*:.*:.*(on.*)"|wc -l)
unset bssid
bssid=$(uci get $linkexist.mesh_id 2>/dev/null)
if [ -z "$bssid" ] ; then
bssid=$(uci get $linkexist.ssid)
fi
neighbours=$(iw dev $linkname scan lowpri passive|grep $bssid|wc -l)
sleep 2
neighbours=$(cat $iwfile|grep $bssid|wc -l)
checks="neighbours bsses"
for check in $checks; do
wert=$(eval echo \$$check)
Expand Down

0 comments on commit 87189ef

Please sign in to comment.