WebUI: print more information on used nameservers
Commit Message
Show rDNS/PTR entry and country flag of the used nameservers on the
nameserver status list at "netexternal.cgi".
These information might be useful for debugging, or are just "nice to
have" and do not harm anything. :-)
Signed-off-by: Peter Müller <peter.mueller@link38.eu>
---
@@ -25,9 +25,13 @@ use strict;
#use warnings;
#use CGI::Carp 'fatalsToBrowser';
+use IO::Socket;
+use Geo::IP::PurePerl;
+
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
+require "${General::swroot}/geoip-functions.pl";
require "${General::swroot}/graphs.pl";
my %color = ();
@@ -99,6 +103,12 @@ if ( $querry[0] ne~ ""){
<strong>$Lang::tr{'nameserver'}</strong>
</th>
<th align="center">
+ <strong>$Lang::tr{'flag'}</strong>
+ </th>
+ <th align="center">
+ <strong>$Lang::tr{'rdns'}</strong>
+ </th>
+ <th align="center">
<strong>$Lang::tr{'status'}</strong>
</th>
</tr>
@@ -139,9 +149,22 @@ END
my $table_colour = ($id++ % 2) ? $color{'color22'} : $color{'color20'};
+ # Get rDNS entry for nameserver (might be useful)
+ my $iaddr = inet_aton($nameserver);
+ my $rdns = gethostbyaddr($iaddr, AF_INET);
+ if (!$rdns) { $rdns = $Lang::tr{'lookup failed'}; }
+
+ # Get country flag for the nameserver (might be useful)
+ my $gi = Geo::IP::PurePerl->new();
+ my $ccode = $gi->country_code_by_name($nameserver);
+ my $fcode = lc($ccode);
+ my $flag_icon = &GeoIP::get_flag_icon($fcode);
+
print <<END;
<tr bgcolor="$table_colour">
<td>$nameserver</td>
+ <td align="center"><a href="../country.cgi#$fcode"><img src="$flag_icon" border="0" align="absmiddle" alt="$ccode"></a></td>
+ <td>$rdns</td>
<td bgcolor="$bgcolour" align="center">
<font color="$colour"><strong>$message</strong></font>
</td>
@@ -271,3 +294,4 @@ sub check_dnssec($$) {
return $aware + $validating;
}
+
@@ -1902,6 +1902,7 @@
'quick playlist' => 'Quick Playlist',
'ram' => 'RAM-Speicher',
'random number generator daemon' => 'Random Number Generator Daemon',
+'rdns' => 'rDNS',
'read bytes' => 'Gelesene Bytes',
'read list' => 'Liste der Leseberechtigten',
'real address' => 'Reale Addresse',
@@ -1936,6 +1936,7 @@
'quick playlist' => 'Quick Playlist',
'ram' => 'RAM',
'random number generator daemon' => 'Random Number Generator Daemon',
+'rdns' => 'rDNS',
'read bytes' => 'Read Bytes',
'read list' => 'list with readonly hosts',
'real address' => 'Real Address',