aboutsummaryrefslogtreecommitdiffstats
path: root/packages/carp_sync_client.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-03-15 17:09:54 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-03-15 17:09:54 +0000
commit9de47eaa0986973e65166bf716e62aecd5398da0 (patch)
treee067203d6d04ecb835cd4ad6548fe1e2a9f3168a /packages/carp_sync_client.php
parent18697761a2cee97690309683da8506c5392f359b (diff)
downloadpfsense-packages-9de47eaa0986973e65166bf716e62aecd5398da0.tar.gz
pfsense-packages-9de47eaa0986973e65166bf716e62aecd5398da0.tar.bz2
pfsense-packages-9de47eaa0986973e65166bf716e62aecd5398da0.zip
Do not process sync code twice.
Diffstat (limited to 'packages/carp_sync_client.php')
-rw-r--r--packages/carp_sync_client.php90
1 files changed, 46 insertions, 44 deletions
diff --git a/packages/carp_sync_client.php b/packages/carp_sync_client.php
index 2d27501b..b56c72e3 100644
--- a/packages/carp_sync_client.php
+++ b/packages/carp_sync_client.php
@@ -27,50 +27,52 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-if($config['installedpackages']['carpsettings']['config'] != "") {
- foreach($config['installedpackages']['carpsettings']['config'] as $carp) {
- if($carp['synchronizetoip'] <> "" ) {
- /* lets sync! */
- $synchronizetoip = $carp['synchronizetoip'];
- if($carp['synchronizerules'] <> "") {
- $current_rules_section = backup_config_section("filter");
- /* generate firewall rules xml */
- $fout = fopen("{$g['tmp_path']}/rules_section.txt","w");
- fwrite($fout, $current_rules_section);
- fclose($fout);
- mwexec("/usr/bin/scp {$g['tmp_path']}/rules_section.txt root@{$synchronizetoip}:/tmp/");
- unlink("{$g['tmp_path']}/rules_section.txt");
+if($already_processed != 1)
+ if($config['installedpackages']['carpsettings']['config'] != "") {
+ $already_processed = 1;
+ foreach($config['installedpackages']['carpsettings']['config'] as $carp) {
+ if($carp['synchronizetoip'] <> "" ) {
+ /* lets sync! */
+ $synchronizetoip = $carp['synchronizetoip'];
+ if($carp['synchronizerules'] <> "") {
+ $current_rules_section = backup_config_section("filter");
+ /* generate firewall rules xml */
+ $fout = fopen("{$g['tmp_path']}/rules_section.txt","w");
+ fwrite($fout, $current_rules_section);
+ fclose($fout);
+ mwexec("/usr/bin/scp {$g['tmp_path']}/rules_section.txt root@{$synchronizetoip}:/tmp/");
+ unlink("{$g['tmp_path']}/rules_section.txt");
+ }
+ if($carp['synchronizenat'] <> "") {
+ $current_nat_section = backup_config_section("nat");
+ /* generate nat rules xml */
+ $fout = fopen("{$g['tmp_path']}/nat_section.txt","w");
+ fwrite($fout, $current_nat_section);
+ fclose($fout);
+ mwexec("/usr/bin/scp {$g['tmp_path']}/nat_section.txt root@{$synchronizetoip}:/tmp/");
+ unlink("{$g['tmp_path']}/nat_section.txt");
+ }
+ if($carp['synchronizealiases'] <> "") {
+ $current_aliases_section = backup_config_section("aliases");
+ /* generate aliases xml */
+ $fout = fopen("{$g['tmp_path']}/aliases_section.txt","w");
+ fwrite($fout, $current_aliases_section);
+ fclose($fout);
+ mwexec("/usr/bin/scp {$g['tmp_path']}/aliases_section.txt root@{$synchronizetoip}:/tmp/");
+ unlink("{$g['tmp_path']}/aliases_section.txt");
+ }
+ if($carp['synchronizetrafficshaper'] <> "") {
+ $current_trafficshaper_section = backup_config_section("shaper");
+ /* generate aliases xml */
+ $fout = fopen("{$g['tmp_path']}/trafficshaper_section.txt","w");
+ fwrite($fout, $current_trafficshaper_section);
+ fclose($fout);
+ mwexec("/usr/bin/scp {$g['tmp_path']}/trafficshaper_section.txt root@{$synchronizetoip}:/tmp/");
+ unlink("{$g['tmp_path']}/trafficshaper_section.txt");
+ }
+ /* copy configuration to remote host */
+ mwexec("/usr/bin/ssh {$synchronizetoip} /usr/local/pkg/carp_sync_server.php");
}
- if($carp['synchronizenat'] <> "") {
- $current_nat_section = backup_config_section("nat");
- /* generate nat rules xml */
- $fout = fopen("{$g['tmp_path']}/nat_section.txt","w");
- fwrite($fout, $current_nat_section);
- fclose($fout);
- mwexec("/usr/bin/scp {$g['tmp_path']}/nat_section.txt root@{$synchronizetoip}:/tmp/");
- unlink("{$g['tmp_path']}/nat_section.txt");
- }
- if($carp['synchronizealiases'] <> "") {
- $current_aliases_section = backup_config_section("aliases");
- /* generate aliases xml */
- $fout = fopen("{$g['tmp_path']}/aliases_section.txt","w");
- fwrite($fout, $current_aliases_section);
- fclose($fout);
- mwexec("/usr/bin/scp {$g['tmp_path']}/aliases_section.txt root@{$synchronizetoip}:/tmp/");
- unlink("{$g['tmp_path']}/aliases_section.txt");
- }
- if($carp['synchronizetrafficshaper'] <> "") {
- $current_trafficshaper_section = backup_config_section("shaper");
- /* generate aliases xml */
- $fout = fopen("{$g['tmp_path']}/trafficshaper_section.txt","w");
- fwrite($fout, $current_trafficshaper_section);
- fclose($fout);
- mwexec("/usr/bin/scp {$g['tmp_path']}/trafficshaper_section.txt root@{$synchronizetoip}:/tmp/");
- unlink("{$g['tmp_path']}/trafficshaper_section.txt");
- }
- /* copy configuration to remote host */
- mwexec("/usr/bin/ssh {$synchronizetoip} /usr/local/pkg/carp_sync_server.php");
}
}
-}
-
+