summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Larson <slioch@eng-140.vyatta.com>2008-02-04 16:45:08 -0800
committerMichael Larson <slioch@eng-140.vyatta.com>2008-02-04 16:45:08 -0800
commit6fc0de67999f8d8fee10ea7e95ac5601bcb5ff36 (patch)
tree866acd3d869af8af46b4352ddb7714e7fbbbe1f6 /scripts
parente357cbea7769efed1fe897dd800507bc55a15231 (diff)
downloadvyatta-wanloadbalance-6fc0de67999f8d8fee10ea7e95ac5601bcb5ff36.tar.gz
vyatta-wanloadbalance-6fc0de67999f8d8fee10ea7e95ac5601bcb5ff36.zip
whole raft of cli related changes. Fixed bugs in display output--added error checking on some configuration combinations. added
additional error checking in the code.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vyatta-wanloadbalance.pl28
1 files changed, 25 insertions, 3 deletions
diff --git a/scripts/vyatta-wanloadbalance.pl b/scripts/vyatta-wanloadbalance.pl
index 3d59607..b41bab2 100644
--- a/scripts/vyatta-wanloadbalance.pl
+++ b/scripts/vyatta-wanloadbalance.pl
@@ -85,7 +85,12 @@ sub write_rules {
if (defined $option) {
print FILE_LCK "\tprotocol " . $option . "\n"
}
-
+
+ my $protocol = "all";
+ if (defined $option) {
+ $protocol = $option;
+ }
+
#destination
print FILE_LCK "\tdestination {\n";
$option = $config->returnValue("$rule destination address");
@@ -101,13 +106,22 @@ sub write_rules {
$config->setLevel("load-balancing wan rule $rule destination port-number");
my @dport_nums = $config->listNodes();
foreach my $dport_num (@dport_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 " . $dport_num . "\n";
}
$config->setLevel("load-balancing wan rule $rule destination port-name");
my @dport_names = $config->listNodes();
foreach my $dport_name (@dport_names) {
- print FILE_LCK "\t\tport-number " . $dport_name . "\n";
+ 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";
@@ -126,13 +140,21 @@ sub write_rules {
$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) {
- print FILE_LCK "\t\tport-number " . $sport_name . "\n";
+ 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}\n";