From: Stefan Schantl Date: Wed, 8 Jan 2020 17:00:15 +0000 (+0100) Subject: dns.cgi: Display DNS system status. X-Git-Tag: v2.25-core141~70^2~27 X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff_plain;h=770ea81ee514c92038f1c28546d99e7872aae1ad dns.cgi: Display DNS system status. For this, a test query to the local unbound instance will be sent and if the DNS system work properly can be answerd. Signed-off-by: Stefan Schantl --- diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi index 54ca8d0d79..41212ea4ad 100755 --- a/html/cgi-bin/dns.cgi +++ b/html/cgi-bin/dns.cgi @@ -56,6 +56,9 @@ my @ISP_nameserver_files = ( "/var/run/dns1", "/var/run/dns2" ); # File which contains the ca-certificates. my $ca_certs_file = "/etc/ssl/certs/ca-bundle.crt"; +# Server which is used, to determine if the whole DNS system works properly. +my $dns_test_server = "ping.ipfire.org"; + my $check_servers; my %color = (); @@ -393,7 +396,35 @@ END sub show_nameservers () { &Header::openbox('100%', 'center', "$Lang::tr{'dns title'}"); + my $dns_status_string; + my $dns_status_col; + + # Test if the DNS system is working. + # + # Simple send a request to unbound and check if it can resolve the + # DNS test server. + my $dns_status_ret = &check_nameserver("127.0.0.1", "$dns_test_server", "UDP"); + + if ($dns_status_ret eq "2") { + $dns_status_string = "$Lang::tr{'working'}"; + $dns_status_col = "${Header::colourgreen}"; + } else { + $dns_status_string = "$Lang::tr{'broken'} status: $dns_status_ret"; + $dns_status_col = "${Header::colourred}"; + } + print < + + + $Lang::tr{'status'}:  + $dns_status_string + + + + +
+
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 34e9bceac0..fb86444050 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -2956,6 +2956,7 @@ 'wlanap wlan status' => 'WLan Status', 'wol wakeup' => 'WakeUp', 'workgroup' => 'Workgroup', +'working' => 'Working', 'written bytes' => 'Bytes Written', 'xtaccess all error' => 'You cannot set an external access to ALL, that is done in the port forwarding record.', 'xtaccess bad transfert' => 'If you specify a port destination range, the source range must be identical !',