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

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