updated qemu scripts and wit-gc to support new ipv4 forwarding
This commit is contained in:
parent
bc47af367a
commit
5be0d4b8fc
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -x
|
||||||
IFACE=$1
|
IFACE=$1
|
||||||
|
|
||||||
|
|
||||||
### IPv4 is IFACE public and has a route? if so, nuke it
|
### 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
|
do
|
||||||
echo "removing route for $IFACE: $route"
|
echo "removing route for $IFACE: $route"
|
||||||
ip route del $route
|
ip route del $route
|
||||||
|
@ -24,9 +24,11 @@ if [ ! -z $BRIDGE ]; then
|
||||||
BRIDGE=${BRIDGE##*/}
|
BRIDGE=${BRIDGE##*/}
|
||||||
echo "removing $IFACE from $BRIDGE"
|
echo "removing $IFACE from $BRIDGE"
|
||||||
brctl delif $BRIDGE $IFACE
|
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"
|
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
|
ip link set down $BRIDGE
|
||||||
brctl delbr $BRIDGE
|
brctl delbr $BRIDGE
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -18,7 +18,7 @@ LOOPBACKIP=$(ip -4 addr show dev lo | grep -Po 'inet \K[\d.]+' | grep -v "^127.0
|
||||||
BRIDGE=br${CLUSTER}
|
BRIDGE=br${CLUSTER}
|
||||||
VIF=vxlan${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}
|
ip link set up ${IFACE}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ source /etc/libvirt/hooks/$IFACE
|
||||||
: ${PUBLICMAC:=52:54:00:00:00:11}
|
: ${PUBLICMAC:=52:54:00:00:00:11}
|
||||||
###
|
###
|
||||||
|
|
||||||
maxprefixv6=60
|
maxprefixv6=56
|
||||||
maxprefixv4=25
|
maxprefixv4=25
|
||||||
|
|
||||||
if [ -z $IP ]; then
|
if [ -z $IP ]; then
|
||||||
|
|
17
files/wit-gc
17
files/wit-gc
|
@ -1,18 +1,21 @@
|
||||||
#!/bin/bash
|
#!/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
|
do
|
||||||
echo "removing unused customer bridge/vxlan id: $id"
|
echo "removing unused customer bridge/vxlan: $BRIDGE"
|
||||||
ip link del dev vxlan$id
|
for uplinkif in ls /sys/devices/virtual/net/$BRIDGE/brif/; do
|
||||||
ip link set down br$id
|
ip link del dev $uplinkif
|
||||||
brctl delbr br$id
|
done
|
||||||
|
ip link set down $BRIDGE
|
||||||
|
brctl delbr $BRIDGE
|
||||||
done
|
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
|
do
|
||||||
echo "removing zombie route: $route"
|
echo "removing zombie route: $route"
|
||||||
ip route add blackhole $route
|
ip route add blackhole $route
|
||||||
|
|
Loading…
Reference in New Issue