diff options
Diffstat (limited to 'templates/interfaces')
-rw-r--r-- | templates/interfaces/bridge/node.def | 12 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/bridge-group/node.def | 35 |
2 files changed, 30 insertions, 17 deletions
diff --git a/templates/interfaces/bridge/node.def b/templates/interfaces/bridge/node.def index f6b2a8d6..b59ba7b2 100644 --- a/templates/interfaces/bridge/node.def +++ b/templates/interfaces/bridge/node.def @@ -2,6 +2,14 @@ tag: type: txt help: Set bridge interface syntax:expression: $VAR(@) in "br0", "br1", "br2", "br3", "br4", "br5", "br6", "br7", "br8", "br9" ; "Must be (br0 - br9)" -create:expression: "sudo brctl addbr $VAR(@)" -delete:expression: "sudo brctl delbr $VAR(@)" + +create: sudo brctl addbr $VAR(@) + +delete: if [ -n "`/usr/sbin/brctl show | grep $VAR(@) | grep eth`" ]; then + echo "Interfaces are still assigned to bridge $VAR(@)"; + exit 1; + fi; + sudo ip link set $VAR(@) down; + sudo brctl delbr $VAR(@); + comp_help: "Enter bridge interface name (br0 - br9)" diff --git a/templates/interfaces/ethernet/node.tag/bridge-group/node.def b/templates/interfaces/ethernet/node.tag/bridge-group/node.def index 0ac61a19..0f4e9b2c 100644 --- a/templates/interfaces/ethernet/node.tag/bridge-group/node.def +++ b/templates/interfaces/ethernet/node.tag/bridge-group/node.def @@ -1,15 +1,20 @@ -help: Set this interface to a bridge group -commit:expression: $VAR(./bridge/) != ""; "Must set the bridge interface" -create:expression: "sudo brctl addif $VAR(./bridge/@) $VAR(../@)" -delete:expression: "touch /tmp/eth-$VAR(../@)-bridge.$PPID" -end:expression: "\ - if [ -f \"/tmp/eth-$VAR(../@)-bridge.$PPID\" ]; then \ - rm -f /tmp/eth-$VAR(../@)-bridge.$PPID; \ - else \ - if [ -n \"$VAR(./cost/@)\" ]; then \ - sudo brctl setpathcost $VAR(./bridge/@) $VAR(../@) $VAR(./cost/@); \ - fi; \ - if [ -n \"$VAR(./priority/@)\" ]; then \ - sudo brctl setportprio $VAR(./bridge/@) $VAR(../@) $VAR(./priority/@); \ - fi; \ - fi; " +help: Add this interface to a bridge group + +create: sudo brctl addif $VAR(./bridge/@) $VAR(../@); + +delete: touch /tmp/eth-$VAR(../@)-bridge.$PPID; + +end: if [ -f "/tmp/eth-$VAR(../@)-bridge.$PPID" ]; then + rm -f /tmp/eth-$VAR(../@)-bridge.$PPID; + else + if [ -z "$VAR(./bridge/@)" ]; then + echo "Must set the bridge interface"; + exit 1; + fi; + if [ -n "$VAR(./cost/@)" ]; then + sudo brctl setpathcost $VAR(./bridge/@) $VAR(../@) $VAR(./cost/@); + fi; + if [ -n "$VAR(./priority/@)" ]; then + sudo brctl setportprio $VAR(./bridge/@) $VAR(../@) $VAR(./priority/@); + fi; + fi; |