[PATCH 2/4] Set default multicast port if not specified

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 exec/totemconfig.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/exec/totemconfig.c b/exec/totemconfig.c
index 1f76413..83c1eb2 100644
--- a/exec/totemconfig.c
+++ b/exec/totemconfig.c
@@ -86,6 +86,8 @@
 #define RRP_PROBLEM_COUNT_THRESHOLD_MIN		2
 #define RRP_AUTORECOVERY_CHECK_TIMEOUT		1000
 
+#define DEFAULT_PORT				5405
+
 static char error_string_response[512];
 
 static void add_totem_config_notification(struct totem_config *totem_config);
@@ -296,7 +298,6 @@ extern int totem_config_read (
 		member_count = 0;
 
 		ringnumber = atoi(ringnumber_key);
-
 		/*
 		 * Get the bind net address
 		 */
@@ -340,7 +341,13 @@ extern int totem_config_read (
 		 * Get mcast port
 		 */
 		snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.mcastport", ringnumber);
-		icmap_get_uint16(tmp_key, &totem_config->interfaces[ringnumber].ip_port);
+		if (icmap_get_uint16(tmp_key, &totem_config->interfaces[ringnumber].ip_port) != CS_OK) {
+			if (totem_config->broadcast_use) {
+				totem_config->interfaces[ringnumber].ip_port = DEFAULT_PORT + (2 * ringnumber);
+			} else {
+				totem_config->interfaces[ringnumber].ip_port = DEFAULT_PORT;
+			}
+		}
 
 		/*
 		 * Get the TTL
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux