mirror of https://github.com/aredn/aredn.git
fixes AREDN->ticket:172
Change-Id: I0db2dbc14283c2458a55b4e75ca25ce95d867b5b
This commit is contained in:
parent
6e2a56b106
commit
d45bbb9dea
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue