diff options
author | Deepti Kulkarni <deepti@vyatta.com> | 2011-12-16 04:19:02 -0800 |
---|---|---|
committer | Deepti Kulkarni <deepti@vyatta.com> | 2011-12-16 04:19:02 -0800 |
commit | bad26964038fbe9d8b904e500c9fc3f90a70a005 (patch) | |
tree | a0ca4f3c4a1b26789b4752228dbb9d97c2949ff7 /lib/Vyatta/Conntrack/ConntrackUtil.pm | |
parent | f0f5874e15f2095bb2935d1b3bf92d321dc7c33f (diff) | |
download | vyatta-conntrack-bad26964038fbe9d8b904e500c9fc3f90a70a005.tar.gz vyatta-conntrack-bad26964038fbe9d8b904e500c9fc3f90a70a005.zip |
Resolved merge errors from Makefile.
Moved ConntrackUtil.pm to Conntrack dir.
Bug fix for 7676 for conntrack logging.
Diffstat (limited to 'lib/Vyatta/Conntrack/ConntrackUtil.pm')
-rw-r--r-- | lib/Vyatta/Conntrack/ConntrackUtil.pm | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/Vyatta/Conntrack/ConntrackUtil.pm b/lib/Vyatta/Conntrack/ConntrackUtil.pm new file mode 100644 index 0000000..8f529c2 --- /dev/null +++ b/lib/Vyatta/Conntrack/ConntrackUtil.pm @@ -0,0 +1,51 @@ +#!/usr/bin/perl # +# Module:ConntrackUtil.pm +# +# **** License **** +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# This code was originally developed by Vyatta, Inc. +# Portions created by Vyatta are Copyright (C) 2010 Vyatta, Inc. +# All Rights Reserved. +# +# Author: Gaurav Sinha +# Date: Dec 2011 +# Description: Utility scripts for Vyatta conntrack +# +# +# **** End License **** +# + +package Vyatta::Conntrack::ConntrackUtil; +use base qw(Exporter); +our @EXPORT = qw(check_for_conntrack_hooks); + +#function to find if connection tracking is enabled. +#looks in the iptables to see if any of the features introduced +#its chain in the hooks. +# +#returns one if any hook is present + +sub check_for_conntrack_hooks { + my @output = `sudo iptables -L -t raw`; + foreach(@output) { + if (($_ =~ m/WEBPROXY_CONNTRACK/)) { + return 1; + } + if (($_ =~ m/NAT_CONNTRACK/)) { + return 1; + } + if (($_ =~ m/FW_CONNTRACK/)) { + return 1; + } + } +} +1; +# end of file |