Blame SOURCES/bz1744224-IPsrcaddr-2-local-rule-destination-fixes.patch

b4b3ce
From 0e73d3f474d08779b64ed99fb3f80c1e806ff1b7 Mon Sep 17 00:00:00 2001
b4b3ce
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
b4b3ce
Date: Thu, 28 Nov 2019 16:11:51 +0100
b4b3ce
Subject: [PATCH] IPsrcaddr: fixes to replace local rule if using local table,
b4b3ce
 and set src back to primary for device on stop
b4b3ce
b4b3ce
---
b4b3ce
 heartbeat/IPsrcaddr | 14 ++++++++++++--
b4b3ce
 1 file changed, 12 insertions(+), 2 deletions(-)
b4b3ce
b4b3ce
diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr
b4b3ce
index d80b72165..f9085f082 100755
b4b3ce
--- a/heartbeat/IPsrcaddr
b4b3ce
+++ b/heartbeat/IPsrcaddr
b4b3ce
@@ -75,6 +75,10 @@ USAGE="usage: $0 {start|stop|status|monitor|validate-all|meta-data}";
b4b3ce
   CMDSHOW="$IP2UTIL route show   $TABLE to exact $OCF_RESKEY_destination"
b4b3ce
 CMDCHANGE="$IP2UTIL route change to "
b4b3ce
 
b4b3ce
+if [ "$OCF_RESKEY_table" = "local" ]; then
b4b3ce
+	TABLE="$TABLE local"
b4b3ce
+fi
b4b3ce
+
b4b3ce
 SYSTYPE="`uname -s`"
b4b3ce
 
b4b3ce
 usage() {
b4b3ce
@@ -247,8 +251,14 @@ srca_stop() {
b4b3ce
 	  
b4b3ce
 	[ $rc = 2 ] && errorexit "The address you specified to stop does not match the preferred source address"
b4b3ce
 
b4b3ce
-	$IP2UTIL route replace $TABLE $NETWORK dev $INTERFACE || \
b4b3ce
-		errorexit "command 'ip route replace $TABLE $NETWORK dev $INTERFACE' failed"
b4b3ce
+	OPTS=""
b4b3ce
+	if [ "$OCF_RESKEY_destination" != "0.0.0.0/0" ] ;then
b4b3ce
+		PRIMARY_IP="$($IP2UTIL -4 -o addr show dev eth0 primary | awk '{split($4,a,"/");print a[1]}')"
b4b3ce
+		OPTS="proto kernel scope host src $PRIMARY_IP"
b4b3ce
+	fi
b4b3ce
+
b4b3ce
+	$IP2UTIL route replace $TABLE $NETWORK dev $INTERFACE $OPTS || \
b4b3ce
+		errorexit "command 'ip route replace $TABLE $NETWORK dev $INTERFACE $OPTS' failed"
b4b3ce
 
b4b3ce
 	if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] ;then
b4b3ce
 		$CMDCHANGE $ROUTE_WO_SRC || \