# Contributed by: Jonathan Hudson # Mainly "researched" from more competent implementations # As public domain as your jurisdiction allows . "$SUBR_DIR/ip" OVSCTL="/usr/bin/ovs-vsctl" # Make sure BindsToInterfaces is set BindsToInterfaces=("${BindsToInterfaces[@]}") openvswitch_up() { if ! $OVSCTL br-exists "$Interface"; then $OVSCTL add-br "$Interface" fi for ovs_client in "${BindsToInterfaces[@]}"; do ip link set "$ovs_client" promisc on up ip addr flush dev "$ovs_client" if ! $OVSCTL list-ports "$Interface" | grep -q "$ovs_client"; then $OVSCTL add-port "$Interface" "$ovs_client" fi done bring_interface_up "$Interface" ip_set } openvswitch_down() { for ovs_client in "${BindsToInterfaces[@]}"; do ip link set "$ovs_client" promisc off down if $OVSCTL list-ports "$Interface" | grep -q "$ovs_client"; then $OVSCTL del-port "$Interface" "$ovs_client" fi done ip_unset bring_interface_down "$Interface" } # vim: set ts=4 et sw=4: