fixes AREDN->ticket:172

Change-Id: I0db2dbc14283c2458a55b4e75ca25ce95d867b5b
This commit is contained in:
Darryl Quinn 2016-06-14 13:25:05 -05:00
parent 6e2a56b106
commit d45bbb9dea
1 changed files with 1 additions and 15 deletions

View File

@ -145,27 +145,13 @@ print "]";
if($parms{"hosts"} ) if($parms{"hosts"} )
{ {
# Get a list of services, so we can remove them from the host list
foreach(`cat /var/run/services_olsr`)
{
$line = $_;
if ($line =~ /http:\/\/(.*):([0-9]*)\/.*$/ )
{
if ( $2 > 0 ) # don't filter nodes with a gateway attached
{
$services{$1} = 1;
}
}
}
print ",\"hosts\":["; print ",\"hosts\":[";
$mystr=""; $mystr="";
foreach(`cat /var/run/hosts_olsr`) foreach(`cat /var/run/hosts_olsr`)
{ {
$line = $_; $line = $_;
next unless /^(\d+\.\d+\.\d+\.\d+)\s*(\S+)/; next unless /^(\d+\.\d+\.\d+\.\d+)\s*(\S+)/;
if ( not $services{$2} and $line !~ /dtdlink|mid1\./ ) { if ($line !~ /dtdlink|mid[0-9]+\./ ) {
#if ( not $services{$2} and $line !~ /dtdlink/ ) {
$mystr .= sprintf "{\"name\":\"%s\",\"ip\":\"%s\"},",$2,$1; $mystr .= sprintf "{\"name\":\"%s\",\"ip\":\"%s\"},",$2,$1;
} }
} }