blob: 7395b069db52b1e56681be2fcb45be7f23a7427e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/usr/bin/perl
use lib "/opt/vyatta/share/perl5";
use warnings;
use strict;
use Vyatta::Config;
use Vyatta::Conntrack::RuleCT;
use Vyatta::IpTables::AddressFilter;
use Getopt::Long;
use Vyatta::Zone;
use Sys::Syslog qw(:standard :macros);
#for future use when v6 timeouts need to be set
my %cmd_hash = ( 'ipv4' => 'iptables',
'ipv6' => 'ip6tables');
my ($create, $delete, $update);
GetOptions("create=s" => \$create,
"delete=s" => \$delete,
"update=s" => \$update,
);
update_config();
sub update_config {
my $config = new Vyatta::Config;
my %rules = (); #hash of timeout config rules
my $iptables_cmd = $cmd_hash{'ipv4'};
$config->setLevel("system conntrack timeout custom rule");
%rules = $config->listNodeStatus();
print %rules;
foreach my $rule (sort keys %rules) {
if ("$rules{$rule}" eq 'static') {
} elsif ("$rules{$rule}" eq 'added') {
my $node = new Vyatta::Conntrack::RuleCT;
$node->setup("system conntrack timeout custom rule $rule");
$node->print();
} elsif ("$rules{$rule}" eq 'changed') {
} elsif ("$rules{$rule}" eq 'deleted') {
# my $node = new Vyatta::Conntrack::RuleCT;
# $node->setupOrig("system conntrack timeout custom rule $rule");
# my $ipt_rules = $node->get_num_ipt_rules();
# for (1 .. $ipt_rules) {
# print "deleting 1\n";
# run_cmd("$iptables_cmd -t $table --delete $name $iptablesrule");
# die "$iptables_cmd error: $! - $rule" if ($? >> 8);
# }
}
}
}
|