bugfix: snrlog better handle neighbor references from mac to ip to hostname

This commit is contained in:
AE6XE 2015-12-30 17:57:49 -08:00
parent cc6d4ee550
commit 38209b0af2
2 changed files with 22 additions and 12 deletions

View File

@ -1,4 +1,4 @@
*/5 * * * * /usr/local/bin/fccid
*/1 * * * * /usr/local/bin/rssi_monitor
* * * * * /usr/local/bin/rssi_monitor
* * * * * /usr/local/bin/snrlog

View File

@ -62,19 +62,29 @@ if (! -e $tmpdir ) { system("mkdir $tmpdir > /dev/null"); }
$d = sprintf ("%02d/%02d %02d:%02d:%02d",$mon+1, $mday,$hour, $min, $sec);
chomp ($now=`cat /proc/uptime | cut -f1 -d" "`);
foreach $sigmac ( `ls $sigdir` )
foreach $sigmac ( glob "$sigdir/*" )
{
$sigmac =~ s/^.*\///;
chomp $sigmac;
$isFile = "";
$hnamef = "";
$ipsig = "";
$macfname = "";
$macfname = `ls $tmpdir/$sigmac*` ;
$macfname =~ /^.*\/([^-]*)-(.*)$/;
$isFile = $1;
$hnamef = $2;
chomp ($ipsig = `cat /proc/net/arp | grep $sigmac | cut -f1 -d\" "`);
@maclist = glob "$tmpdir/$sigmac*";
if (@maclist) { $macfname = $maclist[-1]; }
else { $macfname = ""; }
if ($macfname)
{
$macfname =~ /^.*\/([^-]*)-(.*)$/ ;
$isFile=$1;
$hnamef=$2;
}
else
{
$macfname = "";
$isFile = "";
$hnamef = "";
}
$ipsig = "";
chomp ($ipsig = `cat /proc/net/arp | grep $sigmac | grep 'wlan0' | cut -f1 -d\" "`);
$hname="";
foreach(`nslookup $ipsig`)
{
@ -83,7 +93,7 @@ foreach $sigmac ( `ls $sigdir` )
break;
}
if (($hnamef and $hnamef eq $hname ) or ($hname and ! $isFile ))
if (($hnamef and $hnamef eq $hname ) or ($hname and $isFile eq "" ))
{
$sigdat = "$sigmac-$hname";
}