diff options
Diffstat (limited to 'src/etc/rc.carpmaster')
-rwxr-xr-x | src/etc/rc.carpmaster | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/etc/rc.carpmaster b/src/etc/rc.carpmaster index 2441e4e..6c140ca 100755 --- a/src/etc/rc.carpmaster +++ b/src/etc/rc.carpmaster @@ -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); } |