[Openais] [Corosync/Whitetank Patch] Repair nodeid generation

Andrew Beekhof beekhof at gmail.com
Fri Nov 14 00:55:52 PST 2008


Commit r1655 brought forward nodeid generation and erroneously started  
using bindnet.addr instead of bound_to.addr
Since then, if the admin used an address ending in one or more .0's  
for bindnetaddr, this would result in _all_ nodes having the same  
nodeid.

This patch moves the clear_node_high_bit processing to the location  
where nodeid was originally populated (netif_determine) and goes back  
to using the bound_to address (which was not yet populated during  
totemnet_initialize()) which is suitable for generating nodeids.

Andrew

--- a/exec/totemnet.c	Thu Nov 13 21:24:18 2008 +0100
+++ b/exec/totemnet.c	Fri Nov 14 09:45:55 2008 +0100
@@ -702,7 +702,12 @@ static int netif_determine (
  	 * field is only 32 bits.
  	 */
  	if (bound_to->family == AF_INET && bound_to->nodeid == 0) {
-		memcpy (&bound_to->nodeid, bound_to->addr, sizeof (int));
+		int32_t nodeid = 0;
+		memcpy (&nodeid, bound_to->addr, sizeof (int));
+		if(nodeid < 0 && instance->totem_config->clear_node_high_bit) {
+			nodeid = 0 - nodeid;
+		}
+		bound_to->nodeid = nodeid;
  	}

  	return (res);
@@ -1227,15 +1232,6 @@ int totemnet_initialize (

  	instance->totemnet_poll_handle = poll_handle;

-	if(instance->totem_config->node_id == 0) {	
-		int32_t nodeid = 0;
-		memcpy (&nodeid, instance->totem_interface->bindnet.addr, sizeof  
(int32_t));
-		if(nodeid < 0 && instance->totem_config->clear_node_high_bit) {
-			nodeid = 0 - nodeid;
-		}
-		instance->totem_config->node_id = nodeid;
-	}
-
  	instance->totem_interface->bindnet.nodeid = instance->totem_config- 
 >node_id;

  	instance->context = context;



More information about the Openais mailing list