summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-07-08 09:23:29 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-07-08 09:24:49 -0700
commitbcb7745077e3a2037294996206fd89c067ea2865 (patch)
tree9652d0dc88e9f3fbf14555c5be9c366d49d95b83
parent4b7eabc94bd36bc791e4aa87fc67a8e865e2aa55 (diff)
downloadvyatta-wanloadbalance-bcb7745077e3a2037294996206fd89c067ea2865.tar.gz
vyatta-wanloadbalance-bcb7745077e3a2037294996206fd89c067ea2865.zip
fix for bug 4698
-rw-r--r--scripts/vyatta-wanloadbalance.pl17
-rw-r--r--templates/load-balancing/wan/interface-health/node.tag/nexthop/node.def8
2 files changed, 24 insertions, 1 deletions
diff --git a/scripts/vyatta-wanloadbalance.pl b/scripts/vyatta-wanloadbalance.pl
index 6016f33..8ef101e 100644
--- a/scripts/vyatta-wanloadbalance.pl
+++ b/scripts/vyatta-wanloadbalance.pl
@@ -12,6 +12,7 @@ use lib "/opt/vyatta/share/perl5/";
use Vyatta::Config;
use Vyatta::Misc;
use Vyatta::TypeChecker;
+use Getopt::Long;
use warnings;
use strict;
@@ -231,12 +232,28 @@ sub write_rules {
return $valid;
}
+my $nexthop;
+sub usage {
+ exit 1;
+}
+
+GetOptions("valid-nexthop=s" => \$nexthop,
+ ) or usage();
####main
my $conf_file = '/var/load-balance/wlb.conf';
my $conf_lck_file = '/var/load-balance/wlb.conf.lck';
+####are we just validating?
+if (defined $nexthop) {
+ my $rc = Vyatta::TypeChecker::validateType('ipv4', $nexthop, 1);
+ if (!$rc && $nexthop ne "dhcp") {
+ exit 1;
+ }
+ exit 0;
+}
+
#open file
open(FILE, "<$conf_file") or die "Can't open wlb config file";
open(FILE_LCK, "+>$conf_lck_file") or die "Can't open wlb lock file";
diff --git a/templates/load-balancing/wan/interface-health/node.tag/nexthop/node.def b/templates/load-balancing/wan/interface-health/node.tag/nexthop/node.def
index b549e8c..6b3299b 100644
--- a/templates/load-balancing/wan/interface-health/node.tag/nexthop/node.def
+++ b/templates/load-balancing/wan/interface-health/node.tag/nexthop/node.def
@@ -1,2 +1,8 @@
type: txt
-help: Set interface nexthop
+help: Outbound interface nexthop address. Can be 'dhcp or ip address'
+syntax:expression: exec "/opt/vyatta/sbin/vyatta-wanloadbalance.pl --valid-nexthop $VAR(@)"\
+ ; "Invalid nexthop [$VAR(@)]"
+allowed: echo "dhcp <>"
+comp_help:Possible completions:
+ <x.x.x.x> Set the nexthop
+ dhcp Set the nexthop via DHCP