From 248920901afa3f1b6d2d461057f51164b66de041 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 6 Feb 2008 16:56:54 -0800 Subject: use ifindex to check for valid interface config The script needs to look up ifindex for the match rule, so this is a good thing to use for syntax checking --- .../class/node.tag/match/node.tag/interface/node.def | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'templates') diff --git a/templates/qos-policy/traffic-shaper/node.tag/class/node.tag/match/node.tag/interface/node.def b/templates/qos-policy/traffic-shaper/node.tag/class/node.tag/match/node.tag/interface/node.def index fe7933c..c0451f5 100644 --- a/templates/qos-policy/traffic-shaper/node.tag/class/node.tag/match/node.tag/interface/node.def +++ b/templates/qos-policy/traffic-shaper/node.tag/class/node.tag/match/node.tag/interface/node.def @@ -1,11 +1,7 @@ -tag: type: txt -help: Ethernet interface name -syntax:expression: exec " \ - if [ -z \"`ip link | egrep -v 'eth[0-9]+[.]' | grep $VAR(@)`\" ]; then \ - echo Invalid ethernet interface [$VAR(@)]; \ - exit 1 ; \ - fi ; " -allowed: local -a array ; - array=( /sys/class/net/{eth,vmnet}[0-9]+[^.] ) ; - echo -n ${array[@]##*/} +help: Interface name +syntax:expression: exec "[ -f /sys/class/net/$VAR(@)/ifindex ]" ; "Interface must already exist" +allowed: local -a array + array=( /sys/class/net/* ) + echo -n ${array[@]##*/} + -- cgit v1.2.3