From: Stefan Schantl Date: Wed, 8 Jan 2020 14:24:59 +0000 (+0100) Subject: dns.cgi: Perform server checks on user request X-Git-Tag: v2.25-core141~70^2~28 X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff_plain;h=43140993025fd6fb0b4da264fe478762c63f0bf8 dns.cgi: Perform server checks on user request Signed-off-by: Stefan Schantl --- diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi index 2042d5bfc2..54ca8d0d79 100755 --- a/html/cgi-bin/dns.cgi +++ b/html/cgi-bin/dns.cgi @@ -56,6 +56,8 @@ 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"; +my $check_servers; + my %color = (); my %mainsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); @@ -223,6 +225,11 @@ if (($cgiparams{'SERVERS'} eq $Lang::tr{'save'}) || ($cgiparams{'SERVERS'} eq $L # Write the changed hash to the config file. &General::writehasharray($servers_file, \%dns_servers); + +## Handle request to check the servers. +# +} elsif ($cgiparams{'SERVERS'} eq $Lang::tr{'dns check servers'}) { + $check_servers = 1; } # Hash to store the generic DNS settings. @@ -404,16 +411,25 @@ print < $Lang::tr{'remark'} - +END + # Check if the status should be displayed. + if ($check_servers) { +print < $Lang::tr{'status'} +END +; + } + +print < $Lang::tr{'action'} END +; # Check the usage of ISP assigned nameservers is enabled. my $id = 1; @@ -478,7 +494,7 @@ END my $status_colour; # Only grab the status if the nameserver is enabled. - if ($enabled eq "enabled") { + if (($check_servers) && ($enabled eq "enabled")) { $status = &check_nameserver("$nameserver", "ping.ipfire.org", "$settings{'PROTO'}", "$tls_hostname"); } @@ -546,12 +562,18 @@ print < $remark - - - $status_short - END ; + # Display server status if requested. + if ($check_servers) { +print < + $status_short + +END +; + } + # Check if the id is greater than "2". # # Nameservers with an ID's of one or two are ISP assigned, @@ -619,7 +641,10 @@ END print <
- + + + +
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index fdfae84346..34e9bceac0 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -841,6 +841,7 @@ 'dns address done' => 'The DNS server address settings are going to be saved.', 'dns address recon' => 'Trying to reconnect!', 'dns check failed' => 'DNS check failed', +'dns check servers' => 'Check DNS Servers', 'dns configuration' => 'DNS Configuration', 'dns could not add server' => 'Could not add server - Reason:', 'dns desc' => 'If the red0 interface gets the IP address information via DHCP from the provider, the DNS server addresses will be set automatically. Now here you are able to change these DNS server IP addresses with your own ones.',