bugfix: station listing includes nodes that have not been seen for some time

Also resolves the "0" signal strength as nodes that have not been seen in long time show up as a 0 for signal.

This is a regression of the issues seen on the iw scan but in this case applies to station dump which we have not used before.
This commit is contained in:
Conrad Lara - KG6JEI 2015-09-04 22:11:00 -07:00
parent ba3f3b9b16
commit c7bde9712a
1 changed files with 8 additions and 3 deletions

View File

@ -221,6 +221,7 @@ while(1)
$mode = "Connected Ad-Hoc Station";
$signal = 0;
$key = "";
$lastseen = 0;
++$iters;
open(FILE, "/usr/sbin/iw $iface station dump 2>&1 |") or die "/usr/sbin/iw failed";
@ -229,7 +230,9 @@ while(1)
{
if($line =~ /Station (\S+) \(on $iface\)/)
{
pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode);
if ( $lastseen < 10000 ) { pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode) }
$lastseen = 0;
$mac = $1;
$ip = `grep $mac /proc/net/arp | egrep "^10.*\$" | tail -1`;
$mac = uc $mac;
@ -247,11 +250,13 @@ while(1)
else { $host = "????" }
}
if($line =~ /signal avg:[ \t]+([-\d]+)/) { $signal = $1 }
if($line =~ /signal avg:[ \t]+([-\d]+)/) { $signal = $1 }
if($line =~ /inactive time:\t(\d+) ms/) { $lastseen = $1 }
}
close(FILE);
pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode);
if ( $lastseen < 10000 ) { pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode) }
sleep 1 if not scalar @list and $loops != 1;
if(not $batch)