Use arping when moving an IP address
This helps fix an issue where an IPv4 address is moved from an interface
and you lose your SSH session.
Change-Id: Idf37ccbaa6f615fcc714d49c3f0c00c893f56021
diff --git a/lib/neutron-legacy b/lib/neutron-legacy
index f0592e2..d2a2221 100644
--- a/lib/neutron-legacy
+++ b/lib/neutron-legacy
@@ -859,6 +859,13 @@
IP_BRD=$(ip -f $af a s dev $from_intf scope global primary | grep inet | awk '{ print $2, $3, $4; exit }')
+ if [[ "$af" == "inet" ]]; then
+ IP=$(echo $IP_BRD | awk '{ print $1; exit }' | grep -o -E '(.*)/' | cut -d "/" -f1)
+ ARP_CMD="arping -A -c 3 -w 4.5 -I $to_intf $IP "
+ else
+ ARP_CMD=""
+ fi
+
if [ "$DEFAULT_ROUTE_GW" != "" ]; then
ADD_DEFAULT_ROUTE="sudo ip -f $af r replace default via $DEFAULT_ROUTE_GW dev $to_intf"
fi
@@ -879,7 +886,7 @@
# The add/del OVS port calls have to happen either before or
# after the address is moved in order to not leave it orphaned.
- $DEL_OVS_PORT; $IP_DEL; $IP_ADD; $IP_UP; $ADD_OVS_PORT; $ADD_DEFAULT_ROUTE
+ $DEL_OVS_PORT; $IP_DEL; $IP_ADD; $IP_UP; $ADD_OVS_PORT; $ADD_DEFAULT_ROUTE; $ARP_CMD
fi
}