summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Conntrack/ConntrackUtil.pm
diff options
context:
space:
mode:
authorGaurav Sinha <gaurav.sinha@vyatta.com>2012-05-14 13:21:09 -0700
committerGaurav Sinha <gaurav.sinha@vyatta.com>2012-05-14 13:21:09 -0700
commit1beb14e6dfb50c41b5b612b6696ab68e237d7ed3 (patch)
tree29bf32814735eeef5878c77380df44ec40cb2832 /lib/Vyatta/Conntrack/ConntrackUtil.pm
parent507404a62bbab41de83c006a84476d1069aabf5c (diff)
downloadvyatta-conntrack-1beb14e6dfb50c41b5b612b6696ab68e237d7ed3.tar.gz
vyatta-conntrack-1beb14e6dfb50c41b5b612b6696ab68e237d7ed3.zip
change default behavior, added vyatta-cthelper.pl
Diffstat (limited to 'lib/Vyatta/Conntrack/ConntrackUtil.pm')
-rw-r--r--lib/Vyatta/Conntrack/ConntrackUtil.pm22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/Vyatta/Conntrack/ConntrackUtil.pm b/lib/Vyatta/Conntrack/ConntrackUtil.pm
index 8f529c2..c256bd6 100644
--- a/lib/Vyatta/Conntrack/ConntrackUtil.pm
+++ b/lib/Vyatta/Conntrack/ConntrackUtil.pm
@@ -24,8 +24,9 @@
#
package Vyatta::Conntrack::ConntrackUtil;
+use Vyatta::IpTables::Mgr;
use base qw(Exporter);
-our @EXPORT = qw(check_for_conntrack_hooks);
+our @EXPORT = qw(check_for_conntrack_hooks, check_and_add_helpers);
#function to find if connection tracking is enabled.
#looks in the iptables to see if any of the features introduced
@@ -48,4 +49,23 @@ sub check_for_conntrack_hooks {
}
}
1;
+
+sub
+check_ct_helper_rules {
+ my $index;
+ my $cthelper_chain = "VYATTA_CT_HELPER";
+ foreach my $label ('PREROUTING', 'OUTPUT') {
+ $index = ipt_find_chain_rule($iptables_cmd, 'raw', $label, $cthelper_chain);
+ if (!defined($index)) {
+ # add VYATTA_CT_HELPER to PREROUTING / OUTPUT
+ print "hook not present\n";
+ }
+ }
+}
+
+sub check_and_add_helpers {
+ if (check_for_conntrack_hooks()) {
+ check_ct_helper_rules();
+ }
+}
# end of file