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

[Linux-cluster] member_list_to_id looks fishy



patch attached (untested) to possibly fix
Index: ccs_tool/update.c
===================================================================
RCS file: /cvs/cluster/cluster/ccs/ccs_tool/update.c,v
retrieving revision 1.6
diff -u -r1.6 update.c
--- ccs_tool/update.c	20 Apr 2006 18:46:54 -0000	1.6
+++ ccs_tool/update.c	20 Apr 2006 20:28:55 -0000
@@ -34,7 +34,7 @@
 static void free_member_list(member_list_t *list);
 static char *member_id_to_name(member_list_t *list, int node);
 static int member_name_to_id(member_list_t *list, char *name);
-static int member_addr_to_id(member_list_t *list, struct sockaddr addr);
+static int member_addr_to_id(member_list_t *list, struct sockaddr *addr);
 static int member_online_node(member_list_t *list, int node);
 static int member_online_name(member_list_t *list, char *name);
 
@@ -460,14 +460,15 @@
 }
 
 
-static int member_addr_to_id(member_list_t *list, struct sockaddr addr)
+static int member_addr_to_id(member_list_t *list, struct sockaddr *addr)
 {
   int i;
 
   for (i = 0; i < list->count; i++) {
-	  if (memcmp(list->nodes[i].cn_address.cna_address,
-		     (struct sockaddr_in *)&addr, sizeof(addr))) {
-		  return list->nodes[i].cn_nodeid;
+	  if (memcmp(&list->nodes[i].cn_address.cna_address, addr,
+		sizeof(struct sockaddr))) {
+
+		return list->nodes[i].cn_nodeid;
 	  }
   }
 
Index: daemon/cluster_mgr.c
===================================================================
RCS file: /cvs/cluster/cluster/ccs/daemon/cluster_mgr.c,v
retrieving revision 1.19
diff -u -r1.19 cluster_mgr.c
--- daemon/cluster_mgr.c	20 Apr 2006 18:46:54 -0000	1.19
+++ daemon/cluster_mgr.c	20 Apr 2006 20:28:55 -0000
@@ -45,7 +45,7 @@
 static void free_member_list(member_list_t *list);
 static char *member_id_to_name(member_list_t *list, int node);
 static int member_name_to_id(member_list_t *list, char *name);
-static int member_addr_to_id(member_list_t *list, struct sockaddr addr);
+static int member_addr_to_id(member_list_t *list, struct sockaddr *addr);
 static int member_online_node(member_list_t *list, int node);
 static int member_online_name(member_list_t *list, char *name);
 
@@ -134,7 +134,7 @@
     goto fail;
   }
 
-  if ((nodeid = member_addr_to_id(members, client_addr)) < 0) {
+  if ((nodeid = member_addr_to_id(members, &client_addr)) < 0) {
     log_err("Unable to determine node ID.\n");
     goto fail;
   }
@@ -595,14 +595,15 @@
 }
 
 
-static int member_addr_to_id(member_list_t *list, struct sockaddr addr)
+static int member_addr_to_id(member_list_t *list, struct sockaddr *addr)
 {
   int i;
 
   for (i = 0; i < list->count; i++) {
-	  if (memcmp(list->nodes[i].cn_address.cna_address,
-		     (struct sockaddr_in *)&addr, sizeof(addr))) {
-		  return list->nodes[i].cn_nodeid;
+	  if (memcmp(&list->nodes[i].cn_address.cna_address, addr,
+		sizeof(struct sockaddr))) {
+
+		return list->nodes[i].cn_nodeid;
 	  }
   }
 

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