#!/bin/bash
-MAC2EUI64=/usr/bin/mac2eui64
-
source /etc/default/snf-network
+source /usr/lib/snf-network/common.sh
host=$(hostname)
domain=$(hostname -d)
for tag in $TAGS; do
case $tag in
$IP_LESS_ROUTED_TAG)
- uplink=$(ip route list table $LINK | grep "default via" | awk '{print $5}')
- uplink6=$(ip -6 route list table $LINK | grep "default via" | awk '{print $5}')
- eui64=$($MAC2EUI64 $MAC $SUBNET6 2>/dev/null)
- if [ "$GANETI_INSTANCE_PRIMARY" = "$host.$domain" ]; then
+ if [ "$GANETI_OLD_PRIMARY" == "$host.$domain" ]; then
# This runs on the source node
- hooks-log $0 "ip -6 neigh del proxy $eui64 dev $uplink6"
- ip -6 neigh del proxy $eui64 dev $uplink6 >/dev/null 2>&1
- else
- # This runs on the target node
- # Send GARP from host to upstream router to speed up mac change for the VMs IP
- hooks-log $0 "arping -c3 -I $uplink -U $IP"
- echo 1 > /proc/sys/net/ipv4/ip_nonlocal_bind
- arping -c3 -I $uplink -U $IP
- echo 0 > /proc/sys/net/ipv4/ip_nonlocal_bind
- # Send Unsolicited Neighbor Advertisement to speed up nd change for the VMs IP
- hooks-log $0 "ndsend $eui64 $uplink6"
- ndsend $eui64 $uplink6
+ get_uplink $LINK "-6"
+ get_eui64 $MAC $SUBNET6
+ hooks-log $0 "ip -6 neigh del proxy $EUI64 dev $UPLINK"
+ ip -6 neigh del proxy $EUI64 dev $UPLINK >/dev/null 2>&1
+ elif [ "$GANETI_NEW_PRIMARY" == "$host.$domain" ]; then
+ hooks-log $0 "Do nothing in new primary. All done by if-up script"
fi
;;
esac