Added toggle function and associated code for enable/disable RDNSS in dhcpv6 Moved Configuration to RADVD interface

PR: https://github.com/opnsense/core/issues/4537
This commit is contained in:
Martin Wasley 2021-01-04 16:12:12 +00:00 committed by Franco Fichtner
parent 733089d1e3
commit 8ded045899
2 changed files with 17 additions and 5 deletions

View File

@ -374,8 +374,8 @@ function dhcpd_radvd_configure($verbose = false, $blacklist = array())
}
}
/* add DNS servers */
$dnslist_tmp = array();
$dnslist_tmp = [];
if (isset($dhcpv6ifconf['rasamednsasdhcp6']) && !empty($dhcpv6ifconf['dnsserver'][0])) {
$dnslist_tmp = $dhcpv6ifconf['dnsserver'];
} elseif (!isset($dhcpv6ifconf['rasamednsasdhcp6']) && !empty($dhcpv6ifconf['radnsserver'][0])) {
@ -389,13 +389,19 @@ function dhcpd_radvd_configure($verbose = false, $blacklist = array())
} elseif (!empty($config['system']['dnsserver'][0])) {
$dnslist_tmp = $config['system']['dnsserver'];
}
$dnslist = array();
$dnslist = [];
foreach ($dnslist_tmp as $server) {
if (is_ipaddrv6($server)) {
$dnslist[] = $server;
}
}
if (isset($dhcpv6ifconf['radisablerdnss'])) {
$dnslist = [];
}
if (count($dnslist) > 0) {
$radvdconf .= "\tRDNSS " . implode(" ", $dnslist) . " {\n";
if (!empty($dhcpv6ifconf['AdvRDNSSLifetime'])) {

View File

@ -57,8 +57,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig[$fieldname] = null;
}
}
// boolean
$pconfig['rasamednsasdhcp6'] = isset($config['dhcpdv6'][$if]['rasamednsasdhcp6']);
$pconfig['radisablerdnss'] = isset($config['dhcpdv6'][$if]['radisablerdnss']);
$pconfig['radefault'] = empty($config['dhcpdv6'][$if]['ranodefault']) ? true : null;
// defaults
@ -159,7 +161,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($config['dhcpdv6'][$if]['rainterface']);
}
# flipped in GUI on purpose
/* flipped in GUI on purpose */
if (empty($pconfig['radefault'])) {
$config['dhcpdv6'][$if]['ranodefault'] = true;
} elseif (isset($config['dhcpdv6'][$if]['ranodefault'])) {
@ -175,6 +177,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$config['dhcpdv6'][$if]['radnsserver'][] = $pconfig['radns2'];
}
$config['dhcpdv6'][$if]['rasamednsasdhcp6'] = !empty($pconfig['rasamednsasdhcp6']);
$config['dhcpdv6'][$if]['radisablerdnss'] = !empty($pconfig['radisablerdnss']);
if (count($pconfig['raroutes'])) {
$config['dhcpdv6'][$if]['raroutes'] = implode(',', $pconfig['raroutes']);
@ -401,7 +404,10 @@ include("head.inc");
</div>
<br />
<input id="rasamednsasdhcp6" name="rasamednsasdhcp6" type="checkbox" value="yes" <?=!empty($pconfig['rasamednsasdhcp6']) ? "checked='checked'" : "";?> />
<strong><?= gettext("Use the DNS settings of the DHCPv6 server"); ?></strong>
<?= gettext('Use the DNS settings of the DHCPv6 server') ?>
<br />
<input name="radisablerdnss" type="checkbox" id="radisablerdnss" value="yes" <?=!empty($pconfig['radisablerdnss']) ? 'checked="checked"' : '' ?> />
<?= gettext('Do not send DNS settings to clients') ?>
</td>
</tr>
<tr>