summaryrefslogtreecommitdiffstats
path: root/src/etc/rc.carpbackup
diff options
context:
space:
mode:
authorLuiz Otavio O Souza <luiz@netgate.com>2016-02-24 10:45:17 -0600
committerLuiz Otavio O Souza <luiz@netgate.com>2016-02-24 10:49:36 -0600
commit7de4474e1940ca751b4ff7031464c01b1489d71f (patch)
tree973dd7a61f1c89ff6d312c6ffc09e7e32b43ff53 /src/etc/rc.carpbackup
parent19e407c264d8a3ff589bd5abca5efbf6798ba78b (diff)
downloadpfsense-7de4474e1940ca751b4ff7031464c01b1489d71f.zip
pfsense-7de4474e1940ca751b4ff7031464c01b1489d71f.tar.gz
Fix the rc.carpmaster and rc.carpbackup scripts.
Now, they look for main CARP IP and IP aliases running on supplied vhid.
Diffstat (limited to 'src/etc/rc.carpbackup')
-rwxr-xr-xsrc/etc/rc.carpbackup42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/etc/rc.carpbackup b/src/etc/rc.carpbackup
index e71f9fa..a65aff4 100755
--- a/src/etc/rc.carpbackup
+++ b/src/etc/rc.carpbackup
@@ -34,13 +34,14 @@ require_once("notices.inc");
require_once("openvpn.inc");
require_once("interfaces.inc");
-if (isset($_GET)) {
+if (isset($_GET['interface'])) {
$argument = $_GET['interface'];
} else {
$argument = str_replace("\n", "", $argv[1]);
}
if (!strstr($argument, "@")) {
log_error("CARP master event triggered from wrong source {$argument}");
+ exit;
}
list($vhid, $iface) = explode("@", $argument);
@@ -48,16 +49,17 @@ list($vhid, $iface) = explode("@", $argument);
$friendly = convert_real_interface_to_friendly_interface_name($iface);
$friendly_descr = convert_friendly_interface_to_friendly_descr($friendly);
$vips = link_interface_to_vips($friendly, '', $vhid);
-$carp_iface = "{$friendly}_vip{$vhid}";
-
-if (is_array($vips)) {
- foreach ($vips as $vip) {
- $notificationmsg = sprintf('HA cluster member "(%1$s): (%2$s)" has resumed CARP state "BACKUP" for vhid %3$s', $argument, $friendly_descr, $vhid);
+if (!is_array($vips)) {
+ log_error("CARP master event triggered from wrong source {$argument} - no associated VIPs");
+ exit;
+}
+foreach ($vips as $vip) {
+ $notificationmsg = sprintf('HA cluster member "(%1$s@%2$s): (%3$s)" has resumed CARP state "BACKUP" for vhid %4$s',
+ $vip['subnet'], $iface, $friendly_descr, $vhid);
- notify_via_smtp($notificationmsg);
- notify_via_growl($notificationmsg);
- log_error($notificationmsg);
- }
+ notify_via_smtp($notificationmsg);
+ notify_via_growl($notificationmsg);
+ log_error($notificationmsg);
}
/* Stop OpenVPN clients running on this VIP, since multiple active OpenVPN clients on a CARP cluster can be problematic. */
@@ -85,20 +87,14 @@ if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client'
}
}
-/* Reconfigure radvd when necessary */
-if (isset($config['dhcpdv6']) && is_array($config['dhcpdv6'])) {
- $found = false;
- foreach ($config['dhcpdv6'] as $dhcpv6if => $dhcpv6ifconf) {
- if ($dhcpv6ifconf['rainterface'] != $carp_iface) {
- continue;
+if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-server'])) {
+ foreach ($config['openvpn']['openvpn-server'] as $settings) {
+ foreach ($vips as $vip) {
+ if ($settings['interface'] == "_vip{$vip['uniqid']}") {
+ log_error("Stopping OpenVPN instance on {$friendly_descr} because of transition to CARP backup.");
+ openvpn_restart('server', $settings);
+ }
}
-
- $found = true;
- break;
- }
-
- if ($found === true) {
- services_radvd_configure();
}
}
OpenPOWER on IntegriCloud