diff options
author | Gaurav <gaurav.sinha@vyatta.com> | 2012-02-22 10:30:52 -0800 |
---|---|---|
committer | Gaurav Sinha <gaurav.sinha@vyatta.com> | 2012-03-16 16:41:45 -0700 |
commit | e02c2bf7724c050e348dba14fa964375ba92a37b (patch) | |
tree | db4b40ee02ec7c2095d160e08646f6b78b197c32 /lib/Vyatta/Conntrack/RuleCT.pm | |
parent | 0f242d1a1fa363b19229b886622ef9ca3a4f50b5 (diff) | |
download | vyatta-conntrack-e02c2bf7724c050e348dba14fa964375ba92a37b.tar.gz vyatta-conntrack-e02c2bf7724c050e348dba14fa964375ba92a37b.zip |
adding various timers in custom rule template
(cherry picked from commit ebae932dd450c23d90d1f9d497e2715af535577f)
Diffstat (limited to 'lib/Vyatta/Conntrack/RuleCT.pm')
-rw-r--r-- | lib/Vyatta/Conntrack/RuleCT.pm | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/lib/Vyatta/Conntrack/RuleCT.pm b/lib/Vyatta/Conntrack/RuleCT.pm index e407f42..e53e07f 100644 --- a/lib/Vyatta/Conntrack/RuleCT.pm +++ b/lib/Vyatta/Conntrack/RuleCT.pm @@ -13,12 +13,20 @@ my %fields = ( _tcp => { _close => undef, _close_wait => undef, + _established => undef, + _fin_wait => undef, + _last_ack => undef, _syn_sent => undef, - }, - _udp => undef, + _syn_recv => undef, + _time_wait => undef, + }, + _udp => { + _other => undef, + _stream => undef, + }, _other => undef, _icmp => undef , - }, + }, ); my %dummy_rule = ( @@ -27,9 +35,17 @@ my %dummy_rule = ( _tcp => { _close => undef, _close_wait => undef, + _established => undef, + _fin_wait => undef, + _last_ack => undef, _syn_sent => undef, - }, - _udp => undef, + _syn_recv => undef, + _time_wait => undef, + }, + _udp => { + _other => undef, + _stream => undef, + }, _other => undef, _icmp => undef , }, @@ -67,7 +83,25 @@ sub setup_base { $config->setLevel("$level"); $self->{_rule_number} = $config->returnParent(".."); - $self->{_protocol} = $config->$val_func("protocol"); + if (($config->existsOrig("protocol tcp")) or + ($config->existsOrig("protocol udp")) or + ($config->existsOrig("protocol icmp")) or + ($config->existsOrig("protocol other"))) { + die "Error: Only one protocol per rule\n" + } + if ($config->$exists_func("protocol tcp")) { + $self->{_protocol} = "tcp"; + } elsif ($config->$exists_func("protocol icmp")) { + $self->{_protocol} = "icmp"; + } elsif ($config->$exists_func("protocol udp")) { + $self->{_protocol} = "udp"; + } elsif ($config->$exists_func("protocol other")) { + $self->{_protocol} = "other"; + } + + print "protocol is [\n"; + print $self->{_protocol}; + print "]\n"; $src->$addr_setup("$level source"); $dst->$addr_setup("$level destination"); |