summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-04-14 16:35:37 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-04-14 16:35:37 -0700
commit7297e007d00807352062ae34aded3a71937d21f5 (patch)
tree2fdcebcf7891fca4bedcbe3ee8923f2cecf49777
parentde99e9aecc81ce3d7f5af7b6d85cba74deaa9dd7 (diff)
downloadvyatta-wanloadbalance-7297e007d00807352062ae34aded3a71937d21f5.tar.gz
vyatta-wanloadbalance-7297e007d00807352062ae34aded3a71937d21f5.zip
validate interface name in template
Fix bug 2948, add syntax checking for interface name in load-balancing wan interface-health
-rw-r--r--templates/load-balancing/wan/interface-health/node.def11
1 files changed, 10 insertions, 1 deletions
diff --git a/templates/load-balancing/wan/interface-health/node.def b/templates/load-balancing/wan/interface-health/node.def
index b6f1d4e..fb23378 100644
--- a/templates/load-balancing/wan/interface-health/node.def
+++ b/templates/load-balancing/wan/interface-health/node.def
@@ -1,4 +1,13 @@
tag:
type: txt
help: interface name
-
+syntax:expression: exec " \
+ if [ -z \"`ip link | egrep -v 'eth[0-9]+[.]' | grep $VAR(@)`\" ]; then \
+ echo Invalid interface [$VAR(@)]; \
+ exit 1 ; \
+ fi ; "
+allowed: for dev in /sys/class/net/*;
+ do if [[ -L $dev/device ]]
+ then echo -n ${dev##*/} " "
+ fi
+ done