From 05741e4540267134f4a2faf91ed53bf42d41896b Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 5 Aug 2016 11:58:14 -0300 Subject: Verify if interface is active gw for gw group before update dynamic DNS --- src/etc/inc/services.inc | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/etc') diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index 0fe612c..6887c86 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -1982,7 +1982,19 @@ function services_dyndns_configure($int = "") { } foreach ($dyndnscfg as $dyndns) { - if ((empty($int)) || ($int == $dyndns['interface']) || (is_array($gwgroups[$dyndns['interface']]))) { + /* + * If it's using a gateway group, check if interface is + * the active gateway for that group + */ + $group_int = ''; + if (is_array($gwgroups[$dyndns['interface']])) { + if (!empty($gwgroups[$dyndns['interface']][0]['vip'])) { + $group_int = $gwgroups[$dyndns['interface']][0]['vip']; + } else { + $group_int = $gwgroups[$dyndns['interface']][0]['int']; + } + } + if ((empty($int)) || ($int == $dyndns['interface']) || ($int == $group_int)) { $dyndns['verboselog'] = isset($dyndns['verboselog']); $dyndns['curl_ipresolve_v4'] = isset($dyndns['curl_ipresolve_v4']); $dyndns['curl_ssl_verifypeer'] = isset($dyndns['curl_ssl_verifypeer']); @@ -2461,7 +2473,19 @@ function services_dnsupdate_process($int = "", $updatehost = "", $forced = false if (!isset($dnsupdate['enable'])) { continue; } - if (!empty($int) && ($int != $dnsupdate['interface']) && (!is_array($gwgroups[$dnsupdate['interface']]))) { + /* + * If it's using a gateway group, check if interface is + * the active gateway for that group + */ + $group_int = ''; + if (is_array($gwgroups[$dnsupdate['interface']])) { + if (!empty($gwgroups[$dnsupdate['interface']][0]['vip'])) { + $group_int = $gwgroups[$dnsupdate['interface']][0]['vip']; + } else { + $group_int = $gwgroups[$dnsupdate['interface']][0]['int']; + } + } + if (!empty($int) && ($int != $dnsupdate['interface']) && ($int != $group_int)) { continue; } if (!empty($updatehost) && ($updatehost != $dnsupdate['host'])) { -- cgit v1.1