Просмотр исходного кода

Fix message rejection problem.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1743 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 17 лет назад
Родитель
Сommit
63fa74305b
3 измененных файлов с 17 добавлено и 13 удалено
  1. 14 1
      exec/totemip.c
  2. 2 11
      exec/totemnet.c
  3. 1 1
      include/corosync/totem/totemip.h

+ 14 - 1
exec/totemip.c

@@ -376,7 +376,8 @@ static void parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int l
 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 {
@@ -514,6 +515,18 @@ int totemip_iface_check(struct totem_ip_address *bindnet,
 		}
 	}
 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;

+ 2 - 11
exec/totemnet.c

@@ -699,18 +699,9 @@ static int netif_determine (
 	int res;
 
 	res = totemip_iface_check (bindnet, bound_to,
-		interface_up, interface_num);
+		interface_up, interface_num,
++               0); // TODO andrew can address this 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) {
-		memcpy (&bound_to->nodeid, bound_to->addr, sizeof (int));
-	}
 
 	return (res);
 }

+ 1 - 1
include/corosync/totem/totemip.h

@@ -72,7 +72,7 @@ extern int totemip_sockaddr_to_totemip_convert(struct sockaddr_storage *saddr, s
 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)