diff options
author | Ermal LUÇI <eri@pfsense.org> | 2015-01-15 20:17:46 +0100 |
---|---|---|
committer | Ermal LUÇI <eri@pfsense.org> | 2015-01-15 20:17:46 +0100 |
commit | 89f171b052fbe72aed654d2a1c3d5a24e9bf9902 (patch) | |
tree | 88099045c1b9056bd469f156c28e0015c811980e /etc/rc.carpbackup | |
parent | 98bf4991dc31f97fc7315a6b8aba433de9d39cea (diff) | |
download | pfsense-89f171b052fbe72aed654d2a1c3d5a24e9bf9902.zip pfsense-89f171b052fbe72aed654d2a1c3d5a24e9bf9902.tar.gz |
Ticket #3997, teach code to track carp through uniqids(). Missing carp GUI changes and upgrade code
Diffstat (limited to 'etc/rc.carpbackup')
-rwxr-xr-x | etc/rc.carpbackup | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/etc/rc.carpbackup b/etc/rc.carpbackup index 4ecd1c9..19da7a4 100755 --- a/etc/rc.carpbackup +++ b/etc/rc.carpbackup @@ -45,21 +45,26 @@ if (!strstr($argument, "@")) 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}"; -$friendly_descr = convert_friendly_interface_to_friendly_descr($carp_iface); -$notificationmsg = sprintf('Carp cluster member "%2$s (%1$s)" has resumed the state "BACKUP" for vhid %s', $argument, $friendly_descr, $vhid); +foreach ($vips as $vip) { + $notificationmsg = sprintf('Carp cluster member "{$friendly_descr)(%2$s): {$vip['subnet']} (%1$s)" has resumed the state "BACKUP" for vhid %s', $argument, $vip['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. */ global $config; if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client'])) { foreach ($config['openvpn']['openvpn-client'] as $settings) { - if ($settings['interface'] == $carp_iface) { - log_error("Stopping OpenVPN client instance on {$friendly_descr} because of transition to CARP backup."); - openvpn_restart('client', $settings); + foreach ($vips as $vip) { + if ($settings['interface'] == "_vip{$vip['uniqid']}") { + log_error("Stopping OpenVPN client instance on {$friendly_descr} because of transition to CARP backup."); + openvpn_restart('client', $settings); + } } } } |