nicer output on ifdown... being anal

This commit is contained in:
toby 2019-04-22 23:56:23 +00:00
parent d3a64d956c
commit c5ecd31709
1 changed files with 2 additions and 2 deletions

View File

@ -23,9 +23,9 @@ if [ ! -z $BRIDGE ]; then
BRIDGE=${BRIDGE##*/}
echo "removing $IFACE from $BRIDGE"
brctl delif $BRIDGE $IFACE
if ! ls /sys/devices/virtual/net/$BRIDGE/brif/ | grep -qv "vxlan\|vlan"; then #if so is the *local* bridge now empty? if so, nuke the whole bridge including tunnel endpoint
if ! ls /sys/devices/virtual/net/$BRIDGE/brif/ | grep -qv "vxlan\|vlan" 2>/dev/null; then #if so is the *local* bridge now empty? if so, nuke the whole bridge including tunnel endpoint
echo "removing unused bridge: $BRIDGE"
for uplinkif in ls /sys/devices/virtual/net/$BRIDGE/brif/; do
for uplinkif in $(ls /sys/devices/virtual/net/$BRIDGE/brif/ 2>/dev/null); do
ip link del dev $uplinkif
done
ip link set down $BRIDGE