]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/dns.cgi
dns.cgi: increase timeout to 5s
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / dns.cgi
index 385c7be44b9b67c3c1d1d52b0fa5c9f467e29dd5..4f3418a703234158334ce7a507d787caef6aa374 100755 (executable)
@@ -418,15 +418,23 @@ END
 sub show_nameservers () {
        &Header::openbox('100%', 'center', "$Lang::tr{'dns title'}");
 
+       # Determine if we are running in recursor mode
+       my $recursor = 0;
+       my $unbound_forward = qx(unbound-control forward);
+       if ($unbound_forward =~ m/^off/) {
+               $recursor = 1;
+       }
+
        my $dns_status_string;
        my $dns_status_col;
        my $dns_working;
 
+
        # 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");
+       my $dns_status_ret = &check_nameserver("127.0.0.1", "$dns_test_server", "UDP", undef, "+timeout=5", "+retry=0");
 
        if ($dns_status_ret eq "2") {
                $dns_status_string = "$Lang::tr{'working'}";
@@ -437,6 +445,10 @@ sub show_nameservers () {
                $dns_status_col = "${Header::colourred}";
        }
 
+       if ($recursor) {
+               $dns_status_string .= " (" . $Lang::tr{'dns recursor mode'} . ")";
+       }
+
 print <<END;
                <table width='100%'>
                        <tr>
@@ -634,7 +646,7 @@ END
                                # Nameservers with an ID's of one or two are ISP assigned,
                                # and we cannot perform any actions on them, so hide the tools for
                                # them.
-                               if ($id gt "2") {
+                               if ($id > 2) {
 
 print <<END;
                                        <td align='center' width='5%' $col>
@@ -677,7 +689,7 @@ END
                print"<table width='100%'>\n";
 
                # Check if the usage of the ISP nameservers is enabled and there are more than 2 servers.
-               if (($settings{'USE_ISP_NAMESERVERS'} eq "on") && ($server_amount gt "2")) {
+               if (($settings{'USE_ISP_NAMESERVERS'} eq "on") && ($server_amount > 2)) {
 print <<END;
                        <tr>
                                <td class='boldbase'>&nbsp; <b>$Lang::tr{'legend'}:</b></td>
@@ -705,25 +717,16 @@ print <<END;
                </table>
 END
 ;
-
                } else {
-print <<END;
+                       print <<END;
                <table width="100%">
-                       <tr>
-                               <td colspan="6" align="center">
-                                       <br>$Lang::tr{'guardian no entries'}<br>
-                               </td>
-                       </tr>
-
                        <tr>
                                <form method="post" action="$ENV{'SCRIPT_NAME'}">
                                        <td colspan="6" align="right"><input type="submit" name="SERVERS" value="$Lang::tr{'add'}"></td>
                                </form>
                        </tr>
                </table>
-
 END
-;
                }
 
        &Header::closebox();
@@ -838,8 +841,8 @@ sub red_is_active () {
 }
 
 # Function to check a given nameserver against propper work.
-sub check_nameserver($$$$) {
-       my ($nameserver, $record, $proto, $tls_hostname) = @_;
+sub check_nameserver($$$$$) {
+       my ($nameserver, $record, $proto, $tls_hostname, @args) = @_;
 
        # Check if the system is online.
        unless (&red_is_active()) {
@@ -848,7 +851,7 @@ sub check_nameserver($$$$) {
 
        # Default values.
        my @command = ("kdig", "+dnssec",
-               "+bufsize=1232");
+               "+bufsize=1232", @args);
 
        # Handle different protols.
        if ($proto eq "TCP") {