Blame SOURCES/bz2065138-IPaddr2-enable-more-control-for-IPv6-addresses.patch

d5211c
From fd1d6426a2d05f521207c305d10b49fedd92c2df Mon Sep 17 00:00:00 2001
d5211c
From: Petr Pavlu <petr.pavlu@suse.com>
d5211c
Date: Mon, 28 Feb 2022 09:27:42 +0100
d5211c
Subject: [PATCH 1/4] IPaddr2: Allow to disable Duplicate Address Detection for
d5211c
 IPv6
d5211c
d5211c
"Starting" an IPv6 address with IPaddr2 involves performing Duplicate
d5211c
Address Detection which typically takes at least 1000 ms. Allow the user
d5211c
to disable DAD if they can guarantee that the configured address is not
d5211c
duplicate and they wish to start the resource faster.
d5211c
---
d5211c
 heartbeat/IPaddr2 | 15 +++++++++++++++
d5211c
 1 file changed, 15 insertions(+)
d5211c
d5211c
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
d5211c
index 735dd7779..650392b70 100755
d5211c
--- a/heartbeat/IPaddr2
d5211c
+++ b/heartbeat/IPaddr2
d5211c
@@ -88,6 +88,7 @@ OCF_RESKEY_arp_sender_default=""
d5211c
 OCF_RESKEY_send_arp_opts_default=""
d5211c
 OCF_RESKEY_flush_routes_default="false"
d5211c
 OCF_RESKEY_run_arping_default=false
d5211c
+OCF_RESKEY_nodad_default=false
d5211c
 OCF_RESKEY_noprefixroute_default="false"
d5211c
 OCF_RESKEY_preferred_lft_default="forever"
d5211c
 OCF_RESKEY_network_namespace_default=""
d5211c
@@ -110,6 +111,7 @@ OCF_RESKEY_network_namespace_default=""
d5211c
 : ${OCF_RESKEY_send_arp_opts=${OCF_RESKEY_send_arp_opts_default}}
d5211c
 : ${OCF_RESKEY_flush_routes=${OCF_RESKEY_flush_routes_default}}
d5211c
 : ${OCF_RESKEY_run_arping=${OCF_RESKEY_run_arping_default}}
d5211c
+: ${OCF_RESKEY_nodad=${OCF_RESKEY_nodad_default}}
d5211c
 : ${OCF_RESKEY_noprefixroute=${OCF_RESKEY_noprefixroute_default}}
d5211c
 : ${OCF_RESKEY_preferred_lft=${OCF_RESKEY_preferred_lft_default}}
d5211c
 : ${OCF_RESKEY_network_namespace=${OCF_RESKEY_network_namespace_default}}
d5211c
@@ -391,6 +393,14 @@ Whether or not to run arping for IPv4 collision detection check.
d5211c
 <content type="string" default="${OCF_RESKEY_run_arping_default}"/>
d5211c
 </parameter>
d5211c
 
d5211c
+<parameter name="nodad">
d5211c
+<longdesc lang="en">
d5211c
+For IPv6, do not perform Duplicate Address Detection when adding the address.
d5211c
+</longdesc>
d5211c
+<shortdesc lang="en">Use nodad flag</shortdesc>
d5211c
+<content type="string" default="${OCF_RESKEY_nodad_default}"/>
d5211c
+</parameter>
d5211c
+
d5211c
 <parameter name="noprefixroute">
d5211c
 <longdesc lang="en">
d5211c
 Use noprefixroute flag (see 'man ip-address').
d5211c
@@ -662,6 +672,11 @@ add_interface () {
d5211c
 		msg="Adding $FAMILY address $ipaddr/$netmask with broadcast address $broadcast to device $iface"
d5211c
 	fi
d5211c
 
d5211c
+	if [ "$FAMILY" = "inet6" ] && ocf_is_true "${OCF_RESKEY_nodad}"; then
d5211c
+		cmd="$cmd nodad"
d5211c
+		msg="${msg} (with nodad)"
d5211c
+	fi
d5211c
+
d5211c
 	if ocf_is_true "${OCF_RESKEY_noprefixroute}"; then
d5211c
 		cmd="$cmd noprefixroute"
d5211c
 		msg="${msg} (with noprefixroute)"
d5211c
d5211c
From f4a9e3281d48c5d37f5df593d014706c46ddb3a7 Mon Sep 17 00:00:00 2001
d5211c
From: Petr Pavlu <petr.pavlu@suse.com>
d5211c
Date: Mon, 7 Mar 2022 17:21:59 +0100
d5211c
Subject: [PATCH 2/4] IPaddr2: Allow to send IPv6 Neighbor Advertisements in
d5211c
 background
d5211c
d5211c
"Starting" an IPv6 address with IPaddr2 involves sending Neighbor
d5211c
Advertisement packets to inform neighboring machines about the new
d5211c
IP+MAC translation. By default, 5x packets with 200 ms sleep after each
d5211c
are sent which delays the start by 1000 ms. Allow the user to run this
d5211c
operation in background, similarly as is possible with GARP for IPv4.
d5211c
---
d5211c
 heartbeat/IPaddr2 | 33 +++++++++++++++++++++++++++++----
d5211c
 1 file changed, 29 insertions(+), 4 deletions(-)
d5211c
d5211c
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
d5211c
index 650392b70..e243a642d 100755
d5211c
--- a/heartbeat/IPaddr2
d5211c
+++ b/heartbeat/IPaddr2
d5211c
@@ -83,7 +83,7 @@ OCF_RESKEY_unique_clone_address_default=false
d5211c
 OCF_RESKEY_arp_interval_default=200
d5211c
 OCF_RESKEY_arp_count_default=5
d5211c
 OCF_RESKEY_arp_count_refresh_default=0
d5211c
-OCF_RESKEY_arp_bg_default=true
d5211c
+OCF_RESKEY_arp_bg_default=""
d5211c
 OCF_RESKEY_arp_sender_default=""
d5211c
 OCF_RESKEY_send_arp_opts_default=""
d5211c
 OCF_RESKEY_flush_routes_default="false"
d5211c
@@ -336,9 +336,10 @@ situations.
d5211c
 
d5211c
 <parameter name="arp_bg">
d5211c
 <longdesc lang="en">
d5211c
-Whether or not to send the ARP packets in the background.
d5211c
+Whether or not to send the ARP (IPv4) or NA (IPv6) packets in the background.
d5211c
+The default is true for IPv4 and false for IPv6.
d5211c
 </longdesc>
d5211c
-<shortdesc lang="en">ARP from background</shortdesc>
d5211c
+<shortdesc lang="en">ARP/NA from background</shortdesc>
d5211c
 <content type="string" default="${OCF_RESKEY_arp_bg_default}"/>
d5211c
 </parameter>
d5211c
 
d5211c
@@ -507,6 +508,9 @@ ip_init() {
d5211c
 			ocf_exit_reason "IPv4 does not support lvs_ipv6_addrlabel"
d5211c
 			exit $OCF_ERR_CONFIGURED
d5211c
 		fi
d5211c
+		if [ -z "$OCF_RESKEY_arp_bg" ]; then
d5211c
+			OCF_RESKEY_arp_bg=true
d5211c
+		fi
d5211c
 	else
d5211c
 		FAMILY=inet6
d5211c
 		# address sanitization defined in RFC5952
d5211c
@@ -527,6 +531,9 @@ ip_init() {
d5211c
 			    exit $OCF_ERR_CONFIGURED
d5211c
 			fi
d5211c
 		fi
d5211c
+		if [ -z "$OCF_RESKEY_arp_bg" ]; then
d5211c
+			OCF_RESKEY_arp_bg=false
d5211c
+		fi
d5211c
 	fi
d5211c
 
d5211c
 	# support nic:iflabel format in nic parameter
d5211c
@@ -893,6 +900,20 @@ run_arp_sender() {
d5211c
 	fi
d5211c
 }
d5211c
 
d5211c
+log_send_ua() {
d5211c
+	local cmdline
d5211c
+	local output
d5211c
+	local rc
d5211c
+
d5211c
+	cmdline="$@"
d5211c
+	output=$($cmdline 2>&1)
d5211c
+	rc=$?
d5211c
+	if [ $rc -ne 0 ] ; then
d5211c
+		ocf_log err "Could not send ICMPv6 Unsolicited Neighbor Advertisements: rc=$rc"
d5211c
+	fi
d5211c
+	ocf_log info "$output"
d5211c
+	return $rc
d5211c
+}
d5211c
 
d5211c
 #
d5211c
 # Run send_ua to note send ICMPv6 Unsolicited Neighbor Advertisements.
d5211c
@@ -930,7 +951,11 @@ run_send_ua() {
d5211c
 
d5211c
 	ARGS="-i $OCF_RESKEY_arp_interval -c $OCF_RESKEY_arp_count $OCF_RESKEY_ip $NETMASK $NIC"
d5211c
 	ocf_log info "$SENDUA $ARGS"
d5211c
-	$SENDUA $ARGS || ocf_log err "Could not send ICMPv6 Unsolicited Neighbor Advertisements."
d5211c
+	if ocf_is_true $OCF_RESKEY_arp_bg; then
d5211c
+		log_send_ua $SENDUA $ARGS &
d5211c
+	else
d5211c
+		log_send_ua $SENDUA $ARGS
d5211c
+	fi
d5211c
 }
d5211c
 
d5211c
 # Do we already serve this IP address on the given $NIC?
d5211c
d5211c
From c8afb43012c264f3ee24013a92b2a2f3566db2fd Mon Sep 17 00:00:00 2001
d5211c
From: Petr Pavlu <petr.pavlu@suse.com>
d5211c
Date: Tue, 8 Mar 2022 12:35:56 +0100
d5211c
Subject: [PATCH 3/4] IPaddr2: Log 'ip addr add' options together
d5211c
d5211c
Change the log message in add_interface() from
d5211c
"Adding ... (with <opt1>) (with <opt2>)"
d5211c
to
d5211c
"Adding ... (with <opt1> <opt2>)".
d5211c
---
d5211c
 heartbeat/IPaddr2 | 19 ++++++++++---------
d5211c
 1 file changed, 10 insertions(+), 9 deletions(-)
d5211c
d5211c
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
d5211c
index e243a642d..dca1b6f5b 100755
d5211c
--- a/heartbeat/IPaddr2
d5211c
+++ b/heartbeat/IPaddr2
d5211c
@@ -651,7 +651,7 @@ delete_interface () {
d5211c
 #        Add an interface
d5211c
 #
d5211c
 add_interface () {
d5211c
-	local cmd msg ipaddr netmask broadcast iface label
d5211c
+	local cmd msg extra_opts ipaddr netmask broadcast iface label
d5211c
 
d5211c
 	ipaddr="$1"
d5211c
 	netmask="$2"
d5211c
@@ -679,23 +679,24 @@ add_interface () {
d5211c
 		msg="Adding $FAMILY address $ipaddr/$netmask with broadcast address $broadcast to device $iface"
d5211c
 	fi
d5211c
 
d5211c
+	extra_opts=""
d5211c
 	if [ "$FAMILY" = "inet6" ] && ocf_is_true "${OCF_RESKEY_nodad}"; then
d5211c
-		cmd="$cmd nodad"
d5211c
-		msg="${msg} (with nodad)"
d5211c
+		extra_opts="$extra_opts nodad"
d5211c
 	fi
d5211c
 
d5211c
 	if ocf_is_true "${OCF_RESKEY_noprefixroute}"; then
d5211c
-		cmd="$cmd noprefixroute"
d5211c
-		msg="${msg} (with noprefixroute)"
d5211c
+		extra_opts="$extra_opts noprefixroute"
d5211c
 	fi
d5211c
 
d5211c
 	if [ ! -z "$label" ]; then
d5211c
-		cmd="$cmd label $label"
d5211c
-		msg="${msg} (with label $label)"
d5211c
+		extra_opts="$extra_opts label $label"
d5211c
 	fi
d5211c
 	if [ "$FAMILY" = "inet6" ] ;then
d5211c
-		cmd="$cmd preferred_lft $OCF_RESKEY_preferred_lft"
d5211c
-		msg="${msg} (with preferred_lft $OCF_RESKEY_preferred_lft)"
d5211c
+		extra_opts="$extra_opts preferred_lft $OCF_RESKEY_preferred_lft"
d5211c
+	fi
d5211c
+	if [ -n "$extra_opts" ]; then
d5211c
+		cmd="$cmd$extra_opts"
d5211c
+		msg="$msg (with$extra_opts)"
d5211c
 	fi
d5211c
 
d5211c
 	ocf_log info "$msg"
d5211c
d5211c
From cb4d52ead694718282a40eab24e04b6d85bcc802 Mon Sep 17 00:00:00 2001
d5211c
From: Petr Pavlu <petr.pavlu@suse.com>
d5211c
Date: Mon, 7 Mar 2022 17:25:02 +0100
d5211c
Subject: [PATCH 4/4] IPaddr2: Clarify behavior of 'arp_*' parameters for IPv4
d5211c
 and IPv6
d5211c
d5211c
* Mention that 'arp_*' parameters are shared by the IPv4 and IPv6 code.
d5211c
* Clarify description of these parameters and mark which of them apply
d5211c
  only to IPv4.
d5211c
---
d5211c
 heartbeat/IPaddr2 | 26 +++++++++++++++++---------
d5211c
 1 file changed, 17 insertions(+), 9 deletions(-)
d5211c
d5211c
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
d5211c
index dca1b6f5b..97a7431a2 100755
d5211c
--- a/heartbeat/IPaddr2
d5211c
+++ b/heartbeat/IPaddr2
d5211c
@@ -157,6 +157,12 @@ and/or clone-max < number of nodes. In case of node failure,
d5211c
 clone instances need to be re-allocated on surviving nodes.
d5211c
 This would not be possible if there is already an instance
d5211c
 on those nodes, and clone-node-max=1 (which is the default).
d5211c
+
d5211c
+When the specified IP address gets assigned to a respective interface, the
d5211c
+resource agent sends unsolicited ARP (Address Resolution Protocol, IPv4) or NA
d5211c
+(Neighbor Advertisement, IPv6) packets to inform neighboring machines about the
d5211c
+change. This functionality is controlled for both IPv4 and IPv6 by shared
d5211c
+'arp_*' parameters.
d5211c
 </longdesc>
d5211c
 
d5211c
 <shortdesc lang="en">Manages virtual IPv4 and IPv6 addresses (Linux specific version)</shortdesc>
d5211c
@@ -306,28 +312,30 @@ a unique address to manage
d5211c
 
d5211c
 <parameter name="arp_interval">
d5211c
 <longdesc lang="en">
d5211c
-Specify the interval between unsolicited ARP packets in milliseconds.
d5211c
+Specify the interval between unsolicited ARP (IPv4) or NA (IPv6) packets in
d5211c
+milliseconds.
d5211c
 
d5211c
 This parameter is deprecated and used for the backward compatibility only.
d5211c
 It is effective only for the send_arp binary which is built with libnet,
d5211c
 and send_ua for IPv6. It has no effect for other arp_sender.
d5211c
 </longdesc>
d5211c
-<shortdesc lang="en">ARP packet interval in ms (deprecated)</shortdesc>
d5211c
+<shortdesc lang="en">ARP/NA packet interval in ms (deprecated)</shortdesc>
d5211c
 <content type="integer" default="${OCF_RESKEY_arp_interval_default}"/>
d5211c
 </parameter>
d5211c
 
d5211c
 <parameter name="arp_count">
d5211c
 <longdesc lang="en">
d5211c
-Number of unsolicited ARP packets to send at resource initialization.
d5211c
+Number of unsolicited ARP (IPv4) or NA (IPv6) packets to send at resource
d5211c
+initialization.
d5211c
 </longdesc>
d5211c
-<shortdesc lang="en">ARP packet count sent during initialization</shortdesc>
d5211c
+<shortdesc lang="en">ARP/NA packet count sent during initialization</shortdesc>
d5211c
 <content type="integer" default="${OCF_RESKEY_arp_count_default}"/>
d5211c
 </parameter>
d5211c
 
d5211c
 <parameter name="arp_count_refresh">
d5211c
 <longdesc lang="en">
d5211c
-Number of unsolicited ARP packets to send during resource monitoring. Doing
d5211c
-so helps mitigate issues of stuck ARP caches resulting from split-brain
d5211c
+For IPv4, number of unsolicited ARP packets to send during resource monitoring.
d5211c
+Doing so helps mitigate issues of stuck ARP caches resulting from split-brain
d5211c
 situations.
d5211c
 </longdesc>
d5211c
 <shortdesc lang="en">ARP packet count sent during monitoring</shortdesc>
d5211c
@@ -345,7 +353,7 @@ The default is true for IPv4 and false for IPv6.
d5211c
 
d5211c
 <parameter name="arp_sender">
d5211c
 <longdesc lang="en">
d5211c
-The program to send ARP packets with on start. Available options are:
d5211c
+For IPv4, the program to send ARP packets with on start. Available options are:
d5211c
  - send_arp: default
d5211c
  - ipoibarping: default for infiniband interfaces if ipoibarping is available
d5211c
  - iputils_arping: use arping in iputils package
d5211c
@@ -357,7 +365,7 @@ The program to send ARP packets with on start. Available options are:
d5211c
 
d5211c
 <parameter name="send_arp_opts">
d5211c
 <longdesc lang="en">
d5211c
-Extra options to pass to the arp_sender program.
d5211c
+For IPv4, extra options to pass to the arp_sender program.
d5211c
 Available options are vary depending on which arp_sender is used.
d5211c
 
d5211c
 A typical use case is specifying '-A' for iputils_arping to use
d5211c
@@ -388,7 +396,7 @@ IP address goes away.
d5211c
 
d5211c
 <parameter name="run_arping">
d5211c
 <longdesc lang="en">
d5211c
-Whether or not to run arping for IPv4 collision detection check.
d5211c
+For IPv4, whether or not to run arping for collision detection check.
d5211c
 </longdesc>
d5211c
 <shortdesc lang="en">Run arping for IPv4 collision detection check</shortdesc>
d5211c
 <content type="string" default="${OCF_RESKEY_run_arping_default}"/>