For some series of patches that has gone in, the node id is not being
generated or stored in the boundto address properly.  This may have
always been a bug or a bug resulting in recent changes.  I'm not certain
either way.

The symptoms of the problem are that "message_source_is_local" will
return the wrong value for some messages during race conditions of the
netif_determine function running and updating the nodeid at the same
time as totempg_nodeid_get retrieving the information.  Sometime during
this operation, the node id is set to zero, but later is compared
against a proper node value, rejecting messages in many services such as
ckpt, synchronization, and other badness.

The attached patch fixes the problem.

Regards
-steve

Index: exec/totemnet.c
===================================================================
--- exec/totemnet.c	(revision 1676)
+++ exec/totemnet.c	(working copy)
@@ -692,24 +692,9 @@
 	int res;
 
 	res = totemip_iface_check (bindnet, bound_to,
-		interface_up, interface_num);
+		interface_up, interface_num,
+		instance->totem_config->clear_node_high_bit);
 
-	/*
-	 * If the desired binding is to an IPV4 network and nodeid isn't
-	 * specified, retrieve the node id from this_ip network address
-	 *
-	 * IPV6 networks must have a node ID specified since the node id
-	 * field is only 32 bits.
-	 */
-	if (bound_to->family == AF_INET && bound_to->nodeid == 0) {
-		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);
 }
 	
Index: exec/totemip.c
===================================================================
--- exec/totemip.c	(revision 1676)
+++ exec/totemip.c	(working copy)
@@ -420,7 +420,8 @@
 int totemip_iface_check(struct totem_ip_address *bindnet,
 			struct totem_ip_address *boundto,
 			int *interface_up,
-			int *interface_num)
+			int *interface_num,
+			int mask_high_bit)
 {
 	int fd;
 	struct {
@@ -558,6 +559,18 @@
 		}
 	}
 finished:
+	/*
+	 * Mask 32nd bit off to workaround bugs in other poeples code
+	 * if configuration requests it.
+	 */
+	if (ipaddr.family == AF_INET && ipaddr.nodeid == 0) {
+                unsigned int nodeid = 0;
+                memcpy (&nodeid, ipaddr.addr, sizeof (int));
+		if ((nodeid & 0x7FFFFFFF) && mask_high_bit) {
+                        nodeid &= 0x7FFFFFFF;
+		}
+                ipaddr.nodeid = nodeid;
+        }
 	totemip_copy (boundto, &ipaddr);
 	close(fd);
 	return 0;
Index: exec/totemip.h
===================================================================
--- exec/totemip.h	(revision 1676)
+++ exec/totemip.h	(working copy)
@@ -71,7 +71,7 @@
 extern int totemip_totemip_to_sockaddr_convert(struct totem_ip_address *ip_addr,
 					       uint16_t port, struct sockaddr_storage *saddr, int *addrlen);
 extern int totemip_parse(struct totem_ip_address *totemip, char *addr, int family);
-extern int totemip_iface_check(struct totem_ip_address *bindnet, struct totem_ip_address *boundto, int *interface_up, int *interface_num);
+extern int totemip_iface_check(struct totem_ip_address *bindnet, struct totem_ip_address *boundto, int *interface_up, int *interface_num, int mask_high_bit);
 
 /* These two simulate a zero in_addr by clearing the family field */
 static inline void totemip_zero_set(struct totem_ip_address *addr)
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to