Add option to RFC2136 to find/use the public IP if the interface IP is private. (Off by default)

This commit is contained in:
jim-p 2013-07-02 16:42:21 -04:00
parent a04da9bfb6
commit 6d8dd98bf4
2 changed files with 12 additions and 0 deletions

View File

@ -2024,6 +2024,9 @@ EOD;
/* Update IPv4 if we have it. */
if (is_ipaddrv4($wanip)) {
if (($wanip != $cachedipv4) || (($currentTime - $cacheTimev4) > $maxCacheAgeSecs) || $forced) {
if (isset($dnsupdate['usepublicip'])) {
$wanip = dyndnsCheckIP($dnsupdate['interface']);
}
$upinst .= "update delete {$dnsupdate['host']}. A\n";
$upinst .= "update add {$dnsupdate['host']}. {$dnsupdate['ttl']} A {$wanip}\n";
$notify_text .= sprintf(gettext("DynDNS updated IP Address (A) for {$dnsupdate['host']} on %s (%s) to %s"), convert_real_interface_to_friendly_descr($if), $if, $wanip) . "\n";

View File

@ -55,6 +55,7 @@ if (isset($id) && isset($a_rfc2136[$id])) {
$pconfig['server'] = $a_rfc2136[$id]['server'];
$pconfig['interface'] = $a_rfc2136[$id]['interface'];
$pconfig['usetcp'] = isset($a_rfc2136[$id]['usetcp']);
$pconfig['usepublicip'] = isset($a_rfc2136[$id]['usepublicip']);
$pconfig['descr'] = $a_rfc2136[$id]['descr'];
}
@ -89,6 +90,7 @@ if ($_POST) {
$rfc2136['keydata'] = $_POST['keydata'];
$rfc2136['server'] = $_POST['server'];
$rfc2136['usetcp'] = $_POST['usetcp'] ? true : false;
$rfc2136['usepublicip'] = $_POST['usepublicip'] ? true : false;
$rfc2136['interface'] = $_POST['interface'];
$rfc2136['descr'] = $_POST['descr'];
@ -191,6 +193,13 @@ include("head.inc");
<input name="usetcp" type="checkbox" id="usetcp" value="<?=gettext("yes");?>" <?php if ($pconfig['usetcp']) echo "checked"; ?>>
<strong><?=gettext("Use TCP instead of UDP");?></strong></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Use Public IP");?></td>
<td width="78%" class="vtable">
<input name="usepublicip" type="checkbox" id="usepublicip" value="<?=gettext("yes");?>" <?php if ($pconfig['usepublicip']) echo "checked"; ?>>
<strong><?=gettext("If the interface IP is private, attempt to fetch and use the public IP instead.");?></strong>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Description");?></td>
<td width="78%" class="vtable">