aredn: visualize non-propagated and aliased hosts (#569)

* enhancement: show the "non propagated" hosts as a grey color in the mesh list on the localnode.
This allows for the node admin to see, at a glance, which of the hosts are "hidden" or not.

* changed colors a little bit for the black background styles.
also assed in the aliases so now they will show up as a different color too.
this only effects the mesh listing on the localnode to where the aliases and/or non propagated hosts are.
the rest of the network does not see this.

* add a tooltip to the aliased/non propagated hostnames to help explain what they mean
This commit is contained in:
Eric 2020-09-10 05:39:55 -07:00 committed by GitHub
parent e13dd2cb04
commit 5948946de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 64 additions and 5 deletions

View File

@ -299,16 +299,17 @@ foreach(`cat $dhcpfile`)
next unless validate_ip_netmask($ip, $cfg{lan_mask}); next unless validate_ip_netmask($ip, $cfg{lan_mask});
printf ETHER "$mac\t$ip $noprop\n"; printf ETHER "$mac\t$ip $noprop\n";
printf HOSTS "$ip\t$host\n"; printf HOSTS "$ip\t$host $noprop\n";
} }
#aliases need to be added to /etc/hosts or they will not show up on the localnode #aliases need to be added to /etc/hosts or they will not show up on the localnode
#nor will the services they might offer #nor will the services they might offer
#also add a comment to the hosts file so we can display the aliases differently if needed
if(-e $aliasfile) { if(-e $aliasfile) {
foreach(`cat $aliasfile`) { foreach(`cat $aliasfile`) {
next if /^\s*#/; next if /^\s*#/;
next if /^\s*$/; next if /^\s*$/;
($ip, $host) = split /\s+/, $_; ($ip, $host) = split /\s+/, $_;
printf HOSTS "$ip\t$host\n"; printf HOSTS "$ip\t$host #ALIAS\n";
} }
} }
print HOSTS "\n"; print HOSTS "\n";

View File

@ -71,3 +71,12 @@ background-color: gainsboro;
font-size: 12pt; font-size: 12pt;
width: 40%; width: 40%;
} }
.hidden-hosts {
/* light-ish grey */
color: #595959;
}
.aliased-hosts {
/* "peru" */
color: #CD853F;
}

View File

@ -65,3 +65,11 @@ background-color: whitesmoke;
font-size: 12pt; font-size: 12pt;
width: 40%; width: 40%;
} }
.hidden-hosts {
/* light-ish grey */
color: #595959;
}
.aliased-hosts {
/* "peru" */
color: #CD853F;
}

View File

@ -228,6 +228,8 @@ foreach(`cat /etc/hosts`)
$localhosts{$ip}{name} = $name; $localhosts{$ip}{name} = $name;
} }
else { push @{$localhosts{$my_ip}{hosts}}, $name; } else { push @{$localhosts{$my_ip}{hosts}}, $name; }
if($tactical eq "#NOPROP") { push @{$localhosts{$my_ip}{noprops}}, $name; }
if($tactical eq "#ALIAS") { push @{$localhosts{$my_ip}{aliases}}, $name; }
} }
# load the olsr hosts file # load the olsr hosts file
@ -394,8 +396,16 @@ if(keys %localhosts)
# add locally advertised dmz hosts # add locally advertised dmz hosts
foreach $dmzhost (@{$localhosts{$ip}{hosts}}) foreach $dmzhost (@{$localhosts{$ip}{hosts}})
{ {
#find non-propagated and aliased hosts and change color
$nopropd = 0;
$aliased = 0;
if(grep { /$dmzhost/ } @{$localhosts{$ip}{noprops}}) { $nopropd = 1; }
if(grep { /$dmzhost/ } @{$localhosts{$ip}{aliases}}) { $aliased = 1; }
$localpart = $dmzhost =~ s/.local.mesh//r; $localpart = $dmzhost =~ s/.local.mesh//r;
$rows{$host} .= "<tr><td valign=top><nobr>&nbsp;<img src='/dot.png'>$localpart</nobr></td>"; if(!$nopropd and !$aliased) { $rows{$host} .= "<tr><td valign=top><nobr>&nbsp;<img src='/dot.png'>$localpart</nobr></td>"; }
elsif($aliased) { $rows{$host} .= "<tr><td class=aliased-hosts valign=top title='Aliased Host'><nobr>&nbsp;<img src='/dot.png'>$localpart</nobr></td>"; }
else { $rows{$host} .= "<tr><td class=hidden-hosts valign=top title='Non Propagated Host'><nobr>&nbsp;<img src='/dot.png'>$localpart</nobr></td>"; }
$rows{$host} .= "<td colspan=3></td><td>\n"; $rows{$host} .= "<td colspan=3></td><td>\n";
foreach(sort keys %{$services{$dmzhost}}) foreach(sort keys %{$services{$dmzhost}})
{ {

View File

@ -103,4 +103,11 @@ width: 40%;
.tun_loading_css_comment { .tun_loading_css_comment {
font-size: 10pt; font-size: 10pt;
} }
.hidden-hosts {
/* light-ish grey */
color: #595959;
}
.aliased-hosts {
/* "peru" */
color: #CD853F;
}

View File

@ -65,3 +65,11 @@ background-color: dimgrey;
font-size: 12pt; font-size: 12pt;
width: 40%; width: 40%;
} }
.hidden-hosts {
/* "silver" */
color: #c0c0c0
}
.aliased-hosts {
/* tan */
color: #D2B48C;
}

View File

@ -67,3 +67,11 @@ background-color: dimgrey;
font-size: 12pt; font-size: 12pt;
width: 40%; width: 40%;
} }
.hidden-hosts {
/* "silver" */
color: #c0c0c0;
}
.aliased-hosts {
/* tan */
color: #D2B48C;
}

View File

@ -65,3 +65,11 @@ background-color: dimgrey;
font-size: 12pt; font-size: 12pt;
width: 40%; width: 40%;
} }
.hidden-hosts {
/* "silver" */
color: #c0c0c0
}
.aliased-hosts {
/* tan */
color: #D2B48C;
}