diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-02-06 16:56:54 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-02-06 16:56:54 -0800 |
commit | 248920901afa3f1b6d2d461057f51164b66de041 (patch) | |
tree | 606e0d44545c25464529c1b1f4828b2dbebb83cb | |
parent | 22f85542c72b71d64a8ad70d73be1e99d01eaee4 (diff) | |
download | vyatta-cfg-qos-248920901afa3f1b6d2d461057f51164b66de041.tar.gz vyatta-cfg-qos-248920901afa3f1b6d2d461057f51164b66de041.zip |
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
-rw-r--r-- | templates/qos-policy/traffic-shaper/node.tag/class/node.tag/match/node.tag/interface/node.def | 16 |
1 files changed, 6 insertions, 10 deletions
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[@]##*/} + |