- ifconfig "$iface" up 2>/dev/null >/dev/null
- ifconfig "br-$config" 2>/dev/null >/dev/null && {
- $DEBUG brctl addif "br-$config" "$iface"
- return 0
- } || {
- $DEBUG brctl addbr "br-$config"
- $DEBUG brctl setfd "br-$config" 0
- $DEBUG brctl addif "br-$config" "$iface"
- iface="br-$config"
+ [ -x /usr/sbin/brctl ] && {
+ ifconfig "br-$config" 2>/dev/null >/dev/null && {
+ $DEBUG brctl addif "br-$config" "$iface"
+ # Bridge existed already. No further processing necesary
+ } || {
+ $DEBUG brctl addbr "br-$config"
+ $DEBUG brctl setfd "br-$config" 0
+ $DEBUG ifconfig "br-$config" up
+ $DEBUG brctl addif "br-$config" "$iface"
+ $DEBUG brctl stp "br-$config" ${stp:-off}
+ # Creating the bridge here will have triggered a hotplug event, which will
+ # result in another setup_interface() call, so we simply stop processing
+ # the current event at this point.
+ }
+ ifconfig "$iface" up 2>/dev/null >/dev/null
+ return 1