Blame SOURCES/bz773464-3-config-Ensure-mcast-address-port-differs-for-rrp.patch

f1cb04
From 6449bea835c90045baa23e3e041fed1df2abf070 Mon Sep 17 00:00:00 2001
f1cb04
From: Jan Friesse <jfriesse@redhat.com>
f1cb04
Date: Mon, 24 Nov 2014 11:54:20 +0100
f1cb04
Subject: [PATCH] config: Ensure mcast address/port differs for rrp
f1cb04
f1cb04
When using multiple interfaces, it's necessary to use different
f1cb04
multicast address/port pair for each interface to make
f1cb04
rrp work correctly. This is now checked in parser.
f1cb04
f1cb04
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
f1cb04
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
f1cb04
---
f1cb04
 exec/totemconfig.c  |   19 ++++++++++++++++++-
f1cb04
 man/corosync.conf.5 |    4 ++++
f1cb04
 2 files changed, 22 insertions(+), 1 deletions(-)
f1cb04
f1cb04
diff --git a/exec/totemconfig.c b/exec/totemconfig.c
f1cb04
index 9cb9b07..2acee2a 100644
f1cb04
--- a/exec/totemconfig.c
f1cb04
+++ b/exec/totemconfig.c
f1cb04
@@ -1022,8 +1022,9 @@ int totem_config_validate (
f1cb04
 	static char local_error_reason[512];
f1cb04
 	char parse_error[512];
f1cb04
 	const char *error_reason = local_error_reason;
f1cb04
-	int i;
f1cb04
+	int i, j;
f1cb04
 	unsigned int interface_max = INTERFACE_MAX;
f1cb04
+	unsigned int port1, port2;
f1cb04
 
f1cb04
 	if (totem_config->interface_count == 0) {
f1cb04
 		error_reason = "No interfaces defined";
f1cb04
@@ -1083,6 +1084,22 @@ int totem_config_validate (
f1cb04
 			error_reason =  "Not all bind address belong to the same IP family";
f1cb04
 			goto parse_error;
f1cb04
 		}
f1cb04
+
f1cb04
+		/*
f1cb04
+		 * Ensure mcast address/port differs
f1cb04
+		 */
f1cb04
+		if (totem_config->transport_number == TOTEM_TRANSPORT_UDP) {
f1cb04
+			for (j = i + 1; j < totem_config->interface_count; j++) {
f1cb04
+				port1 = totem_config->interfaces[i].ip_port;
f1cb04
+				port2 = totem_config->interfaces[j].ip_port;
f1cb04
+				if (totemip_equal(&totem_config->interfaces[i].mcast_addr,
f1cb04
+				    &totem_config->interfaces[j].mcast_addr) &&
f1cb04
+				    (((port1 > port2 ? port1 : port2)  - (port1 < port2 ? port1 : port2)) <= 1)) {
f1cb04
+					error_reason = "Interfaces multicast address/port pair must differ";
f1cb04
+					goto parse_error;
f1cb04
+				}
f1cb04
+			}
f1cb04
+		}
f1cb04
 	}
f1cb04
 
f1cb04
 	if (totem_config->version != 2) {
f1cb04
diff --git a/man/corosync.conf.5 b/man/corosync.conf.5
f1cb04
index 95eca2d..8e774c1 100644
f1cb04
--- a/man/corosync.conf.5
f1cb04
+++ b/man/corosync.conf.5
f1cb04
@@ -213,6 +213,10 @@ be chosen.
f1cb04
 The maximum number of interface directives that is allowed for either 
f1cb04
 modes (active or passive) is 2.
f1cb04
 
f1cb04
+When using multiple interfaces, make sure to use different multicast
f1cb04
+address/port (port for same address must differ by at least two) pair
f1cb04
+for each interface (this is checked by parser) to make rrp works.
f1cb04
+
f1cb04
 .TP
f1cb04
 netmtu
f1cb04
 This specifies the network maximum transmit unit.  To set this value beyond
f1cb04
-- 
f1cb04
1.7.1
f1cb04