RFC2136 RecordType Option (#1457)

This commit is contained in:
Elias Werberich 2017-03-10 13:58:18 +01:00 committed by Franco Fichtner
parent 73b1d444ee
commit fb7c4617e2
3 changed files with 18 additions and 4 deletions

View File

@ -1748,7 +1748,7 @@ EOD;
$need_update = false;
/* Update IPv4 if we have it. */
if (is_ipaddrv4($wanip)) {
if (is_ipaddrv4($wanip) && (empty($dnsupdate['recordtype']) || $dnsupdate['recordtype'] == 'A')) {
if (($wanip != $cachedipv4) || (($currentTime - $cacheTimev4) > $maxCacheAgeSecs) || $forced) {
$upinst .= "update delete {$dnsupdate['host']}. A\n";
$upinst .= "update add {$dnsupdate['host']}. {$dnsupdate['ttl']} A {$wanip}\n";
@ -1764,7 +1764,7 @@ EOD;
}
/* Update IPv6 if we have it. */
if (is_ipaddrv6($wanipv6)) {
if (is_ipaddrv6($wanipv6) && (empty($dnsupdate['recordtype']) || $dnsupdate['recordtype'] == 'AAAA')) {
if (($wanipv6 != $cachedipv6) || (($currentTime - $cacheTimev6) > $maxCacheAgeSecs) || $forced) {
$upinst .= "update delete {$dnsupdate['host']}. AAAA\n";
$upinst .= "update add {$dnsupdate['host']}. {$dnsupdate['ttl']} AAAA {$wanipv6}\n";

View File

@ -140,7 +140,7 @@ $main_buttons = array(
<td>
<?php
$filename = "/conf/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache";
if (file_exists($filename) && !empty($rfc2136['enable'])) {
if (file_exists($filename) && !empty($rfc2136['enable']) && (empty($dnsupdate['recordtype']) || $dnsupdate['recordtype'] == 'A')) {
echo "IPv4: ";
if (isset($rfc2136['usepublicip'])) {
$ipaddr = dyndnsCheckIP($rfc2136['interface']);
@ -160,7 +160,7 @@ $main_buttons = array(
echo "IPv4: N/A";
}
echo "<br />";
if (file_exists("{$filename}.ipv6")) {
if (file_exists("{$filename}.ipv6") && !empty($rfc2136['enable']) && (empty($dnsupdate['recordtype']) || $dnsupdate['recordtype'] == 'AAAA')) {
echo "IPv6: ";
$ipaddr = get_interface_ipv6($rfc2136['interface']);
$cached_ip_s = explode("|", file_get_contents("{$filename}.ipv6"));

View File

@ -58,6 +58,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['usetcp'] = isset($a_rfc2136[$id]['usetcp']);
$pconfig['usepublicip'] = isset($a_rfc2136[$id]['usepublicip']);
$pconfig['recordtype'] = isset($id) && !empty($a_rfc2136[$id]['recordtype']) ? $a_rfc2136[$id]['recordtype'] : null;
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['id']) && !empty($a_rfc2136[$_POST['id']])) {
$id = $_POST['id'];
@ -93,6 +95,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$rfc2136['server'] = $pconfig['server'];
$rfc2136['usetcp'] = !empty($pconfig['usetcp']);
$rfc2136['usepublicip'] = !empty($pconfig['usepublicip']);
$rfc2136['recordtype'] = $_POST['recordtype'];
$rfc2136['interface'] = $pconfig['interface'];
$rfc2136['descr'] = $pconfig['descr'];
@ -221,6 +224,17 @@ include("head.inc");
<strong><?=gettext("If the interface IP is private, attempt to fetch and use the public IP instead.");?></strong>
</td>
</tr>
<tr>
<td><a id="help_for_recordtype" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Record Type");?></td>
<td class="vtable">
<input name="recordtype" type="radio" value="" <?php if (empty($pconfig['recordtype'])) echo "checked=\"checked\""; ?> /> <?=gettext("All");?> &nbsp;
<input name="recordtype" type="radio" value="A" <?php if ($pconfig['recordtype'] == "A") echo "checked=\"checked\""; ?> /> <?=gettext("A (IPv4)");?> &nbsp;
<input name="recordtype" type="radio" value="AAAA" <?php if ($pconfig['recordtype'] == "AAAA") echo "checked=\"checked\""; ?> /> <?=gettext("AAAA (IPv6)");?>
<div class="hidden" for="help_for_recordtype">
<?=gettext("'All' will update all available record types.");?>
</div>
</td>
</tr>
<tr>
<td><?=gettext("Description");?></td>
<td>