Don't allow an IP to be configured multiple times as a DNS server. Ticket #5915

This commit is contained in:
Chris Buechler 2016-02-20 03:53:25 -06:00
parent 830ea39af8
commit f700dc99fd

View File

@ -180,6 +180,7 @@ if ($_POST) {
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
$dnsname="dns{$dnscounter}";
$dnsgwname="dns{$dnscounter}gw";
$dnslist[] = $_POST[$dnsname];
if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) {
$input_errors[] = sprintf(gettext("A valid IP address must be specified for DNS server %s."), $dnscounter);
} else {
@ -200,6 +201,10 @@ if ($_POST) {
}
}
if (count($dnslist) != count(array_unique($dnslist))) {
$input_errors[] = gettext('Each configured DNS server must have a unique IP address. Remove the duplicated IP.');
}
$direct_networks_list = explode(" ", filter_get_direct_networks_list());
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
$dnsitem = "dns{$dnscounter}";