Merge branch 'MeshBugfix' into release-3.15.1.0

This commit is contained in:
AE6XE 2015-05-25 10:49:01 -07:00
commit cae4064b48
1 changed files with 24 additions and 10 deletions

View File

@ -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,13 @@ if(keys %localhosts)
{
$host = $localhosts{$ip}{name};
$tactical = $localhosts{$ip}{tactical} ? " / " . $localhosts{$ip}{tactical} : "";
$rows{$host} = sprintf "<tr><td valign=top><nobr>%s</nobr></td><td colspan=3>&nbsp;</td><td>\n", $host . $tactical;
$rows{$host} = sprintf "<tr><td valign=top><nobr>%s</nobr>", $host . $tactical;
if ( $wangateway{$ip} ) { $nodeiface = "wan" ; }
if ( $nodeiface ) { $rows{$host} .= " &nbsp; <small>($nodeiface)</small>"; }
$rows{$host} .= "</td><td colspan=3>&nbsp;</td><td>\n" ;
foreach(sort keys %{$services{$host}})
{
$rows{$host} .= "<nobr>" . $services{$host}{$_} . "</nobr><br>\n";
@ -338,6 +347,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} .= " &nbsp; <small>($nodeiface)</small>"; }
$rows{$host} .= sprintf "</nobr></td><td></td><td align=right valign=top>%s</td><td></td><td>\n", $etx;
@ -387,18 +398,21 @@ if(keys %links)
$ipmain = exists $ipalias{$ip} ? $ipalias{$ip} : $ip ;
$host = $hosts{$ipmain}{name} ? $hosts{$ipmain}{name} : $ipmain;
$tactical = $hosts{$ipmain}{tactical} ? " / " . $hosts{$ipmain}{tactical} : "";
if ( $rows{$host} ) { $host .= " " ; } # avoid collision 2 links to same host {rf, dtd}
$rows{$host} = sprintf "<tr><td valign=top><nobr><a href='http://%s:8080/'>%s</a>", $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} .= " &nbsp; <small>($linktype)</small>";
if ( $hosts{$ip}{name} =~ /^dtdlink\..*$/ ){ $nodeiface="dtd" ; }
elsif ( $hosts{$ip}{name} =~ /^mid\d+\..*$/ ) { $nodeiface="tun" ; }
else { $nodeiface="?" ; }
}
if ( $wangateway{$ip} or $wangateway{$ipmain} ) { $nodeiface = $nodeiface ? $nodeiface . ",wan" : "wan" ; }
if ( $nodeiface ) { $rows{$host} .= " &nbsp; <small>($nodeiface)</small>"; }
$rows{$host} .= sprintf ("</nobr></td><td></td><td align=right valign=top>%.0f%%</td><td align=right valign=top>%.0f%%</td><td></td><td>\n", 100*$links{$ip}{lq}, 100*$links{$ip}{nlq});
if ( ! exists $neighservices{$host} )
@ -437,8 +451,11 @@ print "<tr><td colspan=6><hr></td></tr>\n";
foreach $ip (keys %history)
{
next if $links{$ip};
next if $links{$ipalias{$ip}};
$age = sprintf "%010d", $uptime - $history{$ip}{age};
$host = $history{$ip}{host} ? $history{$ip}{host} : $ip;
$host =~ s/^mid\d+\.// ;
$host =~ s/^dtdlink\.// ;
$rows{$age} .= sprintf "<tr><td colspan=4><nobr>%s</nobr>", $host;
foreach(@{$hosts{$ip}{hosts}}) { $rows{$age} .= "<br><nobr><img src='/dot.png'>$_</nobr>" }
$rows{$age} .= "</td><td valign=top><nobr>";
@ -485,16 +502,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";