diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-03-11 16:37:58 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-03-11 16:37:58 -0700 |
commit | 2fd9d914de23cd6fabc08e3e4be4a588f2b2803d (patch) | |
tree | a4ddf89a5134f460213279001a46ee523b566aec /templates | |
parent | a650defe75b160a78aec3e1837cfa1e5a994ff3a (diff) | |
download | vyatta-cfg-2fd9d914de23cd6fabc08e3e4be4a588f2b2803d.tar.gz vyatta-cfg-2fd9d914de23cd6fabc08e3e4be4a588f2b2803d.zip |
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.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/interfaces/ethernet/node.tag/mac/node.def | 15 |
1 files changed, 4 insertions, 11 deletions
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/@)" |