updated qemu scripts and wit-gc to support new ipv4 forwarding

This commit is contained in:
toby 2019-03-11 02:16:33 +00:00
parent bc47af367a
commit 5be0d4b8fc
4 changed files with 18 additions and 13 deletions

View File

@ -1,10 +1,10 @@
#!/bin/bash
set -e
set -x
IFACE=$1
### IPv4 is IFACE public and has a route? if so, nuke it
for route in $(vtysh -c "show ip route kernel" | grep "$IFACE" | awk '{ print $2 }')
for route in $(vtysh -c "show ip route kernel" | grep "${IFACE}" | grep -Po 'K[ >]\* \K\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,3}')
do
echo "removing route for $IFACE: $route"
ip route del $route
@ -24,9 +24,11 @@ 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; 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"; then #if so is the *local* bridge now empty? if so, nuke the whole bridge including tunnel endpoint
echo "removing unused bridge: $BRIDGE"
ip link del dev $(ls /sys/devices/virtual/net/$BRIDGE/brif/ | grep vxlan)
for uplinkif in ls /sys/devices/virtual/net/$BRIDGE/brif/; do
ip link del dev $uplinkif
done
ip link set down $BRIDGE
brctl delbr $BRIDGE
fi

View File

@ -18,7 +18,7 @@ LOOPBACKIP=$(ip -4 addr show dev lo | grep -Po 'inet \K[\d.]+' | grep -v "^127.0
BRIDGE=br${CLUSTER}
VIF=vxlan${CLUSTER}
[ -z ${PARENTIF:=""} ] || VIF=vlan${CLUSTER} ### if we have a parentif set we're just going to handle it as a legacy old school vlan
[ -z ${PARENTIF:=""} ] || VIF=vlan${CLUSTER} ### if we have a parentif set we're just going to handle it as a legacy old school vlan
ip link set up ${IFACE}

View File

@ -15,7 +15,7 @@ source /etc/libvirt/hooks/$IFACE
: ${PUBLICMAC:=52:54:00:00:00:11}
###
maxprefixv6=60
maxprefixv6=56
maxprefixv4=25
if [ -z $IP ]; then

View File

@ -1,18 +1,21 @@
#!/bin/bash
set -Eeuo pipefail
EMPTYBR=$(for br in /sys/devices/virtual/net/br*; do if [ ! -d $br ]; then continue; fi; ls $br/brif/ | grep -qv vxlan || echo ${br##*/br}; done)
EMPTYBR=$(for br in /sys/devices/virtual/net/br*; do if [ ! -d $br ]; then continue; fi; ls $br/brif/ | grep -qv "vxlan\|vlan" || echo ${br##*/}; done)
for id in $EMPTYBR
for BRIDGE in $EMPTYBR
do
echo "removing unused customer bridge/vxlan id: $id"
ip link del dev vxlan$id
ip link set down br$id
brctl delbr br$id
echo "removing unused customer bridge/vxlan: $BRIDGE"
for uplinkif in ls /sys/devices/virtual/net/$BRIDGE/brif/; do
ip link del dev $uplinkif
done
ip link set down $BRIDGE
brctl delbr $BRIDGE
done
for route in $(vtysh -c "show ip route kernel" | grep 'unknown inactive' | awk '{ print $3 }')
for route in $(vtysh -c "show ip route kernel" | grep 'unknown inactive' | grep -Po 'K[ >]\* \K\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,3}')
do
echo "removing zombie route: $route"
ip route add blackhole $route