Skip to content

Commit

Permalink
Verify if interface is active gw for gw group before update dynamic DNS
Browse files Browse the repository at this point in the history
  • Loading branch information
rbgarga committed Aug 5, 2016
1 parent 77413c2 commit e8382f7
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/etc/inc/services.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,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']);
Expand Down Expand Up @@ -2450,7 +2462,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'])) {
Expand Down

0 comments on commit e8382f7

Please sign in to comment.