Blame SOURCES/bz1767916-IPaddr2-clusterip-not-supported.patch

9cf66a
From 92c49b6f2847546f3f938b10a2a97021774f0be3 Mon Sep 17 00:00:00 2001
9cf66a
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
9cf66a
Date: Wed, 4 Dec 2019 14:36:59 +0100
9cf66a
Subject: [PATCH] IPaddr2: ipt_CLUSTERIP "iptables" extension not "nft" backend
9cf66a
 compatible
9cf66a
MIME-Version: 1.0
9cf66a
Content-Type: text/plain; charset=UTF-8
9cf66a
Content-Transfer-Encoding: 8bit
9cf66a
9cf66a
Reference:
9cf66a
https://lists.clusterlabs.org/pipermail/users/2019-December/026674.html
9cf66a
(thread also sketches a future ambition for a [presumably, to revert
9cf66a
the habit of a functional overloading] separate agent to use
9cf66a
"xt_cluster" extension/cluster match).
9cf66a
9cf66a
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
9cf66a
---
9cf66a
 heartbeat/IPaddr2         | 29 ++++++++++++++++++++++-------
9cf66a
 heartbeat/ocf-binaries.in |  2 ++
9cf66a
 2 files changed, 24 insertions(+), 7 deletions(-)
9cf66a
9cf66a
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
9cf66a
index 6f8e8c734..db0b0e547 100755
9cf66a
--- a/heartbeat/IPaddr2
9cf66a
+++ b/heartbeat/IPaddr2
9cf66a
@@ -123,6 +123,8 @@ VLDIR=$HA_RSCTMP
9cf66a
 SENDARPPIDDIR=$HA_RSCTMP
9cf66a
 CIP_lockfile=$HA_RSCTMP/IPaddr2-CIP-${OCF_RESKEY_ip}
9cf66a
 
9cf66a
+IPADDR2_CIP_IPTABLES=$IPTABLES
9cf66a
+
9cf66a
 #######################################################################
9cf66a
 
9cf66a
 meta_data() {
9cf66a
@@ -138,11 +140,21 @@ It can add an IP alias, or remove one.
9cf66a
 In addition, it can implement Cluster Alias IP functionality
9cf66a
 if invoked as a clone resource.
9cf66a
 
9cf66a
-If used as a clone, you should explicitly set clone-node-max >= 2,
9cf66a
+If used as a clone, "shared address with a trivial, stateless
9cf66a
+(autonomous) load-balancing/mutual exclusion on ingress" mode gets
9cf66a
+applied (as opposed to "assume resource uniqueness" mode otherwise).
9cf66a
+For that, Linux firewall (kernel and userspace) is assumed, and since
9cf66a
+recent distributions are ambivalent in plain "iptables" command to
9cf66a
+particular back-end resolution, "iptables-legacy" (when present) gets
9cf66a
+prioritized so as to avoid incompatibilities (note that respective
9cf66a
+ipt_CLUSTERIP firewall extension in use here is, at the same time,
9cf66a
+marked deprecated, yet said "legacy" layer can make it workable,
9cf66a
+literally, to this day) with "netfilter" one (as in "iptables-nft").
9cf66a
+In that case, you should explicitly set clone-node-max >= 2,
9cf66a
 and/or clone-max < number of nodes. In case of node failure,
9cf66a
 clone instances need to be re-allocated on surviving nodes.
9cf66a
-This would not be possible if there is already an instance on those nodes,
9cf66a
-and clone-node-max=1 (which is the default).
9cf66a
+This would not be possible if there is already an instance
9cf66a
+on those nodes, and clone-node-max=1 (which is the default).
9cf66a
 </longdesc>
9cf66a
 
9cf66a
 <shortdesc lang="en">Manages virtual IPv4 and IPv6 addresses (Linux specific version)</shortdesc>
9cf66a
@@ -995,7 +1007,7 @@ ip_start() {
9cf66a
 	
9cf66a
 	if [ -n "$IP_CIP" ] && ([ $ip_status = "no" ] || [ $ip_status = "partial2" ]); then
9cf66a
 		$MODPROBE ip_conntrack
9cf66a
-		$IPTABLES -I INPUT -d $OCF_RESKEY_ip -i $NIC -j CLUSTERIP \
9cf66a
+		$IPADDR2_CIP_IPTABLES -I INPUT -d $OCF_RESKEY_ip -i $NIC -j CLUSTERIP \
9cf66a
 				--new \
9cf66a
 				--clustermac $IF_MAC \
9cf66a
 				--total-nodes $IP_INC_GLOBAL \
9cf66a
@@ -1089,7 +1101,7 @@ ip_stop() {
9cf66a
 			i=1
9cf66a
 			while [ $i -le $IP_INC_GLOBAL ]; do
9cf66a
 				ocf_log info $i
9cf66a
-				$IPTABLES -D INPUT -d $OCF_RESKEY_ip -i $NIC -j CLUSTERIP \
9cf66a
+				$IPADDR2_CIP_IPTABLES -D INPUT -d $OCF_RESKEY_ip -i $NIC -j CLUSTERIP \
9cf66a
 					--new \
9cf66a
 					--clustermac $IF_MAC \
9cf66a
 					--total-nodes $IP_INC_GLOBAL \
9cf66a
@@ -1186,8 +1198,11 @@ ip_validate() {
9cf66a
     set_send_arp_program
9cf66a
 
9cf66a
     if [ -n "$IP_CIP" ]; then
9cf66a
-	check_binary $IPTABLES
9cf66a
-	check_binary $MODPROBE
9cf66a
+        if have_binary "$IPTABLES_LEGACY"; then
9cf66a
+            IPADDR2_CIP_IPTABLES="$IPTABLES_LEGACY"
9cf66a
+        fi
9cf66a
+        check_binary "$IPADDR2_CIP_IPTABLES"
9cf66a
+        check_binary $MODPROBE
9cf66a
     fi
9cf66a
 
9cf66a
 # $BASEIP, $NETMASK, $NIC , $IP_INC_GLOBAL, and $BRDCAST have been checked within ip_init,
9cf66a
diff --git a/heartbeat/ocf-binaries.in b/heartbeat/ocf-binaries.in
9cf66a
index 9439ae170..e9bf95fc2 100644
9cf66a
--- a/heartbeat/ocf-binaries.in
9cf66a
+++ b/heartbeat/ocf-binaries.in
9cf66a
@@ -26,6 +26,8 @@ export PATH
9cf66a
 : ${GREP:=grep}
9cf66a
 : ${IFCONFIG:=ifconfig}
9cf66a
 : ${IPTABLES:=iptables}
9cf66a
+## for cases that are known not to be serviceable with iptables-nft impl.
9cf66a
+: ${IPTABLES_LEGACY:=iptables-legacy}
9cf66a
 : ${IP2UTIL:=ip}
9cf66a
 : ${MDADM:=mdadm}
9cf66a
 : ${MODPROBE:=modprobe}