Skip to content

Commit

Permalink
radvd: fix two regressions from 16.7.9
Browse files Browse the repository at this point in the history
o Mark interface used in case of interface tracking
o Don't inject local DNS server when there is no IP

PR: #1273
(cherry picked from commit 0ec8569)
  • Loading branch information
fichtner committed Nov 28, 2016
1 parent b85b6c6 commit 1e3a4c3
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/etc/inc/services.inc
Expand Up @@ -132,7 +132,7 @@ function services_radvd_configure($blacklist = array())

$ifcfgsnv6 = get_interface_subnetv6($dhcpv6if);
$subnetv6 = gen_subnetv6($ifcfgipv6, $ifcfgsnv6);
$radvdifs[$realif] = $realif;
$radvdifs[$realif] = 1;

$radvdconf .= "# Generated for DHCPv6 Server $dhcpv6if\n";
$radvdconf .= "interface {$realif} {\n";
Expand Down Expand Up @@ -239,16 +239,30 @@ function services_radvd_configure($blacklist = array())
if (isset($radvdifs[$realif])) {
continue;
}
$radvdifs[$realif] = 1;

$dnslist = array();

$ifcfgipv6 = get_interface_ipv6($if);
if (!is_ipaddrv6($ifcfgipv6)) {
$subnetv6 = "::";
$ifcfgsnv6 = "64";
} else {
if (isset($config['dnsmasq']['enable']) || isset($config['unbound']['enable'])) {
$dnslist[] = $ifcfgipv6;
}
$ifcfgsnv6 = get_interface_subnetv6($if);
$subnetv6 = gen_subnetv6($ifcfgipv6, $ifcfgsnv6);
}

if (!empty($config['system']['dnsserver'])) {
foreach($config['system']['dnsserver'] as $server) {
if (is_ipaddrv6($server)) {
$dnslist[] = $server;
}
}
}

if (isset($config['interfaces'][$trackif]['ipaddrv6'])) {
$autotype = $config['interfaces'][$trackif]['ipaddrv6'];
$radvdconf .= "# Generated config for {$autotype} delegation from {$trackif} on {$if}\n";
Expand All @@ -267,17 +281,6 @@ function services_radvd_configure($blacklist = array())
$radvdconf .= "\t\tAdvRouterAddr on;\n";
$radvdconf .= "\t};\n";

/* add DNS servers */
$dnslist = array();
if (isset($config['dnsmasq']['enable']) || isset($config['unbound']['enable'])) {
$dnslist[] = $ifcfgipv6;
} elseif (!empty($config['system']['dnsserver'])) {
foreach($config['system']['dnsserver'] as $server) {
if (is_ipaddrv6($server)) {
$dnslist[] = $server;
}
}
}
if (count($dnslist) > 0) {
$radvdconf .= "\tRDNSS ".implode(" ", $dnslist)." { };\n";
}
Expand Down

0 comments on commit 1e3a4c3

Please sign in to comment.