From a4a42dc4209865b04b8ee41f03d1be870d5a794b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sun, 6 Feb 2011 09:32:22 +0100 Subject: Don't set speed duplex twice Bug 6778 Both the nodes for speed and duplex both update the device. But only the change only needs to be done once. Changing the values twice causes link bounce and takes some time to resolve. --- templates/interfaces/ethernet/node.def | 4 ++++ templates/interfaces/ethernet/node.tag/duplex/node.def | 7 +++++-- templates/interfaces/ethernet/node.tag/speed/node.def | 7 +++++-- 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'templates') diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def index 5f196f59..ea33efb8 100644 --- a/templates/interfaces/ethernet/node.def +++ b/templates/interfaces/ethernet/node.def @@ -12,7 +12,11 @@ syntax:expression: exec \ echo \"interface ethernet $VAR(@): does not exist\"; exit 1; \ fi" + +begin: rm -f /tmp/speed-duplex.$VAR(@) + create: ip link set "$VAR(@)" up /opt/vyatta/sbin/vyatta-link-detect $VAR(@) on + delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0 ip link set $VAR(@) down diff --git a/templates/interfaces/ethernet/node.tag/duplex/node.def b/templates/interfaces/ethernet/node.tag/duplex/node.def index 023a8a08..0eee484e 100644 --- a/templates/interfaces/ethernet/node.tag/duplex/node.def +++ b/templates/interfaces/ethernet/node.tag/duplex/node.def @@ -8,8 +8,11 @@ commit:expression: exec " \ /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../@) \ --check-speed $VAR(../speed/@) $VAR(@)" -update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../@) \ - --speed-duplex $VAR(../speed/@) $VAR(@) +update: if [ ! -f /tmp/speed-duplex.$VAR(../@) ]; then + /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../@) \ + --speed-duplex $VAR(../speed/@) $VAR(@) + touch /tmp/speed-duplex.$VAR(../@) + fi val_help: auto; Auto negotiation (default) val_help: half; Half duplex diff --git a/templates/interfaces/ethernet/node.tag/speed/node.def b/templates/interfaces/ethernet/node.tag/speed/node.def index fad248af..2c069cc1 100644 --- a/templates/interfaces/ethernet/node.tag/speed/node.def +++ b/templates/interfaces/ethernet/node.tag/speed/node.def @@ -8,8 +8,11 @@ commit:expression: exec "\ /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../@) \ --check-speed $VAR(@) $VAR(../duplex/@)" -update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../@) \ - --speed-duplex $VAR(@) $VAR(../duplex/@) +update: if [ ! -f /tmp/speed-duplex.$VAR(../@) ]; then + /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../@) \ + --speed-duplex $VAR(@) $VAR(../duplex/@) + touch /tmp/speed-duplex.$VAR(../@) + fi val_help: auto; Auto negotiation (default) val_help: 10; 10 Mbit/sec -- cgit v1.2.3