summaryrefslogtreecommitdiff
path: root/templates/interfaces/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'templates/interfaces/bridge')
-rw-r--r--templates/interfaces/bridge/node.def9
-rw-r--r--templates/interfaces/bridge/node.tag/address/node.def12
2 files changed, 16 insertions, 5 deletions
diff --git a/templates/interfaces/bridge/node.def b/templates/interfaces/bridge/node.def
index a7d82012..55c961ba 100644
--- a/templates/interfaces/bridge/node.def
+++ b/templates/interfaces/bridge/node.def
@@ -8,10 +8,11 @@ syntax:expression: pattern $VAR(@) "^br[0-9]+$" ; "Must be (br0 - br999)"
create: sudo brctl addbr $VAR(@)
sudo ip link set $VAR(@) up
-delete: if [ -n "`ls /sys/class/net/$VAR(@)/brif`" ]; then
- echo "Interfaces are still assigned to bridge $VAR(@)";
- exit 1;
- fi;
+delete: if ! /opt/vyatta/sbin/vyatta-bridgegroup-depedency.pl \
+ --no-interfaces-assigned \
+ --bridge-interface="$VAR(@)"; then \
+ exit 1
+ fi
sudo ip link set $VAR(@) down;
sudo brctl delbr $VAR(@);
diff --git a/templates/interfaces/bridge/node.tag/address/node.def b/templates/interfaces/bridge/node.tag/address/node.def
index 0c4ba0bd..7278df30 100644
--- a/templates/interfaces/bridge/node.tag/address/node.def
+++ b/templates/interfaces/bridge/node.tag/address/node.def
@@ -5,7 +5,17 @@ help: Set an IP address for this interface
syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr $VAR(@) --dev $VAR(../@)";\
"Invalid IP address/prefix [$VAR(@)] for interface $VAR(../@)"
create: sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../@)
-delete: sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../@)
+delete:
+ if /opt/vyatta/sbin/vyatta-bridgegroup-depedency.pl \
+ --bridge-notin-proposedcfg \
+ --bridge-interface="$VAR(../@)"; then \
+ # bridge has higher priority than bridge-address so bridge gets deleted
+ # before bridge-address in case the whole of bridge config was deleted.
+ # In that case we do not need to delete address here now
+ exit 0
+ else
+ sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../@)
+ fi
allowed: echo "dhcp <>"
comp_help:Possible completions:
<x.x.x.x/x> Set the IP address and prefix length