diff options
author | jim-p <jimp@pfsense.org> | 2015-02-24 12:50:56 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2015-02-24 12:50:56 -0500 |
commit | 252cc3f596616a30f225849024c33b9e81052134 (patch) | |
tree | eff08ecd973ce5b14cf029a841b5988f09f124b2 /config/quagga_ospfd/quagga_ospfd.inc | |
parent | eab2c01b14b6c7af5a6475fc76e494dbababd3d6 (diff) | |
download | pfsense-packages-252cc3f596616a30f225849024c33b9e81052134.tar.gz pfsense-packages-252cc3f596616a30f225849024c33b9e81052134.tar.bz2 pfsense-packages-252cc3f596616a30f225849024c33b9e81052134.zip |
Add CARP plugin support to quagga so it no longer needs a patch to rc.carp(master|backup).
Diffstat (limited to 'config/quagga_ospfd/quagga_ospfd.inc')
-rw-r--r-- | config/quagga_ospfd/quagga_ospfd.inc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/config/quagga_ospfd/quagga_ospfd.inc b/config/quagga_ospfd/quagga_ospfd.inc index d0c73263..3b5c153d 100644 --- a/config/quagga_ospfd/quagga_ospfd.inc +++ b/config/quagga_ospfd/quagga_ospfd.inc @@ -422,4 +422,37 @@ function quagga_get_carp_status_by_ip($ipaddr) { return $status; } +function quagga_plugin_carp($pluginparams) { + global $config; + require_once("service-utils.inc"); + // Called when a CARP interface changes state + // $pluginparams['event'] either 'rc.carpmaster' or 'rc.carpbackup' + // $pluginparams['interface'] contains the affected interface + + /* If there is no OSPF config, then stop */ + if(is_array($config['installedpackages']['quaggaospfd']['config'])) { + $ospfd_conf = &$config['installedpackages']['quaggaospfd']['config'][0]; + } else { + return null; + } + /* If there is no properly configured CARP status check IP, then stop */ + if (!is_ipaddr($ospfd_conf['carpstatusip'])) { + return null; + } + list($vhid, $iface) = explode("@", trim($pluginparams['interface'])); + $friendly = convert_real_interface_to_friendly_interface_name($iface); + $carp_iface = "{$friendly}_vip${vhid}"; + + /* If this CARP transition is not from the IP address to check, then stop. */ + if (get_interface_ip($carp_iface) != $ospfd_conf['carpstatusip']) { + return null; + } + + /* Start or stop the service as needed based on the CARP transition. */ + if ($pluginparams['event'] == "rc.carpmaster") { + start_service("Quagga OSPFd"); + } elseif ($pluginparams['event'] == "rc.carpbackup") { + stop_service("Quagga OSPFd"); + } +} ?> |