summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-04 15:49:36 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2009-06-12 15:19:01 -0700
commit6f008c2a35b5ab2e7e85d8bd0771e5c4badab955 (patch)
tree09560d378516462cf6a876a6664b574d36b8591d /templates
parent2cc732a1b1ddfc492eb047818be2a56167d2e446 (diff)
downloadvyatta-cfg-6f008c2a35b5ab2e7e85d8bd0771e5c4badab955.tar.gz
vyatta-cfg-6f008c2a35b5ab2e7e85d8bd0771e5c4badab955.zip
Manage speed duplex in vyatta-interfaces.pl
Move the speed/duplex setting into script where we can handle errors better, and avoid setting speed/duplex twice. (cherry picked from commit 330470f1f060f579434eb89469f4ed021c95449d)
Diffstat (limited to 'templates')
-rw-r--r--templates/interfaces/ethernet/node.tag/duplex/node.def18
-rw-r--r--templates/interfaces/ethernet/node.tag/speed/node.def25
2 files changed, 14 insertions, 29 deletions
diff --git a/templates/interfaces/ethernet/node.tag/duplex/node.def b/templates/interfaces/ethernet/node.tag/duplex/node.def
index ba81cca..4600533 100644
--- a/templates/interfaces/ethernet/node.tag/duplex/node.def
+++ b/templates/interfaces/ethernet/node.tag/duplex/node.def
@@ -5,21 +5,9 @@ syntax:expression: $VAR(@) in "auto", "half", "full"; "duplex must be auto, half
commit:expression: ( $VAR(@) == "auto" && $VAR(../speed/@) == "auto" ) || \
( $VAR(@) != "auto" && $VAR(../speed/@) != "auto" ) ; \
"if duplex is hardcoded, speed must also be hardcoded"
-
-update: if [ "$VAR(@)" = "auto" ]
- then
- if ! sudo ethtool $VAR(../@) | grep -q 'Auto-negotiation: on'
- then sudo ethtool -s $VAR(../@) autoneg on
- fi
- else
- sudo ethtool -s $VAR(../@) \
- speed $VAR(../speed/@) duplex $VAR(@) autoneg off
- fi
-
-delete: if [ -d /sys/class/net/$VAR(../@) ]; then
- sudo ethtool -s $VAR(../@) autoneg on
- fi
+update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$(../@) \
+ --speed-duplex $VAR(../speed/@) $VAR(@)
comp_help:Possible completions:
- auto\t\tAuto negotiation
+ auto\t\tAuto negotiation (default)
half\t\tHalf duplex
full\t\tFull duplex
diff --git a/templates/interfaces/ethernet/node.tag/speed/node.def b/templates/interfaces/ethernet/node.tag/speed/node.def
index b22e93c..436e481 100644
--- a/templates/interfaces/ethernet/node.tag/speed/node.def
+++ b/templates/interfaces/ethernet/node.tag/speed/node.def
@@ -2,18 +2,15 @@ type: txt
help: Set the speed for this interface
default: "auto"
syntax:expression: $VAR(@) in "auto", "10", "100", "1000", "2500", "10000"; "Speed must be auto, 10, 100, 1000, 2500, or 10000"
-commit:expression: ( $VAR(@) == "auto" && $VAR(../speed/@) == "auto" ) || \
- ( $VAR(@) != "auto" && $VAR(../speed/@) != "auto" ) ; \
+commit:expression: ( $VAR(@) == "auto" && $VAR(../duplex/@) == "auto" ) || \
+ ( $VAR(@) != "auto" && $VAR(../duplex/@) != "auto" ) ; \
"if speed is hardcoded, duplex must also be hardcoded"
-update: if [ "$VAR(@)" = "auto" ]
- then
- if ! sudo ethtool $VAR(../@) | grep -q 'Auto-negotiation: on'
- then sudo ethtool -s $VAR(../@) autoneg on
- fi
- else
- sudo ethtool -s $VAR(../@) \
- speed $VAR(../speed/@) duplex $VAR(@) autoneg off
- fi
-delete: if [ -d /sys/class/net/$VAR(../@) ]; then
- sudo ethtool -s $VAR(../@) autoneg on
- fi
+update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$(../@) \
+ --speed-duplex $VAR(@) $VAR(../duplex/@)
+comp_help:Possible completions:
+ auto\t\tAuto negotiation (default)
+ 10 \t\t10 Mbit/sec
+ 100 \t\t100 Mbit/sec
+ 1000\t\t1 Gbit/sec
+ 2500\t\t2.5 Gbit/sec
+ 10000\t10 Gbit/sec