Blame SOURCES/bz1804658-azure-lb-2-add-socat-support.patch

02ddf4
From 8bc6c37607c3908976e502c1b6a3d9b1a79c010a Mon Sep 17 00:00:00 2001
02ddf4
From: Peter Varkoly <varkoly@suse.com>
02ddf4
Date: Mon, 30 Sep 2019 14:31:39 +0200
02ddf4
Subject: [PATCH] Adapt azure-lb Resource Agent to support socat usage too
02ddf4
02ddf4
---
02ddf4
 heartbeat/azure-lb | 10 ++++++++--
02ddf4
 1 file changed, 8 insertions(+), 2 deletions(-)
02ddf4
02ddf4
diff --git a/heartbeat/azure-lb b/heartbeat/azure-lb
02ddf4
index 35d364be7..5ee767474 100755
02ddf4
--- a/heartbeat/azure-lb
02ddf4
+++ b/heartbeat/azure-lb
02ddf4
@@ -53,9 +53,11 @@ Resource agent to answer Azure Load Balancer health probe requests
02ddf4
 
02ddf4
 <parameter name="nc">
02ddf4
 <longdesc lang="en">
02ddf4
-The full name of the nc binary.
02ddf4
+The full path of the used binary. This can be nc or socat path.
02ddf4
+The default is /usr/bin/nc.
02ddf4
+If you need /usr/bin/socat this parameter should be set.
02ddf4
 </longdesc>
02ddf4
-<shortdesc lang="en">Full path name of the nc binary</shortdesc>
02ddf4
+<shortdesc lang="en">Full path of the used binary (nc or socat are allowed)</shortdesc>
02ddf4
 <content type="string" default="${OCF_RESKEY_nc_default}"/>
02ddf4
 </parameter>
02ddf4
 
02ddf4
@@ -100,6 +102,10 @@ lb_monitor() {
02ddf4
 
02ddf4
 lb_start() {
02ddf4
 	cmd="$OCF_RESKEY_nc -l -k $OCF_RESKEY_port"
02ddf4
+	if [ $( basename $OCF_RESKEY_nc ) = 'socat' ]; then
02ddf4
+		#socat has different parameters
02ddf4
+		cmd="$OCF_RESKEY_nc -U TCP-LISTEN:$OCF_RESKEY_port,backlog=10,fork,reuseaddr /dev/null"
02ddf4
+	fi
02ddf4
 	if ! lb_monitor; then
02ddf4
 		ocf_log debug "Starting $process: $cmd"
02ddf4
 		# Execute the command as created above