summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Conntrack
diff options
context:
space:
mode:
authorGaurav Sinha <gaurav.sinha@vyatta.com>2012-06-06 21:02:41 -0700
committerGaurav Sinha <gaurav.sinha@vyatta.com>2012-06-06 21:02:41 -0700
commit1a5d31c8eae4ad66c86ed66602128afc811d18e3 (patch)
treee9473b64a8ec4d648a55757df44a79f6afd9fe93 /lib/Vyatta/Conntrack
parent15f68c59c5836a731a7a76e6c04da170edd53f58 (diff)
parent3d0f8a19a4a58b5b93cdde90ef963f0708c73063 (diff)
downloadvyatta-conntrack-1a5d31c8eae4ad66c86ed66602128afc811d18e3.tar.gz
vyatta-conntrack-1a5d31c8eae4ad66c86ed66602128afc811d18e3.zip
Merge branch 'user_space_helpers' into pacifica
Conflicts: lib/Vyatta/Conntrack/ConntrackUtil.pm
Diffstat (limited to 'lib/Vyatta/Conntrack')
-rw-r--r--lib/Vyatta/Conntrack/ConntrackUtil.pm23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/Vyatta/Conntrack/ConntrackUtil.pm b/lib/Vyatta/Conntrack/ConntrackUtil.pm
index 104f237..bdc4961 100644
--- a/lib/Vyatta/Conntrack/ConntrackUtil.pm
+++ b/lib/Vyatta/Conntrack/ConntrackUtil.pm
@@ -24,9 +24,8 @@
#
package Vyatta::Conntrack::ConntrackUtil;
+use Vyatta::IpTables::Mgr;
use base qw(Exporter);
-our @EXPORT = qw(check_for_conntrack_hooks,
- process_protocols);
sub process_protocols {
my $proto = undef;
@@ -42,6 +41,7 @@ sub process_protocols {
close $proto;
return \%proto_hash;
}
+our @EXPORT = qw(check_for_conntrack_hooks, process_protocols, check_and_add_helpers);
#function to find if connection tracking is enabled.
#looks in the iptables to see if any of the features introduced
@@ -64,4 +64,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