diff options
author | Nicolas Lécureuil <nlecureuil@mandriva.com> | 2011-08-30 13:16:42 +0000 |
---|---|---|
committer | Nicolas Lécureuil <nlecureuil@mandriva.com> | 2011-08-30 13:16:42 +0000 |
commit | c590a4a7c162d1a81dbf02ca2e174384af0385bb (patch) | |
tree | 7e1279550b8e48add99b7b41281d27d249d279f3 /lib/network/invictus.pm | |
parent | 39d2ee13572a6dc634c0c454dfc43e0297483279 (diff) | |
download | drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar.gz drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar.bz2 drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar.xz drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.zip |
Create 2010.1 branch for drakx-net
Diffstat (limited to 'lib/network/invictus.pm')
-rw-r--r-- | lib/network/invictus.pm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/network/invictus.pm b/lib/network/invictus.pm new file mode 100644 index 0000000..91806d5 --- /dev/null +++ b/lib/network/invictus.pm @@ -0,0 +1,30 @@ +package network::invictus; + +use MDK::Common; + +my $ucarp_d = "/etc/ucarp.d"; +my $ct_sync_config = "/etc/sysconfig/ct_sync"; + +sub read_config { + my ($invictus) = @_; + foreach (all($::prefix . $ucarp_d)) { + $invictus->{ucarp}{$_} = +{ getVarsFromSh($::prefix . $ucarp_d . '/' . $_) }; + } + $invictus->{ct_sync} = +{ getVarsFromSh($::prefix . $ct_sync_config) }; + $invictus->{ct_sync}{CMARKBIT} ||= 30; +} + +sub write_config { + my ($invictus) = @_; + mkdir_p($::prefix . $ucarp_d); + foreach (keys %{$invictus->{ucarp}}) { + $invictus->{ucarp}{$_}{UPSCRIPT} ||= '/usr/share/invictus-firewall/ucarp-up.sh'; + $invictus->{ucarp}{$_}{DOWNSCRIPT} ||= '/usr/share/invictus-firewall/ucarp-down.sh'; + setVarsInShMode($::prefix . $ucarp_d . '/' . $_, 0600, $invictus->{ucarp}{$_}, + qw(INTERFACE SRCIP VIRTIP VHID PASSWORD TAKEOVER UPSCRIPT DOWNSCRIPT)); + } + setVarsInSh($::prefix . $ct_sync_config, $invictus->{ct_sync}, + qw(ENABLE INTERFACE CMARKBIT)); +} + +1; |