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

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

 



Steve,
it's automatic ring number. With rrp, it will work without any problem IF:
- user uses cluster_name, because then every ring has it's own mcast address
- user use mcastaddr, but they are different for each ring
- user uses same mcastaddr for each ring, but must specify port

One of TODO is to "reuse" little more code from cman, and this time it should be collision detection part (2 rings with same mcastaddr:port(port-1), broadcast with same port, ...)

Honza

Steven Dake napsal(a):
This seems dubious - shouldn't port be specified per ring?

On 01/16/2012 08:01 AM, Jan Friesse wrote:
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


_______________________________________________
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