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

[Cluster-devel] cluster/cman/daemon cmanccs.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	pcaulfield sourceware org	2007-05-23 10:31:00

Modified files:
	cman/daemon    : cmanccs.c 

Log message:
	Move fix for bz #232068 (IP addresses in cluster.conf) to RHEL5 branch

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cmanccs.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.3&r2=1.21.2.4

--- cluster/cman/daemon/cmanccs.c	2007/05/18 12:46:30	1.21.2.3
+++ cluster/cman/daemon/cmanccs.c	2007/05/23 10:31:00	1.21.2.4
@@ -246,7 +246,6 @@
 	return 0;
 }
 
-
 static int verify_nodename(int cd, char *nodename)
 {
 	char path[MAX_PATH_LEN];
@@ -316,14 +315,17 @@
 		free(str);
 	}
 
-
 	/* The cluster.conf names may not be related to uname at all,
-	   they may match a hostname on some network interface */
+	   they may match a hostname on some network interface.
+	   NOTE: This is IPv4 only */
 	error = getifaddrs(&ifa_list);
 	if (error)
 		return -1;
 
 	for (ifa = ifa_list; ifa; ifa = ifa->ifa_next) {
+
+		/* Restore this */
+		strcpy(nodename2, nodename);
 		sa = ifa->ifa_addr;
 		if (!sa || sa->sa_family != AF_INET)
 			continue;
@@ -361,6 +363,23 @@
 			strcpy(nodename, nodename2);
 			goto out;
 		}
+
+		/* See if it's the IP address that's in cluster.conf */
+		error = getnameinfo(sa, sizeof(*sa), nodename2,
+				    sizeof(nodename2), NULL, 0, NI_NUMERICHOST);
+		if (error)
+			goto out;
+
+		str = NULL;
+		memset(path, 0, 256);
+		sprintf(path, NODE_NAME_PATH_BYNAME, nodename2);
+
+		error = ccs_get(cd, path, &str);
+		if (!error) {
+			free(str);
+			strcpy(nodename, nodename2);
+			goto out;
+		}
 	}
 
 	error = -1;


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