Blame SOURCES/bz1393189-2-IPaddr2-detect-duplicate-IP.patch

15862b
From 303a738d177a60d001209c6d334ef44f05e1b93b Mon Sep 17 00:00:00 2001
15862b
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
15862b
Date: Tue, 28 Mar 2017 14:15:49 +0200
15862b
Subject: [PATCH] IPaddr2: fix gratuitious ARP checks
15862b
15862b
---
15862b
 heartbeat/IPaddr2 | 24 ++++++++++++++++--------
15862b
 1 file changed, 16 insertions(+), 8 deletions(-)
15862b
15862b
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
15862b
index 27b7208..aea2aa2 100755
15862b
--- a/heartbeat/IPaddr2
15862b
+++ b/heartbeat/IPaddr2
15862b
@@ -710,10 +710,14 @@ run_send_arp() {
15862b
 	if [ $ARP_COUNT -ne 0 ] ; then
15862b
 		ARGS="-i $OCF_RESKEY_arp_interval -r $ARP_COUNT -p $SENDARPPIDFILE $NIC $OCF_RESKEY_ip $MY_MAC not_used not_used"
15862b
 		ocf_log $LOGLEVEL "$SENDARP $ARGS"
15862b
-		if ocf_is_true $OCF_RESKEY_arp_bg; then
15862b
-			($SENDARP $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
15862b
-		else
15862b
-			$SENDARP $ARGS || ocf_log err "Could not send gratuitous arps"
15862b
+		output=$($SENDARP $ARGS 2>&1)
15862b
+		rc=$?
15862b
+		if [ $rc -ne $OCF_SUCCESS ]; then
15862b
+			if ! ocf_is_true $OCF_RESKEY_arp_bg; then
15862b
+			    ocf_log err "send_arp output: $output"
15862b
+			fi
15862b
+			ocf_exit_reason "Could not send gratuitous arps"
15862b
+			exit $OCF_ERR_GENERIC
15862b
 		fi
15862b
 	fi
15862b
 }
15862b
@@ -771,10 +775,14 @@ run_send_ib_arp() {
15862b
 	if [ $ARP_COUNT -ne 0 ] ; then
15862b
 		ARGS="-q -c $ARP_COUNT -U -I $NIC $OCF_RESKEY_ip"
15862b
 		ocf_log $LOGLEVEL "ipoibarping $ARGS"
15862b
-		if ocf_is_true $OCF_RESKEY_arp_bg; then
15862b
-			(ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
15862b
-		else
15862b
-			ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps"
15862b
+		output=$(ipoibarping $ARGS 2>&1)
15862b
+		rc=$?
15862b
+		if [ $rc -ne $OCF_SUCCESS ]; then
15862b
+			if ! ocf_is_true $OCF_RESKEY_arp_bg; then
15862b
+			    ocf_log err "ipoibarping output: $output"
15862b
+			fi
15862b
+			ocf_exit_reason "Could not send gratuitous arps"
15862b
+			exit $OCF_ERR_GENERIC
15862b
 		fi
15862b
 	fi
15862b
 }
15862b
-- 
15862b
2.9.3
15862b