diff options
4 files changed, 44 insertions, 24 deletions
diff --git a/debian/changelog b/debian/changelog index 8c380f0d..a6e7d9c6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +vyatta-cfg-system (0.15.10) unstable; urgency=low + + * Add "interface ethernet <> bridge-group bridge" update tag in + addition to create tag. + + -- Stig Thormodsrud <stig@vyatta.com> Wed, 25 Mar 2009 18:22:28 -0700 + +vyatta-cfg-system (0.15.9) unstable; urgency=low + + * Change bridge check from "syntax" to "create". + + -- Stig Thormodsrud <stig@vyatta.com> Wed, 25 Mar 2009 17:45:33 -0700 + vyatta-cfg-system (0.15.8) unstable; urgency=low * move keepalived.pm to vyatta-cfg diff --git a/templates/interfaces/ethernet/node.tag/bridge-group/node.def b/templates/interfaces/ethernet/node.tag/bridge-group/node.def index 9309f683..fbff9acd 100644 --- a/templates/interfaces/ethernet/node.tag/bridge-group/node.def +++ b/templates/interfaces/ethernet/node.tag/bridge-group/node.def @@ -1,6 +1,8 @@ help: Add this interface to a bridge group create: sudo brctl addif $VAR(./bridge/@) $VAR(../@); +update:expression: "false"; \ + "Delete previous bridge group first" delete: touch /tmp/eth-$VAR(../@)-bridge.$PPID; 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..7e33b9d5 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,25 @@ -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(../@); +update:expression: "false"; \ + "Delete previous bridge group first" + +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; |