File fix-nodeid-conflicting.patch of Package corosync

Index: corosync-1.4.5/conf/corosync.conf.example
===================================================================
--- corosync-1.4.5.orig/conf/corosync.conf.example
+++ corosync-1.4.5/conf/corosync.conf.example
@@ -41,7 +41,10 @@ totem {
 	max_messages:   20
 
 	# Limit generated nodeids to 31-bits (positive signed integers)
-	clear_node_high_bit: yes
+	# you would set it to 'yes', the new option 'new' means wiping 
+	# off the highest bit in network order to avoid possible nodeid
+	# conflicting.
+	clear_node_high_bit: new
 
 	# secauth: Enable mutual node authentication. If you choose to
 	# enable this ("on"), then do remember to create a shared
Index: corosync-1.4.5/exec/totemconfig.c
===================================================================
--- corosync-1.4.5.orig/exec/totemconfig.c
+++ corosync-1.4.5/exec/totemconfig.c
@@ -338,6 +338,9 @@ printf ("couldn't find totem handle\n");
 		if (strcmp (str, "yes") == 0) {
 			totem_config->clear_node_high_bit = 1;
 		}
+		if (strcmp (str, "new") == 0) {
+			totem_config->clear_node_high_bit = 2;
+		}
 	}
 
 	objdb_get_int (objdb,object_totem_handle, "threads", &totem_config->threads);
Index: corosync-1.4.5/exec/totemip.c
===================================================================
--- corosync-1.4.5.orig/exec/totemip.c
+++ corosync-1.4.5/exec/totemip.c
@@ -626,10 +626,20 @@ int totemip_iface_check(struct totem_ip_
 					 */
 					if (ipaddr.family == AF_INET && ipaddr.nodeid == 0) {
 						unsigned int nodeid = 0;
+						unsigned int new_nodeid = 0;
 						memcpy (&nodeid, ipaddr.addr, sizeof (int));
-						if (mask_high_bit) {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+						new_nodeid = swab32 (nodeid);
+#else
+						new_nodeid = nodeid;
+#endif
+						if (mask_high_bit == 1) {
 							nodeid &= 0x7FFFFFFF;
 						}
+						if (mask_high_bit == 2) {
+							new_nodeid &= 0x7FFFFFFF;
+							nodeid = new_nodeid;
+						}
 						ipaddr.nodeid = nodeid;
 					}
 					totemip_copy (boundto, &ipaddr);
Index: corosync-1.4.5/man/corosync.conf.5
===================================================================
--- corosync-1.4.5.orig/man/corosync.conf.5
+++ corosync-1.4.5/man/corosync.conf.5
@@ -175,7 +175,9 @@ This configuration option is optional an
 specified.  Some openais clients require a signed 32 bit nodeid that is greater
 than zero however by default openais uses all 32 bits of the IPv4 address space
 when generating a nodeid.  Set this option to yes to force the high bit to be
-zero and therefor ensure the nodeid is a positive signed 32 bit integer.
+zero and therefor ensure the nodeid is a positive signed 32 bit integer. Set
+this option to new to force the high bit in network order to be zero which 
+intends to avoid possible nodeid conflicting.
 
 WARNING: The clusters behavior is undefined if this option is enabled on only
 a subset of the cluster (for example during a rolling upgrade).
openSUSE Build Service is sponsored by