diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2009-03-25 17:43:55 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2009-03-25 17:43:55 -0700 |
commit | c1403de67085eb6450f6ca1f6cf530b320b5c304 (patch) | |
tree | 80975244737212d26992001e84d4d17d06851d4b /templates | |
parent | 281db5bc7516814f09f22075d101f7f8de640410 (diff) | |
download | vyatta-cfg-system-c1403de67085eb6450f6ca1f6cf530b320b5c304.tar.gz vyatta-cfg-system-c1403de67085eb6450f6ca1f6cf530b320b5c304.zip |
Change bridge check from "syntax" to "create".
Change allowed tag to use new interface check.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/bridge/node.def | 13 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/node.def | 38 |
2 files changed, 27 insertions, 24 deletions
diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/bridge/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/bridge/node.def index e3674bcd..b340ac5b 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/bridge/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/bridge/node.def @@ -1,11 +1,6 @@ type: txt help: Set this interface to a bridge-group -syntax:expression: exec " \ - if [ -z \"`sudo brctl show | grep $VAR(@) `\" ]; then \ - echo bridge interface $VAR(@) doesn\\'t exist on this system ; \ - exit 1 ; \ - fi ; " -delete:expression: "sudo brctl delif $VAR(@) $VAR(../../../@).$VAR(../../@)" -allowed: local -a array ; - array=( /sys/class/net/br* ) ; - echo -n ${array[@]##*/} +commit:expression: exec \ + "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=bridge" +allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=bridge +delete: echo $VAR(@) > /tmp/vifbridge-no.$PPID
\ No newline at end of file diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/node.def index 45be5f48..afd2fc84 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/bridge-group/node.def @@ -1,15 +1,23 @@ -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(../../@).$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(../@) $VAR(./cost/@); \ - fi; \ - if [ -n \"$VAR(./priority/@)\" ]; then \ - sudo brctl setportprio $VAR(./bridge/@) $VAR(../../@).$VAR(../@) $VAR(./priority/@); \ - fi; \ - fi; " +help: Add this interface to a bridge group + +create: sudo brctl addif $VAR(./bridge/@) $VAR(../../@).$VAR(../@); + +delete: touch /tmp/eth-$VAR(../@)-bridge.$PPID; + +end: if [ -f "/tmp/eth-$VAR(../@)-bridge.$PPID" ]; then + rm -f /tmp/eth-$VAR(../@)-bridge.$PPID; + brno=$(cat /tmp/vifbridge-no.$PPID); + sudo brctl delif $brno $VAR(../../@).$VAR(../@); + rm -f /tmp/bridge-no.$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(../@) $VAR(./cost/@); + fi; + if [ -n "$VAR(./priority/@)" ]; then + sudo brctl setportprio $VAR(./bridge/@) $VAR(../../@).$VAR(../@) $VAR(./priority/@); + fi; + fi; |