From 53b63cc97f84ac3d63f20e7f3ba524cf95c684be Mon Sep 17 00:00:00 2001 From: "Sean M. Collins" Date: Thu, 28 Apr 2016 13:33:38 -0500 Subject: [PATCH] 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 --- lib/neutron-legacy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/neutron-legacy b/lib/neutron-legacy index f0592e2f37..d2a222117f 100644 --- a/lib/neutron-legacy +++ b/lib/neutron-legacy @@ -859,6 +859,13 @@ function _move_neutron_addresses_route { 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 @@ function _move_neutron_addresses_route { # 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 }