summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-03-11 16:37:58 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-03-11 16:37:58 -0700
commit2fd9d914de23cd6fabc08e3e4be4a588f2b2803d (patch)
treea4ddf89a5134f460213279001a46ee523b566aec /templates
parenta650defe75b160a78aec3e1837cfa1e5a994ff3a (diff)
downloadvyatta-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.def15
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/@)"