diff options
author | Michael Larson <slioch@eng-140.vyatta.com> | 2008-02-06 11:15:04 -0800 |
---|---|---|
committer | Michael Larson <slioch@eng-140.vyatta.com> | 2008-02-06 11:15:04 -0800 |
commit | 5524250683c7216faff0507e6c2490ac45e742d3 (patch) | |
tree | c7ca5491e7f7c5ec12efa4c6d86e298b7f8d41b7 /scripts/vyatta-wanloadbalance.pl | |
parent | 5715eef60a6fead42fc44a7ff2a4668752e5f3c4 (diff) | |
download | vyatta-wanloadbalance-5524250683c7216faff0507e6c2490ac45e742d3.tar.gz vyatta-wanloadbalance-5524250683c7216faff0507e6c2490ac45e742d3.zip |
fixed errors introduced when converting to new port definitions.
Diffstat (limited to 'scripts/vyatta-wanloadbalance.pl')
-rw-r--r-- | scripts/vyatta-wanloadbalance.pl | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/scripts/vyatta-wanloadbalance.pl b/scripts/vyatta-wanloadbalance.pl index f2d2137..20352a5 100644 --- a/scripts/vyatta-wanloadbalance.pl +++ b/scripts/vyatta-wanloadbalance.pl @@ -74,26 +74,26 @@ sub write_health { sub write_rules { my $config = new VyattaConfig; - $config->setLevel("load-balancing wan rule"); + $config->setLevel('load-balancing wan rule'); my @rules = $config->listNodes(); #destination foreach my $rule (@rules) { print FILE_LCK "rule " . $rule . " {\n"; - my $option = $config->returnValue("$rule protocol"); - if (defined $option) { - print FILE_LCK "\tprotocol " . $option . "\n" - } + $config->setLevel('load-balancing wan rule'); - my $protocol = "all"; - if (defined $option) { - $protocol = $option; + my $protocol = $config->returnValue("$rule protocol"); + if (defined $protocol) { + print FILE_LCK "\tprotocol " . $protocol . "\n" + } + else { + $protocol = ""; } #destination print FILE_LCK "\tdestination {\n"; - $option = $config->returnValue("$rule destination address"); + my $option = $config->returnValue("$rule destination address"); if (defined $option) { print FILE_LCK "\t\taddress " . $option . "\n"; } @@ -103,20 +103,21 @@ sub write_rules { print FILE_LCK "\t\tnetwork " . $option . "\n"; } - $config->setLevel("load-balancing wan rule $rule destination port"); - my @dport = $config->listNodes(); - foreach my $dp (@dport) { + $option = $config->returnValue("$rule destination port"); + if (defined $option) { 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 " . $dp . "\n"; + print FILE_LCK "\t\tport " . $option . "\n"; } print FILE_LCK "\t}\n"; #source + $config->setLevel('load-balancing wan rule'); + + print FILE_LCK "\tsource {\n"; $option = $config->returnValue("$rule source address"); if (defined $option) { @@ -128,16 +129,14 @@ sub write_rules { print FILE_LCK "\t\tnetwork " . $option . "\n"; } - $config->setLevel("load-balancing wan rule $rule source port"); - my @sports = $config->listNodes(); - foreach my $sp (@sports) { + $option = $config->returnValue("$rule source port"); + if (defined $option) { if ($protocol ne "tcp" && $protocol ne "udp") { print "Please specify protocol tcp or udp when configuring ports\n"; exit 2; } - print FILE_LCK "\t\tports " . $sp . "\n"; + print FILE_LCK "\t\tport " . $option . "\n"; } - print FILE_LCK "\t}\n"; #interface |