diff options
Diffstat (limited to 'lib/Vyatta/Conntrack/ConntrackUtil.pm')
-rw-r--r-- | lib/Vyatta/Conntrack/ConntrackUtil.pm | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/Vyatta/Conntrack/ConntrackUtil.pm b/lib/Vyatta/Conntrack/ConntrackUtil.pm index c256bd6..bdc4961 100644 --- a/lib/Vyatta/Conntrack/ConntrackUtil.pm +++ b/lib/Vyatta/Conntrack/ConntrackUtil.pm @@ -26,7 +26,22 @@ package Vyatta::Conntrack::ConntrackUtil; use Vyatta::IpTables::Mgr; use base qw(Exporter); -our @EXPORT = qw(check_for_conntrack_hooks, check_and_add_helpers); + +sub process_protocols { + my $proto = undef; + my %proto_hash = (); + my $PROTO_FILE = '/etc/protocols'; + # do nothing if can't open + return if (!open($proto, $PROTO_FILE)); + while (<$proto>) { + next if (/^\s*#/); + next if (!/^\S+\s+(\d+)\s+(\S+)\s/); + $proto_hash{$1} = $2; + } + 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 |