dns.cgi: Show recursor mode message even when we have some servers to show

The message was not shown when we have received DNS servers from the
provider.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2020-01-29 11:40:59 +01:00
parent 15e3419434
commit 351ad526b2
12 changed files with 30 additions and 11 deletions

View File

@@ -418,10 +418,18 @@ 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
@@ -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>
@@ -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{'dns recursor mode'}<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();