summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGaurav <gaurav.sinha@vyatta.com>2012-02-24 11:22:41 -0800
committerGaurav Sinha <gaurav.sinha@vyatta.com>2012-03-16 16:43:55 -0700
commit516e4988be28dd2441e915fe7d4c6a2efb5bd0c6 (patch)
tree6cd4d96bce9a2914e4306f96834ff216e6c97796 /scripts
parentd3296d0d9376a67983871736e74409fabfc20634 (diff)
downloadvyatta-conntrack-516e4988be28dd2441e915fe7d4c6a2efb5bd0c6.tar.gz
vyatta-conntrack-516e4988be28dd2441e915fe7d4c6a2efb5bd0c6.zip
Adding deletion, error handling etc.
(cherry picked from commit 6a59a800acf9a9f6a21677e6187a33647ceb3539)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vyatta-conntrack-timeouts.pl31
1 files changed, 23 insertions, 8 deletions
diff --git a/scripts/vyatta-conntrack-timeouts.pl b/scripts/vyatta-conntrack-timeouts.pl
index bf7165e..ac9b56d 100644
--- a/scripts/vyatta-conntrack-timeouts.pl
+++ b/scripts/vyatta-conntrack-timeouts.pl
@@ -23,6 +23,19 @@ GetOptions("create=s" => \$create,
);
update_config();
+sub remove_timeout_policy {
+ my ($rule_string, $timeout_policy) = @_;
+ print "removing with $rule_string and $timeout_policy\n";
+ # function to apply the policy and then apply the policy to
+ # the iptables rule.
+ # Do nothing as of now.
+}
+sub apply_timeout_policy {
+ # function to apply the policy and then apply the policy to
+ # the iptables rule.
+ # Do nothing as of now.
+}
+
sub update_config {
my $config = new Vyatta::Config;
@@ -34,20 +47,22 @@ sub update_config {
foreach my $rule (sort keys %rules) {
if ("$rules{$rule}" eq 'static') {
} elsif ("$rules{$rule}" eq 'added') {
- print $rules{$rule};
my $node = new Vyatta::Conntrack::RuleCT;
+ my ($rule_string, $timeout_policy);
$node->setup("system conntrack timeout custom rule $rule");
- $node->print();
- $node->rule();
- $node->get_policy_command(); #nfct-timeout command string
-
+ $rule_string = $node->rule();
+ $timeout_policy = $node->get_policy_command(); #nfct-timeout command string
+ apply_timeout_policy($rule_string, $timeout_policy);
} elsif ("$rules{$rule}" eq 'changed') {
- print $rules{$rule};
my $node = new Vyatta::Conntrack::RuleCT;
$node->setup("system conntrack timeout custom rule $rule");
- $node->print();
} elsif ("$rules{$rule}" eq 'deleted') {
- print $rules{$rule};
+ my $node = new Vyatta::Conntrack::RuleCT;
+ my ($rule_string, $timeout_policy);
+ $node->setupOrig("system conntrack timeout custom rule $rule");
+ $rule_string = $node->rule();
+ $timeout_policy = $node->get_policy_command(); #nfct-timeout command string
+ remove_timeout_policy($rule_string, $timeout_policy);
}
}
}