From c7127a130022e92c1f762c35fdb85df723757384 Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 3 Feb 2016 12:49:36 -0500 Subject: Implement Multi-WAN for RFC2136. A failover gateway group may be selected similar to the other DynDNS styles. --- src/etc/inc/services.inc | 11 ++++++----- src/usr/local/www/services_rfc2136.php | 14 +++++++++++--- src/usr/local/www/services_rfc2136_edit.php | 29 ++++++++++++++++++++++++----- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index 9e9e09d..17e583b 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -2450,11 +2450,12 @@ function services_dnsupdate_process($int = "", $updatehost = "", $forced = false /* Dynamic DNS updating active? */ if (is_array($config['dnsupdates']['dnsupdate'])) { $notify_text = ""; + $gwgroups = return_gateway_groups_array(); foreach ($config['dnsupdates']['dnsupdate'] as $i => $dnsupdate) { if (!isset($dnsupdate['enable'])) { continue; } - if (!empty($int) && $int != $dnsupdate['interface']) { + if (!empty($int) && ($int != $dnsupdate['interface']) && (!is_array($gwgroups[$dnsupdate['interface']]))) { continue; } if (!empty($updatehost) && ($updatehost != $dnsupdate['host'])) { @@ -2462,15 +2463,15 @@ function services_dnsupdate_process($int = "", $updatehost = "", $forced = false } /* determine interface name */ - $if = get_real_interface($dnsupdate['interface']); + $if = get_failover_interface($dnsupdate['interface']); if (isset($dnsupdate['usepublicip'])) { - $wanip = dyndnsCheckIP($dnsupdate['interface']); + $wanip = dyndnsCheckIP($if); } else { - $wanip = get_interface_ip($dnsupdate['interface']); + $wanip = get_interface_ip($if); } - $wanipv6 = get_interface_ipv6($dnsupdate['interface']); + $wanipv6 = get_interface_ipv6($if); $cacheFile = "{$g['conf_path']}/dyndns_{$dnsupdate['interface']}_rfc2136_" . escapeshellarg($dnsupdate['host']) . "_{$dnsupdate['server']}.cache"; $currentTime = time(); diff --git a/src/usr/local/www/services_rfc2136.php b/src/usr/local/www/services_rfc2136.php index afb6e86..44bb1c5 100644 --- a/src/usr/local/www/services_rfc2136.php +++ b/src/usr/local/www/services_rfc2136.php @@ -123,6 +123,7 @@ if ($input_errors) { $iflist = get_configured_interface_with_descr(); +$groupslist = return_gateway_groups_array(); $i = 0; foreach ($a_rfc2136 as $rfc2136): @@ -136,6 +137,12 @@ foreach ($a_rfc2136 as $rfc2136): break; } } + foreach ($groupslist as $if => $group) { + if ($rfc2136['interface'] == $if) { + print($if); + break; + } + } ?> @@ -147,13 +154,14 @@ foreach ($a_rfc2136 as $rfc2136): $ifdesc) { + $list[$if] = $ifdesc; + } + + unset($iflist); + + $grouplist = return_gateway_groups_array(); + + foreach ($grouplist as $name => $group) { + $list[$name] = 'GW Group ' . $name; + } + + unset($grouplist); + + return($list); +} + $pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("RFC 2136 Client"), gettext("Edit")); include("head.inc"); @@ -180,17 +202,14 @@ $section->addInput(new Form_Checkbox( )); $optionlist = array(); -$iflist = get_configured_interface_with_descr(); -foreach ($iflist as $ifnam => $ifdescr) { - $optionlist[$ifnam] = $ifdescr; -} +$iflist = build_if_list(); $section->addInput(new Form_Select( 'interface', 'Interface', $pconfig['interface'], - $optionlist + $iflist )); $section->addInput(new Form_Input( -- cgit v1.1