diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-02-16 16:16:47 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-02-16 16:28:04 -0800 |
commit | 704b79464af13b67a943f877020ff6a1514a0235 (patch) | |
tree | 9a0077d6ec1f45bae27cbfb4db062dab1a350b45 /templates | |
parent | 9f7a2a47e9d193592bc5fdf223db9517debd459e (diff) | |
download | vyatta-cfg-quagga-704b79464af13b67a943f877020ff6a1514a0235.tar.gz vyatta-cfg-quagga-704b79464af13b67a943f877020ff6a1514a0235.zip |
Use template to do syntax checks on ethernet device name
Bug 5256
Going out to perl to repeatedly validate ethernet device name slows
down adding VLAN's and other operations with lots of sub-devices.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/interfaces/ethernet/node.def | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def index a46ae722..081cabb5 100644 --- a/templates/interfaces/ethernet/node.def +++ b/templates/interfaces/ethernet/node.def @@ -2,9 +2,14 @@ tag: priority: 318 type: txt help: Set ethernet interface -syntax:expression: exec \ - "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=ethernet" allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=ethernet +syntax:expression: pattern $VAR(@) "^eth[0-9]+$" \ + ; "interface ethernet $VAR(@): not a valid name" +syntax:expression: exec \ + "if [ ! -d /sys/class/net/$VAR(@) ]; then \ + echo \"interface ethernet $VAR(@): does not exist\"; + exit 1; \ + fi" create: sudo ip link set "$VAR(@)" up /opt/vyatta/sbin/vyatta-link-detect $VAR(@) on delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0 |