From 2fd9d914de23cd6fabc08e3e4be4a588f2b2803d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 11 Mar 2008 16:37:58 -0700 Subject: more robust handling of set mac address Bugfix: 2826 Enforce restrictions on address (must be valid ethernet address), and only bring interface down/up if already up. --- templates/interfaces/ethernet/node.tag/mac/node.def | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'templates/interfaces/ethernet') diff --git a/templates/interfaces/ethernet/node.tag/mac/node.def b/templates/interfaces/ethernet/node.tag/mac/node.def index e556743..d25b378 100644 --- a/templates/interfaces/ethernet/node.tag/mac/node.def +++ b/templates/interfaces/ethernet/node.tag/mac/node.def @@ -1,14 +1,7 @@ type: macaddr help: Set the MAC address of this interface +syntax:expression: exec "\ + /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --valid-mac $VAR(@)" +update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --set-mac $VAR(@) +delete: /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --set-mac $VAR(../hw-id/@) -update:expression: "sudo sh -c \"ip link set $VAR(../@) down && \ - ip link set $VAR(../@) address $VAR(@) && \ - ip link set $VAR(../@) up; \" "; \ - "Error setting MAC address on dev $VAR(../@)" - -delete:expression: "sudo sh -c \"ip link set $VAR(../@) down && \ - ip link set $VAR(../@) address \ - $VAR(../hw-id/@) && \ - ip link set $VAR(../@) up;\" "; \ - "Error resetting MAC address on dev $VAR(../@) to \ - $VAR(../hw-id/@)" -- cgit v1.2.3