03-bridge 458 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. [ -x /usr/sbin/brctl ] || exit 0
  3. case "$IF_BRIDGE_PORTS" in
  4. "")
  5. exit 0
  6. ;;
  7. none)
  8. INTERFACES=""
  9. ;;
  10. *)
  11. INTERFACES="$IF_BRIDGE_PORTS"
  12. ;;
  13. esac
  14. brctl addbr $IFACE || exit 1
  15. for IF in $INTERFACES; do
  16. if ! grep -q $IF /proc/net/dev; then
  17. echo "Error: interface '$IF' does not exist!"
  18. brctl delbr $IFACE
  19. exit 1
  20. fi
  21. brctl addif $IFACE $IF
  22. ip link set up dev $IF
  23. done
  24. exit 0