From 5e3f42d5aaba08a096744dbf9a24f7ab60d91b8f Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Fri, 15 Feb 2008 19:42:42 -0800 Subject: Fix 2826 Failure when setting mac address on interface --- templates/interfaces/ethernet/node.tag/mac/node.def | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/templates/interfaces/ethernet/node.tag/mac/node.def b/templates/interfaces/ethernet/node.tag/mac/node.def index 909aed8..e556743 100644 --- a/templates/interfaces/ethernet/node.tag/mac/node.def +++ b/templates/interfaces/ethernet/node.tag/mac/node.def @@ -1,4 +1,14 @@ type: macaddr help: Set the MAC address of this interface -update:expression: "sudo ip link set $VAR(../@) address $VAR(@)"; "Error setting MAC address on dev $VAR(../@)" -delete:expression: "sudo ip link set $VAR(../@) address $VAR(../hw-id/@)"; "Error setting MAC address on dev $VAR(../@) to $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