+
+ # Check the usage of ISP assigned nameservers is enabled.
+ if ($settings{'USE_ISP_NAMESERVERS'} eq "on") {
+ my $id="1";
+
+ # Loop through the array which stores the files.
+ foreach my $file (@ISP_nameserver_files) {
+ # Grab the address of the nameserver.
+ my $address = &grab_address_from_file($file);
+
+ # Check if we got an address.
+ if ($address) {
+ # Add the address to the hash of nameservers.
+ $dns_servers{$id} = [ "$address", "none", "enabled", "$Lang::tr{'dns isp assigned nameserver'}" ];
+
+ # Increase id by one.
+ $id++;
+ }
+ }
+ }
+
+ # Check some DNS servers have been configured. In this case
+ # the hash contains at least one key.
+ my $server_amount;
+ if (keys %dns_servers) {
+ # Sort the keys by their ID and store them in an array.
+ my @keys = sort { $a <=> $b } keys %dns_servers;
+
+ # Loop through all entries of the array/hash.
+ foreach my $id (@keys) {
+ # Inrease server_amount.
+ $server_amount++;
+
+ # Assign data array positions to some nice variable names.
+ my $nameserver = $dns_servers{$id}[0];
+ my $tls_hostname = $dns_servers{$id}[1];
+ my $enabled = $dns_servers{$id}[2];
+ my $remark = $dns_servers{$id}[3];
+
+ my $col = '';
+ my $toggle = '';
+ my $gif = '';
+ my $gdesc = '';
+ my $notice = "";
+
+ # Colorize columns.
+ if ($server_amount % 2) {
+ $col="bgcolor='$color{'color22'}'"; }
+ else {
+ $col="bgcolor='$color{'color20'}'";
+ }
+
+ if ($enabled eq 'enabled') {
+ $gif='on.gif'; $toggle='off'; $gdesc=$Lang::tr{'click to disable'};
+ } else {
+ $gif='off.gif'; $toggle='on'; $gdesc=$Lang::tr{'click to enable'};
+ }
+
+ my $status;
+ my $status_short;
+ my $status_message;
+ my $status_colour;
+
+ # Only grab the status if the nameserver is enabled.
+ if ($enabled eq "enabled") {
+ $status = &check_nameserver("$nameserver", "ping.ipfire.org", "$settings{'PROTO'}", "$tls_hostname");
+ }
+
+ if (!$status) {
+ $status_short = "$Lang::tr{'disabled'}";
+
+ # DNSSEC Not supported
+ } elsif ($status eq 0) {
+ $status_short = "$Lang::tr{'broken'}";
+ $status_message = $Lang::tr{'dnssec not supported'};
+ $status_colour = ${Header::colourred};
+
+ # DNSSEC Aware
+ } elsif ($status eq 1) {
+ $status_short = "$Lang::tr{'not validating'}";
+ $status_message = $Lang::tr{'dnssec aware'};
+ $status_colour = ${Header::colourblack};
+
+ # DNSSEC Validating
+ } elsif ($status eq 2) {
+ $status_short = "$Lang::tr{'ok'}";
+ $status_message = $Lang::tr{'dnssec validating'};
+ $status_colour = ${Header::colourgreen};
+
+ # Error
+ } else {
+ $status_short = "$Lang::tr{'error'}";
+ $status_message = $status;
+ $status_colour = ${Header::colourred};
+ }
+
+ # collect more information about name server (rDNS, GeoIP country code)
+ my $ccode = &GeoIP::lookup($nameserver);
+ my $flag_icon = &GeoIP::get_flag_icon($ccode);
+
+ my $iaddr = inet_aton($nameserver);
+ my $rdns = gethostbyaddr($iaddr, AF_INET);
+
+ if (!$rdns) { $rdns = $Lang::tr{'lookup failed'}; }
+
+print <<END;
+ <tr>
+ <td align="center" $col>
+ $nameserver
+ </td>
+
+ <td align="center" $col>
+ <a href='country.cgi#$ccode'><img src="$flag_icon" border="0" alt="$ccode" title="$ccode" /></a>
+ </td>
+
+ <td align="center" $col>
+ $rdns
+ </td>
+
+ <td align="center" $col>
+ $remark
+ </td>
+
+ <td align="center" $col>
+ <strong><font color="$status_colour"><abbr title="$status_message">$status_short</abbr></font></strong>
+ </td>