diff options
-rw-r--r-- | etc/inc/filter.inc | 6 | ||||
-rw-r--r-- | etc/inc/pfsense-utils.inc | 18 | ||||
-rw-r--r-- | usr/local/pkg/carp_settings.xml | 6 |
3 files changed, 30 insertions, 0 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 3fa9c02..4357677 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2349,6 +2349,12 @@ function carp_sync_client() { $sections_xml[] = new XML_RPC_Value(backup_config_section("shaper"), 'string'); $sections[] = new XML_RPC_Value('shaper', 'string'); } + + if($carp['synchronizecarp'] != "" and is_array($config['virtualip'])) { + $sections_xml[] = new XML_RPC_Value(backup_vip_config_section("virtualip"), 'string'); + $sections[] = new XML_RPC_Value('virtualip', 'string'); + } + if(count($sections) > 0) { carp_sync_xml($synchronizetoip, $carp['password'], $sections, $sections_xml); $cli = new XML_RPC_Client('/xmlrpc.php', $synchronizetoip); diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index b44eb34..98dfb0a 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -717,6 +717,24 @@ function backup_config_section($section) { } /* + * backup_config_section($section): returns as an xml file string of + * the configuration section + */ +function backup_vip_config_section($section) { + global $config; + $new_section = &$config['virtualip']; + foreach($new_section as $section) { + if($section['mode'] == "proxyarp") { + unset($section); + } + } + /* generate configuration XML */ + $xmlconfig = dump_xml_config($new_section, $section); + $xmlconfig = str_replace("<?xml version=\"1.0\"?>", "", $xmlconfig); + return $xmlconfig; +} + +/* * restore_config_section($section, new_contents): restore a configuration section, * and write the configuration out * to disk/cf. diff --git a/usr/local/pkg/carp_settings.xml b/usr/local/pkg/carp_settings.xml index 94e6763..685ecb4 100644 --- a/usr/local/pkg/carp_settings.xml +++ b/usr/local/pkg/carp_settings.xml @@ -118,6 +118,12 @@ <type>checkbox</type> </field> <field> + <fielddescr>Synchronize Virtual IPs</fielddescr> + <fieldname>synchronizecarp</fieldname> + <description>When this option is enabled, this system will automatically sync the Virtual IP (minus proxyarp) settings over to the other carp host when changes are made.</description> + <type>checkbox</type> + </field> + <field> <fielddescr>Synchronize traffic shaper</fielddescr> <fieldname>synchronizetrafficshaper</fieldname> <description>When this option is enabled, this system will automatically sync the traffic shaper rules over to the other carp host when changes are made.</description> |