Commit b47c65bc authored by Franco Fichtner's avatar Franco Fichtner

system: allow up to 8 nameservers

parent 5eb2c986
......@@ -201,7 +201,7 @@ function system_resolvconf_generate($verbose = false)
chmod('/etc/resolv.conf', 0644);
/* setup static routes for DNS servers. */
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
for ($dnscounter = 1; $dnscounter < 9; $dnscounter++) {
/* setup static routes for dns servers */
$dnsgw = "dns{$dnscounter}gw";
if (isset($config['system'][$dnsgw])) {
......
......@@ -40,10 +40,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$savemsg = htmlspecialchars(gettext($_GET['savemsg']));
}
$pconfig['dns1gw'] = null;
$pconfig['dns2gw'] = null;
$pconfig['dns3gw'] = null;
$pconfig['dns4gw'] = null ;
$pconfig['theme'] = null;
$pconfig['language'] = null;
$pconfig['timezone'] = "Etc/UTC";
......@@ -52,17 +48,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['hostname'] = $config['system']['hostname'];
$pconfig['domain'] = $config['system']['domain'];
if (isset($config['system']['dnsserver'])) {
list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $config['system']['dnsserver'];
} else {
list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = null;
}
foreach (array('dns1gw', 'dns2gw', 'dns3gw', 'dns4gw') as $dnsgwopt) {
if (!empty($config['system'][$dnsgwopt])) {
$pconfig[$dnsgwopt] = $config['system'][$dnsgwopt];
} else {
$pconfig[$dnsgwopt] = "none";
}
for ($dnscounter = 1; $dnscounter < 9; $dnscounter++) {
$dnsname = "dns{$dnscounter}";
$pconfig[$dnsname] = !empty($config['system']['dnsserver'][$dnscounter - 1]) ? $config['system']['dnsserver'][$dnscounter - 1] : null;
$dnsgwname= "dns{$dnscounter}gw";
$pconfig[$dnsgwopt] = !empty($config['system'][$dnsgwopt]) ? $config['system'][$dnsgwopt] : 'none';
}
$pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']);
......@@ -96,7 +87,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$ignore_posted_dnsgw = array();
for ($dnscounter=1; $dnscounter<5; $dnscounter++){
for ($dnscounter = 1; $dnscounter < 9; $dnscounter++){
$dnsname="dns{$dnscounter}";
$dnsgwname="dns{$dnscounter}gw";
if (!empty($pconfig[$dnsname]) && !is_ipaddr($pconfig[$dnsname])) {
......@@ -118,7 +109,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
/* XXX cranky low-level call, please refactor */
$direct_networks_list = explode(' ', filter_get_direct_networks_list(filter_generate_optcfg_array()));
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
for ($dnscounter = 1; $dnscounter < 9; $dnscounter++) {
$dnsitem = "dns{$dnscounter}";
$dnsgwitem = "dns{$dnscounter}gw";
if (!empty($pconfig[$dnsgwitem])) {
......@@ -154,14 +145,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($config['system']['gw_switch_default']);
}
$olddnsservers = $config['system']['dnsserver'];
$config['system']['dnsserver'] = array();
foreach (array('dns1', 'dns2', 'dns3', 'dns4') as $dnsopt) {
if (!empty($pconfig[$dnsopt])) {
$config['system']['dnsserver'][] = $pconfig[$dnsopt];
}
}
$config['system']['dnsallowoverride'] = !empty($pconfig['dnsallowoverride']);
if($pconfig['dnslocalhost'] == "yes") {
......@@ -170,13 +153,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($config['system']['dnslocalhost']);
}
/* which interface should the dns servers resolve through? */
$olddnsservers = $config['system']['dnsserver'];
$config['system']['dnsserver'] = array();
$outdnscounter = 0;
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
for ($dnscounter = 1; $dnscounter < 9; $dnscounter++) {
$dnsname="dns{$dnscounter}";
$dnsgwname="dns{$dnscounter}gw";
$olddnsgwname = !empty($config['system'][$dnsgwname]) ? $config['system'][$dnsgwname] : "none" ;
if (!empty($pconfig[$dnsname])) {
$config['system']['dnsserver'][] = $pconfig[$dnsname];
}
if ($ignore_posted_dnsgw[$dnsgwname]) {
$thisdnsgwname = "none";
} else {
......@@ -383,7 +372,7 @@ include("head.inc");
</thead>
<tbody>
<?php
for ($dnscounter=1; $dnscounter<5; $dnscounter++):
for ($dnscounter = 1; $dnscounter < 9; $dnscounter++):
$dnsgw = "dns{$dnscounter}gw";?>
<tr>
<td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment