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

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