]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/dns.cgi
dns.cgi: restart suricata before unbound reload
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / dns.cgi
index 3b47f5ed4bb1fec6ddaf4c15a4bbb149ee6cea77..676d95f8a6daa199008df6040b3390fe7eb9ffd3 100755 (executable)
@@ -434,7 +434,7 @@ sub show_nameservers () {
        #
        # 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", undef, "+timeout=1", "+retry=0");
+       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'}";
@@ -449,7 +449,7 @@ sub show_nameservers () {
                $dns_status_string .= " (" . $Lang::tr{'dns recursor mode'} . ")";
        }
 
-print <<END;
+       print <<END;
                <table width='100%'>
                        <tr>
                                <td>
@@ -458,7 +458,36 @@ print <<END;
                                </td>
                        </tr>
                </table>
+END
+
+       # Check the usage of ISP assigned nameservers is enabled.
+       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 = &General::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",
+                               ($settings{'USE_ISP_NAMESERVERS'} eq "on") ? "enabled" : "disabled",
+                               "$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;
 
+               print <<END;
                <br>
 
                <table class="tbl" width='100%'>
@@ -479,51 +508,23 @@ print <<END;
                                        <strong>$Lang::tr{'remark'}</strong>
                                </td>
 END
-       # Check if the status should be displayed.
-       if ($check_servers) {
-print <<END
+
+               # Check if the status should be displayed.
+               if ($check_servers) {
+                       print <<END;
                                <td align="center">
                                        <strong>$Lang::tr{'status'}</strong>
                                </td>
 END
-;
-       }
+               }
 
-print <<END
+               print <<END;
 
                                <td align="center" colspan="3">
                                        <strong>$Lang::tr{'action'}</strong>
                                </td>
                        </tr>
 END
-;
-
-               # Check the usage of ISP assigned nameservers is enabled.
-               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 = &General::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",
-                                       ($settings{'USE_ISP_NAMESERVERS'} eq "on") ? "enabled" : "disabled",
-                                       "$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) {
@@ -814,9 +815,6 @@ END
 
 # Private function to handle the restart of unbound and more.
 sub _handle_unbound_and_more () {
-       # Restart unbound
-       system('/usr/local/bin/unboundctrl reload >/dev/null');
-
        # Check if the IDS is running.
        if(&IDS::ids_is_running()) {
                # Re-generate the file which contains the DNS Server
@@ -826,6 +824,8 @@ sub _handle_unbound_and_more () {
                # Call suricatactrl to perform a reload.
                &IDS::call_suricatactrl("restart");
        }
+       # Restart unbound
+       system('/usr/local/bin/unboundctrl reload >/dev/null');
 }
 
 # Check if the system is online (RED is connected).