From 5948946de6c245897b832481cf5083485bc6594b Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 10 Sep 2020 05:39:55 -0700 Subject: [PATCH] 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 --- files/usr/local/bin/node-setup | 5 +++-- files/www/aredn.css | 9 +++++++++ files/www/black_on_white.css | 8 ++++++++ files/www/cgi-bin/mesh | 14 ++++++++++++-- files/www/loading.css | 9 ++++++++- files/www/red_on_black.css | 8 ++++++++ files/www/white_on_black.css | 8 ++++++++ files/www/yellow_on_black.css | 8 ++++++++ 8 files changed, 64 insertions(+), 5 deletions(-) diff --git a/files/usr/local/bin/node-setup b/files/usr/local/bin/node-setup index ad29511a..a85d1255 100755 --- a/files/usr/local/bin/node-setup +++ b/files/usr/local/bin/node-setup @@ -299,16 +299,17 @@ foreach(`cat $dhcpfile`) next unless validate_ip_netmask($ip, $cfg{lan_mask}); 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 #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) { foreach(`cat $aliasfile`) { next if /^\s*#/; next if /^\s*$/; ($ip, $host) = split /\s+/, $_; - printf HOSTS "$ip\t$host\n"; + printf HOSTS "$ip\t$host #ALIAS\n"; } } print HOSTS "\n"; diff --git a/files/www/aredn.css b/files/www/aredn.css index fc0d9fbc..c64e7aab 100644 --- a/files/www/aredn.css +++ b/files/www/aredn.css @@ -71,3 +71,12 @@ background-color: gainsboro; font-size: 12pt; width: 40%; } +.hidden-hosts { + /* light-ish grey */ + color: #595959; +} +.aliased-hosts { + /* "peru" */ + color: #CD853F; +} + diff --git a/files/www/black_on_white.css b/files/www/black_on_white.css index d7c70d57..1d21eddf 100644 --- a/files/www/black_on_white.css +++ b/files/www/black_on_white.css @@ -65,3 +65,11 @@ background-color: whitesmoke; font-size: 12pt; width: 40%; } +.hidden-hosts { + /* light-ish grey */ + color: #595959; +} +.aliased-hosts { + /* "peru" */ + color: #CD853F; +} diff --git a/files/www/cgi-bin/mesh b/files/www/cgi-bin/mesh index 6dafae7d..9393eda2 100755 --- a/files/www/cgi-bin/mesh +++ b/files/www/cgi-bin/mesh @@ -228,6 +228,8 @@ foreach(`cat /etc/hosts`) $localhosts{$ip}{name} = $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 @@ -394,8 +396,16 @@ if(keys %localhosts) # add locally advertised dmz hosts foreach $dmzhost (@{$localhosts{$ip}{hosts}}) { - $localpart = $dmzhost =~ s/.local.mesh//r; - $rows{$host} .= " $localpart"; + #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; + if(!$nopropd and !$aliased) { $rows{$host} .= " $localpart"; } + elsif($aliased) { $rows{$host} .= " $localpart"; } + else { $rows{$host} .= " $localpart"; } + $rows{$host} .= "\n"; foreach(sort keys %{$services{$dmzhost}}) { diff --git a/files/www/loading.css b/files/www/loading.css index fbbe2ddb..2e1530c3 100644 --- a/files/www/loading.css +++ b/files/www/loading.css @@ -103,4 +103,11 @@ width: 40%; .tun_loading_css_comment { font-size: 10pt; } - +.hidden-hosts { + /* light-ish grey */ + color: #595959; +} +.aliased-hosts { + /* "peru" */ + color: #CD853F; +} diff --git a/files/www/red_on_black.css b/files/www/red_on_black.css index e8f8c307..75c66b7f 100644 --- a/files/www/red_on_black.css +++ b/files/www/red_on_black.css @@ -65,3 +65,11 @@ background-color: dimgrey; font-size: 12pt; width: 40%; } +.hidden-hosts { + /* "silver" */ + color: #c0c0c0 +} +.aliased-hosts { + /* tan */ + color: #D2B48C; +} diff --git a/files/www/white_on_black.css b/files/www/white_on_black.css index 8c8f123e..1549f9f3 100644 --- a/files/www/white_on_black.css +++ b/files/www/white_on_black.css @@ -67,3 +67,11 @@ background-color: dimgrey; font-size: 12pt; width: 40%; } +.hidden-hosts { + /* "silver" */ + color: #c0c0c0; +} +.aliased-hosts { + /* tan */ + color: #D2B48C; +} diff --git a/files/www/yellow_on_black.css b/files/www/yellow_on_black.css index 8262eeb2..8d13c317 100644 --- a/files/www/yellow_on_black.css +++ b/files/www/yellow_on_black.css @@ -65,3 +65,11 @@ background-color: dimgrey; font-size: 12pt; width: 40%; } +.hidden-hosts { + /* "silver" */ + color: #c0c0c0 +} +.aliased-hosts { + /* tan */ + color: #D2B48C; +}