summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaurav <gaurav.sinha@vyatta.com>2012-02-15 16:57:34 -0800
committerGaurav Sinha <gaurav.sinha@vyatta.com>2012-03-16 16:40:26 -0700
commitf0118dc081cfa4e4efd9cbfe6f008cd322539b10 (patch)
treea2aca81c1bb9804800a13ed7bd629c2676d247ee
parenta78433c8796593aad8e18be6216ea007d08dcaff (diff)
downloadvyatta-conntrack-f0118dc081cfa4e4efd9cbfe6f008cd322539b10.tar.gz
vyatta-conntrack-f0118dc081cfa4e4efd9cbfe6f008cd322539b10.zip
timeout script, similar to firewall one, with a few differences.
(cherry picked from commit 23a5a4ee111ab1519be62841bf03d555a674b371)
-rw-r--r--scripts/vyatta-conntrack-timeouts.pl25
1 files changed, 15 insertions, 10 deletions
diff --git a/scripts/vyatta-conntrack-timeouts.pl b/scripts/vyatta-conntrack-timeouts.pl
index 7725a3b..09d24ce 100644
--- a/scripts/vyatta-conntrack-timeouts.pl
+++ b/scripts/vyatta-conntrack-timeouts.pl
@@ -12,6 +12,10 @@ use Getopt::Long;
use Vyatta::Zone;
use Sys::Syslog qw(:standard :macros);
+#for future use when v6 timeouts need to be set
+my %cmd_hash = ( 'ipv4' => 'iptables',
+ 'ipv6' => 'ip6tables');
+
my ($create, $delete, $update);
GetOptions("create=s" => \$create,
@@ -19,16 +23,17 @@ GetOptions("create=s" => \$create,
"update=s" => \$update,
);
-if ($create and ($create eq 'true')) {
- print "create\n";
- # create a nfct-timeout policy based on protocol specific timers
- # check if the rule has protocol configured
- # if configured, check what the protocol is and get the appropriate timers.
+if (($create eq 'true') or ($update eq 'true')) {
+ update_config();
}
-if ($delete and ($delete eq 'true')) {
- print "delete";
-}
-if ($update and ($update eq 'true')) {
- print "update";
+sub update_config {
+ my $config = new Vyatta::Config;
+ my %rules = (); #hash of timeout config rules
+ my $iptables_cmd = $cmd_hash{'ipv4'};
+
+ $config->setLevel("system conntrack timeout custom rule");
+ %rules = $config->listNodeStatus();
+ print %rules;
}
+