From 8b49f93b06cfe494182c533dc00499abc8452660 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 5 Aug 2011 20:51:06 -0700 Subject: ethernet: avoid needlessly setting mac address Bug 7408 Only set mac address if it is different, and try first with link up (many drivers allow it). Don't use hw-id as mac address, hw-id is meant for corelating names with addresses (in udev). --- templates/interfaces/ethernet/node.def | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'templates/interfaces') diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def index a9113e7a..426f8f87 100644 --- a/templates/interfaces/ethernet/node.def +++ b/templates/interfaces/ethernet/node.def @@ -14,15 +14,10 @@ syntax:expression: exec \ fi" begin: rm -f /tmp/speed-duplex.$VAR(@) - if [ -d "/sys/class/net/$VAR(@)" ]; then - s_mac="$VAR(hw-id/@)" - if [ -n "$VAR(mac/@)" ]; then - s_mac="$VAR(mac/@)" - fi - if [ -n "$s_mac" ]; then + if [ -n "$VAR(mac/@)" ] && + [ -d "/sys/class/net/$VAR(@)" ]; then /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(@) \ - --set-mac $s_mac - fi + --set-mac "$VAR(mac/@)" fi create: ip link set "$VAR(@)" up -- cgit v1.2.3