diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/vyatta-wanloadbalance.pl | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/scripts/vyatta-wanloadbalance.pl b/scripts/vyatta-wanloadbalance.pl index b41bab2..16fce02 100644 --- a/scripts/vyatta-wanloadbalance.pl +++ b/scripts/vyatta-wanloadbalance.pl @@ -103,26 +103,17 @@ sub write_rules { print FILE_LCK "\t\tnetwork " . $option . "\n"; } - $config->setLevel("load-balancing wan rule $rule destination port-number"); - my @dport_nums = $config->listNodes(); - foreach my $dport_num (@dport_nums) { + $config->setLevel("load-balancing wan rule $rule destination port"); + my @dport = $config->listNodes(); + foreach my $dp (@dport) { if ($protocol ne "tcp" && $protocol ne "udp") { print "Please specify protocol tcp or udp when configuring ports\n"; exit 2; } - print FILE_LCK "\t\tport-number " . $dport_num . "\n"; + print FILE_LCK "\t\tport " . $dp . "\n"; } - $config->setLevel("load-balancing wan rule $rule destination port-name"); - my @dport_names = $config->listNodes(); - foreach my $dport_name (@dport_names) { - if ($protocol ne "tcp" && $protocol ne "udp") { - print "Please specify protocol tcp or udp when configuring ports\n"; - exit 2; - } - print FILE_LCK "\t\tport-name " . $dport_name . "\n"; - } print FILE_LCK "\t}\n"; #source @@ -137,26 +128,15 @@ sub write_rules { print FILE_LCK "\t\tnetwork " . $option . "\n"; } - $config->setLevel("load-balancing wan rule $rule source port-number"); - my @sport_nums = $config->listNodes(); - foreach my $sport_num (@sport_nums) { - if ($protocol ne "tcp" && $protocol ne "udp") { - print "Please specify protocol tcp or udp when configuring ports\n"; - exit 2; - } - print FILE_LCK "\t\tport-number " . $sport_num . "\n"; - } - - $config->setLevel("load-balancing wan rule $rule source port-name"); - my @sport_names = $config->listNodes(); - foreach my $sport_name (@sport_names) { + $config->setLevel("load-balancing wan rule $rule source port"); + my @sports = $config->listNodes(); + foreach my $sp (@sports) { if ($protocol ne "tcp" && $protocol ne "udp") { print "Please specify protocol tcp or udp when configuring ports\n"; exit 2; } - print FILE_LCK "\t\tport-name " . $sport_name . "\n"; + print FILE_LCK "\t\tports " . $sp . "\n"; } - print FILE_LCK "\t}\n"; #interface $config->setLevel("load-balancing wan rule $rule interface"); |