# Contributed by: Thomas Bächler . "$SUBR_DIR/ip" BRCTL="/usr/sbin/brctl" bridge_up() { if is_interface "$Interface"; then if [[ ! -d "/sys/class/net/$Interface/brif" ]]; then report_error "Interface '$Interface' already exists and is not a bridge" return 1 fi else $BRCTL addbr "$Interface" fi for member in "${BindsToInterfaces[@]}"; do ip link set "$member" promisc on up ip addr flush dev "$member" $BRCTL addif "$Interface" "$member" done # Set options [[ "$FwdDelay" ]] && $BRCTL setfd "$Interface" "$FwdDelay" [[ "$MaxAge" ]] && $BRCTL setmaxage "$Interface" "$MaxAge" bring_interface_up "$Interface" ip_set } bridge_down() { for member in "${BindsToInterfaces[@]}"; do ip link set "$member" promisc off down $BRCTL delif "$Interface" "$member" done ip_unset bring_interface_down "$Interface" $BRCTL delbr "$Interface" } # vim: set ts=4 et sw=4: