From d88f26df4d7c31393df082c6397e65e096e63a75 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 12 Jan 2017 21:44:19 +0545 Subject: Redmine #5549 Allow variable number of DNS Servers (cherry picked from commit a2d23e88596deab6bbed2818385a0b72c913843a) --- src/etc/inc/system.inc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/etc') diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index c690188..24cca6e 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -234,14 +234,12 @@ function system_resolvconf_generate($dynupdate = false) { } /* setup static routes for DNS servers. */ - for ($dnscounter=1; $dnscounter<5; $dnscounter++) { + $dnscounter = 1; + $dnsgw = "dns{$dnscounter}gw"; + while (isset($config['system'][$dnsgw])) { /* setup static routes for dns servers */ - $dnsgw = "dns{$dnscounter}gw"; - if (isset($config['system'][$dnsgw])) { - if (empty($config['system'][$dnsgw]) || - $config['system'][$dnsgw] == "none") { - continue; - } + if (!(empty($config['system'][$dnsgw]) || + $config['system'][$dnsgw] == "none")) { $gwname = $config['system'][$dnsgw]; $gatewayip = lookup_gateway_ip_by_name($gwname); $inet6 = is_ipaddrv6($gatewayip) ? '-inet6 ' : ''; @@ -262,6 +260,8 @@ function system_resolvconf_generate($dynupdate = false) { log_error("ROUTING debug: $mt - route {$cmd} -host {$inet6}{$dnsserver} {$gatewayip}"); } } + $dnscounter++; + $dnsgw = "dns{$dnscounter}gw"; } unlock($dnslock); -- cgit v1.1