summaryrefslogtreecommitdiffstats
path: root/src/etc
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc')
-rw-r--r--src/etc/inc/interfaces.inc10
-rw-r--r--src/etc/inc/rrd.inc2
-rwxr-xr-xsrc/etc/rc.carpbackup18
-rwxr-xr-xsrc/etc/rc.carpmaster18
4 files changed, 38 insertions, 10 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index 4089a10..8b4712c 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -5475,14 +5475,18 @@ function get_possible_traffic_source_addresses($include_ipv6_link_local=false) {
function get_interface_ip($interface = "wan") {
+ if (substr($interface, 0, 4) == '_vip') {
+ return get_configured_carp_interface_list($interface);
+ }
+
$realif = get_failover_interface($interface, 'inet');
if (!$realif) {
return null;
}
- if (substr($interface, 0, 4) == '_vip') {
- return get_configured_carp_interface_list($interface, 'inet', 'ip');
- } else if (substr($interface, 0, 5) == '_lloc') {
+ if (substr($realif, 0, 4) == '_vip') {
+ return get_configured_carp_interface_list($realif, 'inet', 'ip');
+ } else if (substr($realif, 0, 5) == '_lloc') {
/* No link-local address for v4. */
return null;
}
diff --git a/src/etc/inc/rrd.inc b/src/etc/inc/rrd.inc
index 7019a28..11a626e 100644
--- a/src/etc/inc/rrd.inc
+++ b/src/etc/inc/rrd.inc
@@ -891,7 +891,7 @@ function enable_rrd_graphing() {
/* set up the ntpd rrd file */
if (!file_exists("$rrddbpath$ntpd")) {
$rrdcreate = "$rrdtool create $rrddbpath$ntpd --step $rrdntpdinterval ";
- $rrdcreate .= "DS:offset:GAUGE:$ntpdvalid:0:1000 ";
+ $rrdcreate .= "DS:offset:GAUGE:$ntpdvalid:-1000:1000 ";
$rrdcreate .= "DS:sjit:GAUGE:$ntpdvalid:0:1000 ";
$rrdcreate .= "DS:cjit:GAUGE:$ntpdvalid:0:1000 ";
$rrdcreate .= "DS:wander:GAUGE:$ntpdvalid:0:1000 ";
diff --git a/src/etc/rc.carpbackup b/src/etc/rc.carpbackup
index e74ea3c..e71f9fa 100755
--- a/src/etc/rc.carpbackup
+++ b/src/etc/rc.carpbackup
@@ -40,7 +40,7 @@ if (isset($_GET)) {
$argument = str_replace("\n", "", $argv[1]);
}
if (!strstr($argument, "@")) {
- log_error("Carp MASTER event triggered from wrong source {$argument}");
+ log_error("CARP master event triggered from wrong source {$argument}");
}
list($vhid, $iface) = explode("@", $argument);
@@ -52,7 +52,7 @@ $carp_iface = "{$friendly}_vip{$vhid}";
if (is_array($vips)) {
foreach ($vips as $vip) {
- $notificationmsg = sprintf('Carp cluster member "(%1$s): (%2$s)" has resumed the state "BACKUP" for vhid %3$s', $argument, $friendly_descr, $vhid);
+ $notificationmsg = sprintf('HA cluster member "(%1$s): (%2$s)" has resumed CARP state "BACKUP" for vhid %3$s', $argument, $friendly_descr, $vhid);
notify_via_smtp($notificationmsg);
notify_via_growl($notificationmsg);
@@ -62,10 +62,22 @@ if (is_array($vips)) {
/* Stop OpenVPN clients running on this VIP, since multiple active OpenVPN clients on a CARP cluster can be problematic. */
global $config;
+$a_groups = return_gateway_groups_array();
if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client'])) {
foreach ($config['openvpn']['openvpn-client'] as $settings) {
+ if (substr($settings['interface'], 0, 4) == '_vip') {
+ $openvpn_vip = $settings['interface'];
+ } else if (is_array($a_groups[$settings['interface']])) {
+ // interface is a gateway group, check CARP VIP
+ if (substr($a_groups[$settings['interface']][0]['vip'], 0, 4) == '_vip') {
+ $openvpn_vip = $a_groups[$settings['interface']][0]['vip'];
+ }
+ } else {
+ // this OpenVPN instance not on a CARP IP
+ continue;
+ }
foreach ($vips as $vip) {
- if ($settings['interface'] == "_vip{$vip['uniqid']}") {
+ if ($openvpn_vip == "_vip{$vip['uniqid']}") {
log_error("Stopping OpenVPN client instance on {$friendly_descr} because of transition to CARP backup.");
openvpn_restart('client', $settings);
}
diff --git a/src/etc/rc.carpmaster b/src/etc/rc.carpmaster
index 79e8262..6c140ca 100755
--- a/src/etc/rc.carpmaster
+++ b/src/etc/rc.carpmaster
@@ -40,7 +40,7 @@ if (isset($_GET)) {
$argument = str_replace("\n", "", $argv[1]);
}
if (!strstr($argument, "@")) {
- log_error("Carp MASTER event triggered from wrong source {$argument}");
+ log_error("CARP master event triggered from wrong source {$argument}");
}
list($vhid, $iface) = explode("@", $argument);
@@ -50,7 +50,7 @@ $friendly_descr = convert_friendly_interface_to_friendly_descr($friendly);
$vips = link_interface_to_vips($friendly, '', $vhid);
$carp_iface = "{$friendly}_vip{$vhid}";
foreach ($vips as $vip) {
- $notificationmsg = sprintf('Carp cluster member "(%1$s): (%2$s)" has resumed the state "MASTER" for vhid %3$s', $argument, $friendly_descr, $vhid);
+ $notificationmsg = sprintf('HA cluster member "(%1$s): (%2$s)" has resumed CARP state "MASTER" for vhid %3$s', $argument, $friendly_descr, $vhid);
notify_via_smtp($notificationmsg);
notify_via_growl($notificationmsg);
@@ -59,10 +59,22 @@ foreach ($vips as $vip) {
/* Start OpenVPN clients running on this VIP, since they should be in the stopped state while the VIP is CARP Backup. */
global $config;
+$a_groups = return_gateway_groups_array();
if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client'])) {
foreach ($config['openvpn']['openvpn-client'] as $settings) {
+ if (substr($settings['interface'], 0, 4) == '_vip') {
+ $openvpn_vip = $settings['interface'];
+ } else if (is_array($a_groups[$settings['interface']])) {
+ // interface is a gateway group, check CARP VIP
+ if (substr($a_groups[$settings['interface']][0]['vip'], 0, 4) == '_vip') {
+ $openvpn_vip = $a_groups[$settings['interface']][0]['vip'];
+ }
+ } else {
+ // this OpenVPN instance not on a CARP IP
+ continue;
+ }
foreach ($vips as $vip) {
- if ($settings['interface'] == "_vip{$vip['uniqid']}") {
+ if ($openvpn_vip == "_vip{$vip['uniqid']}") {
log_error("Starting OpenVPN client instance on {$friendly_descr} because of transition to CARP master.");
openvpn_restart('client', $settings);
}
OpenPOWER on IntegriCloud