summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2009-03-12 17:32:16 -0700
committerStig Thormodsrud <stig@vyatta.com>2009-03-12 17:32:16 -0700
commitd47c3861fd89e7d0e9af02f2f649e29526d41781 (patch)
tree40418acf708edfca612357f998059509217812f1 /templates
parent7471b6fe77e8e3272f442af27e9204eda478257b (diff)
parent4cce3bd5cf88ac8b4e0dd2f330689d2379a76ee6 (diff)
downloadvyatta-cfg-d47c3861fd89e7d0e9af02f2f649e29526d41781.tar.gz
vyatta-cfg-d47c3861fd89e7d0e9af02f2f649e29526d41781.zip
Merge branch 'jenner' of http://git.vyatta.com/vyatta-cfg into jenner
Diffstat (limited to 'templates')
-rw-r--r--templates/interfaces/ethernet/node.tag/disable/node.def7
-rw-r--r--templates/interfaces/ethernet/node.tag/vif/node.def12
-rw-r--r--templates/interfaces/loopback/node.def2
3 files changed, 16 insertions, 5 deletions
diff --git a/templates/interfaces/ethernet/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/disable/node.def
index 90dd582..3d3ffef 100644
--- a/templates/interfaces/ethernet/node.tag/disable/node.def
+++ b/templates/interfaces/ethernet/node.tag/disable/node.def
@@ -1,5 +1,10 @@
help: Set interface disabled
-update: /etc/netplug/linkdown.d/dhclient $VAR(../@)
+create: vif=`/opt/vyatta/sbin/vyatta-interfaces.pl --vif=$VAR(../@) --show=all`
+ if [ ! -z "$vif" ]; then
+ echo "Can not disable interface " $VAR(../@) " with vif:" $vif
+ exit 1
+ fi
+ /etc/netplug/linkdown.d/dhclient $VAR(../@)
if ! sudo ip link set $VAR(../@) down 2>/dev/null; then
echo "Error disabling dev $VAR(../@)"
/etc/netplug/linkup.d/dhclient $VAR(../@)
diff --git a/templates/interfaces/ethernet/node.tag/vif/node.def b/templates/interfaces/ethernet/node.tag/vif/node.def
index e496a7c..bca6307 100644
--- a/templates/interfaces/ethernet/node.tag/vif/node.def
+++ b/templates/interfaces/ethernet/node.tag/vif/node.def
@@ -2,10 +2,16 @@ tag:
type: u32
help: Set Virtual Local Area Network (VLAN) ID
syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094"
-create: sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@)
- sudo ip link set "$VAR(../@).$VAR(@)" up
+create: read flags < /sys/class/net/$VAR(../@)/flags
+ if [ $(( flags & 1 )) -eq 0 ]
+ then
+ echo "Can not create VLAN on disabled interface: " $VAR(../@)
+ exit 1
+ fi
+ sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) || exit 1
+ sudo ip link set "$VAR(../@).$VAR(@)" up
/opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on
-delete: sudo ip link delete "$VAR(../@).$VAR(@)" type vlan id $VAR(@)
+delete: sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@)
comp_help: possible completions:
<0-4094> Set VLAN ID
diff --git a/templates/interfaces/loopback/node.def b/templates/interfaces/loopback/node.def
index 690dc39..7351a8e 100644
--- a/templates/interfaces/loopback/node.def
+++ b/templates/interfaces/loopback/node.def
@@ -4,4 +4,4 @@ help: Set loopback interface
syntax:expression: exec \
"/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=loopback"
allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=loopback
-update: sudo ip link set $VAR(@) up
+create: sudo ip link set $VAR(@) up