Blob Blame History Raw
From 303a738d177a60d001209c6d334ef44f05e1b93b Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Tue, 28 Mar 2017 14:15:49 +0200
Subject: [PATCH] IPaddr2: fix gratuitious ARP checks

---
 heartbeat/IPaddr2 | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
index 27b7208..aea2aa2 100755
--- a/heartbeat/IPaddr2
+++ b/heartbeat/IPaddr2
@@ -710,10 +710,14 @@ run_send_arp() {
 	if [ $ARP_COUNT -ne 0 ] ; then
 		ARGS="-i $OCF_RESKEY_arp_interval -r $ARP_COUNT -p $SENDARPPIDFILE $NIC $OCF_RESKEY_ip $MY_MAC not_used not_used"
 		ocf_log $LOGLEVEL "$SENDARP $ARGS"
-		if ocf_is_true $OCF_RESKEY_arp_bg; then
-			($SENDARP $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
-		else
-			$SENDARP $ARGS || ocf_log err "Could not send gratuitous arps"
+		output=$($SENDARP $ARGS 2>&1)
+		rc=$?
+		if [ $rc -ne $OCF_SUCCESS ]; then
+			if ! ocf_is_true $OCF_RESKEY_arp_bg; then
+			    ocf_log err "send_arp output: $output"
+			fi
+			ocf_exit_reason "Could not send gratuitous arps"
+			exit $OCF_ERR_GENERIC
 		fi
 	fi
 }
@@ -771,10 +775,14 @@ run_send_ib_arp() {
 	if [ $ARP_COUNT -ne 0 ] ; then
 		ARGS="-q -c $ARP_COUNT -U -I $NIC $OCF_RESKEY_ip"
 		ocf_log $LOGLEVEL "ipoibarping $ARGS"
-		if ocf_is_true $OCF_RESKEY_arp_bg; then
-			(ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
-		else
-			ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps"
+		output=$(ipoibarping $ARGS 2>&1)
+		rc=$?
+		if [ $rc -ne $OCF_SUCCESS ]; then
+			if ! ocf_is_true $OCF_RESKEY_arp_bg; then
+			    ocf_log err "ipoibarping output: $output"
+			fi
+			ocf_exit_reason "Could not send gratuitous arps"
+			exit $OCF_ERR_GENERIC
 		fi
 	fi
 }
-- 
2.9.3