diff options
author | Stig Thormodsrud <stig@uffda.(none)> | 2007-11-20 13:18:02 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@uffda.(none)> | 2007-11-20 13:18:02 -0800 |
commit | 65b95aa0fd0210501bd828299f561925269b6321 (patch) | |
tree | 7430cdd2d53b80d269ba880e055a0d3e232b79e8 /templates | |
parent | 2f0f6a02079f0dd65679076eac1c02fc1467a608 (diff) | |
download | vyatta-cfg-65b95aa0fd0210501bd828299f561925269b6321.tar.gz vyatta-cfg-65b95aa0fd0210501bd828299f561925269b6321.zip |
Fix 2482: Interface speed and duplex cannot be set to auto.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/interfaces/ethernet/node.tag/duplex/node.def | 20 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/speed/node.def | 19 |
2 files changed, 33 insertions, 6 deletions
diff --git a/templates/interfaces/ethernet/node.tag/duplex/node.def b/templates/interfaces/ethernet/node.tag/duplex/node.def index e7e87ad..92fd6e3 100644 --- a/templates/interfaces/ethernet/node.tag/duplex/node.def +++ b/templates/interfaces/ethernet/node.tag/duplex/node.def @@ -1,9 +1,23 @@ type: txt help: "Set the duplex mode for this interface" -syntax: $(@) in "half", "full"; "duplex must be half or full" -commit: $(../speed) != ""; "if duplex is hardcoded, speed must also be hardcoded" -update: "sudo ethtool -s $(../@) speed $(../speed/@) duplex $(@) autoneg off" +default: "auto" +syntax: $(@) in "auto", "half", "full"; "duplex must be auto, half or full" +commit: exec "if [ x$(@) != xauto ]; then \ + if [ x$(../speed/@) == xauto ]; then \ + exit 1; \ + fi; \ + else \ + if [ x$(../speed/@) != xauto ]; then \ + exit 1; \ + fi; \ + fi; " ; "if duplex is hardcoded, speed must also be hardcoded" +update: "if [ x$(@) != xauto ]; then \ + sudo ethtool -s $(../@) speed $(../speed/@) duplex $(@) autoneg off; \ + else \ + sudo ethtool -s $(../@) autoneg on; \ + fi; " delete: "sudo ethtool -s $(../@) autoneg on" #comp_help:Possible completions: +# auto\t\tAuto negotiation # 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 9f983e1..bff2f08 100644 --- a/templates/interfaces/ethernet/node.tag/speed/node.def +++ b/templates/interfaces/ethernet/node.tag/speed/node.def @@ -1,6 +1,19 @@ type: txt help: "Set the speed for this interface" -syntax: $(@) in "10", "100", "1000"; "Speed must be 10, 100, or 1000" -commit: $(../duplex) != ""; "if speed is hardcoded, duplex must also be hardcoded" -update: "sudo ethtool -s $(../@) speed $(@) duplex $(../duplex/@) autoneg off" +default: "auto" +syntax: $(@) in "auto", "10", "100", "1000"; "Speed must be auto, 10, 100, or 1000" +commit: exec "if [ x$(@) != xauto ]; then \ + if [ x$(../duplex/@) == xauto ]; then \ + exit 1; \ + fi; \ + else \ + if [ x$(../duplex/@) != xauto ]; then \ + exit 1; \ + fi; \ + fi;"; "if speed is hardcoded, duplex must also be hardcoded" +update: "if [ x$(@) != xauto ]; then \ + sudo ethtool -s $(../@) speed $(@) duplex $(../duplex/@) autoneg off; \ + else \ + sudo ethtool -s $(../@) autoneg on; \ + fi; " delete: "sudo ethtool -s $(../@) autoneg on" |