diff --git a/files/www/cgi-bin/mesh b/files/www/cgi-bin/mesh index 41ab0b92..a249549b 100755 --- a/files/www/cgi-bin/mesh +++ b/files/www/cgi-bin/mesh @@ -84,6 +84,9 @@ foreach(`echo /all | nc 127.0.0.1 2006 2>$tmperr`) } elsif($table eq "HNA") { + ($iproute, $ip) = split /\s+/, $_; + ($net, $cidr) = split /\//, $iproute; + if ( $net eq "0.0.0.0" ) { $wangateway{$ip} = 1; } } elsif($table eq "MID") { @@ -276,7 +279,12 @@ if(keys %localhosts) { $host = $localhosts{$ip}{name}; $tactical = $localhosts{$ip}{tactical} ? " / " . $localhosts{$ip}{tactical} : ""; - $rows{$host} = sprintf "%s \n", $host . $tactical; + $rows{$host} = sprintf "%s", $host . $tactical; + + if ( $wangateway{$ip} ) { $rows{$host} .= "   (wan)"; } + + $rows{$host} .= " \n" ; + foreach(sort keys %{$services{$host}}) { $rows{$host} .= "" . $services{$host}{$_} . "
\n"; @@ -338,6 +346,8 @@ foreach $ip (keys %hosts) if ( $midcount{$ip} ) { $midcount{$ip} -= 1; } # extra mid entry matching and with dtdlink in hosts_olsrd } if ( $midcount{$ip} ) { $nodeiface = $nodeiface ? "dtd," . "tun*$midcount{$ip}" : "tun*$midcount{$ip}" ; } + if ( $wangateway{$ip} ) { $nodeiface = $nodeiface ? $nodeiface . ",wan" : "wan" ; } + if ( $nodeiface ) { $rows{$host} .= "   ($nodeiface)"; } $rows{$host} .= sprintf "%s\n", $etx; @@ -390,15 +400,17 @@ if(keys %links) $rows{$host} = sprintf "%s", $host, $host . $tactical; + undef $nodeiface; if ( $ipmain ne $ip ) # indicate if dtd or tunnel interface to neighbor { - if ( $hosts{$ip}{name} =~ /^dtdlink\..*$/ ){ $linktype="dtd" ; } - elsif ( $hosts{$ip}{name} =~ /^mid\d+\..*$/ ) { $linktype="tun" ; } - else { $linktype="?" ; } - - $rows{$host} .= "   ($linktype)"; + if ( $hosts{$ip}{name} =~ /^dtdlink\..*$/ ){ $nodeiface="dtd" ; } + elsif ( $hosts{$ip}{name} =~ /^mid\d+\..*$/ ) { $nodeiface="tun" ; } + else { $nodeiface="?" ; } } + if ( $wangateway{$ip} or $wangateway{$ipalias{$ip}} ) { $nodeiface = $nodeiface ? $nodeiface . ",wan" : "wan" ; } + if ( $nodeiface ) { $rows{$host} .= "   ($nodeiface)"; } + $rows{$host} .= sprintf ("%.0f%%%.0f%%\n", 100*$links{$ip}{lq}, 100*$links{$ip}{nlq}); if ( ! exists $neighservices{$host} ) @@ -485,16 +497,13 @@ if($debug) } print "\nhosts\n"; - #foreach $ip (sort keys %hosts) - foreach $ip (sort { $hosts{$a}{etx} <=> $hosts{$b}{etx} } keys %hosts) + foreach $ip (sort keys %hosts) { $hosts{$ip}{name} = "" unless $hosts{$ip}{name}; printf "%s %s", $ip, $hosts{$ip}{name}; printf "/%s", $hosts{$ip}{tactical} if $hosts{$ip}{tactical}; foreach(@{$hosts{$ip}{hosts}}) { print ":$_" } printf(" %d", $hosts{$ip}{mid}) if $hosts{$ip}{mid}; - print "\n"; - print "ETX=$hosts{$ip}{etx}\n"; } print "\nlinks\n";