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