Blame SOURCES/bz773464-2-config-Process-broadcast-option-consistently.patch

f1cb04
From 70bd35fc06e68a010d780dfa39bd68d4bd2f7da7 Mon Sep 17 00:00:00 2001
f1cb04
From: Jan Friesse <jfriesse@redhat.com>
f1cb04
Date: Mon, 24 Nov 2014 10:32:03 +0100
f1cb04
Subject: [PATCH] config: Process broadcast option consistently
f1cb04
f1cb04
Broadcast option is global but in config set in interface section. When
f1cb04
more interfaces are defined, only broadcast from last section was used.
f1cb04
f1cb04
Solution is to use broadcast whenever at least one interface use
f1cb04
broadcast.
f1cb04
f1cb04
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
f1cb04
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
f1cb04
---
f1cb04
 exec/totemconfig.c |   20 ++++++++++++++++----
f1cb04
 1 files changed, 16 insertions(+), 4 deletions(-)
f1cb04
f1cb04
diff --git a/exec/totemconfig.c b/exec/totemconfig.c
f1cb04
index 3bcf49d..9cb9b07 100644
f1cb04
--- a/exec/totemconfig.c
f1cb04
+++ b/exec/totemconfig.c
f1cb04
@@ -812,6 +812,12 @@ extern int totem_config_read (
f1cb04
 		free(str);
f1cb04
 	}
f1cb04
 
f1cb04
+	/*
f1cb04
+	 * Broadcast option is global but set in interface section,
f1cb04
+	 * so reset before processing interfaces.
f1cb04
+	 */
f1cb04
+	totem_config->broadcast_use = 0;
f1cb04
+
f1cb04
 	iter = icmap_iter_init("totem.interface.");
f1cb04
 	while ((iter_key = icmap_iter_next(iter, NULL, NULL)) != NULL) {
f1cb04
 		res = sscanf(iter_key, "totem.interface.%[^.].%s", ringnumber_key, tmp_key);
f1cb04
@@ -866,14 +872,10 @@ extern int totem_config_read (
f1cb04
 					&totem_config->interfaces[ringnumber].mcast_addr);
f1cb04
 		}
f1cb04
 
f1cb04
-		totem_config->broadcast_use = 0;
f1cb04
 		snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.broadcast", ringnumber);
f1cb04
 		if (icmap_get_string(tmp_key, &str) == CS_OK) {
f1cb04
 			if (strcmp (str, "yes") == 0) {
f1cb04
 				totem_config->broadcast_use = 1;
f1cb04
-				totemip_parse (
f1cb04
-					&totem_config->interfaces[ringnumber].mcast_addr,
f1cb04
-					"255.255.255.255", totem_config->ip_version);
f1cb04
 			}
f1cb04
 			free(str);
f1cb04
 		}
f1cb04
@@ -927,6 +929,16 @@ extern int totem_config_read (
f1cb04
 	icmap_iter_finalize(iter);
f1cb04
 
f1cb04
 	/*
f1cb04
+	 * Use broadcast is global, so if set, make sure to fill mcast addr correctly
f1cb04
+	 */
f1cb04
+	if (totem_config->broadcast_use) {
f1cb04
+		for (ringnumber = 0; ringnumber < totem_config->interface_count; ringnumber++) {
f1cb04
+			totemip_parse (&totem_config->interfaces[ringnumber].mcast_addr,
f1cb04
+				"255.255.255.255", 0);
f1cb04
+		}
f1cb04
+	}
f1cb04
+
f1cb04
+	/*
f1cb04
 	 * Store automatically generated items back to icmap
f1cb04
 	 */
f1cb04
 	for (i = 0; i < totem_config->interface_count; i++) {
f1cb04
-- 
f1cb04
1.7.1
f1cb04