public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: RHEL5 - cman: Improve node name search
@ 2009-05-06  9:54 Christine Caulfield
  0 siblings, 0 replies; only message in thread
From: Christine Caulfield @ 2009-05-06  9:54 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=ee8d1b5915282b144ff5b74a0c2736b38c172274
Commit:        ee8d1b5915282b144ff5b74a0c2736b38c172274
Parent:        7b0e46f9074005a5c14a371876330d9ce71edf7a
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Wed May 6 10:52:02 2009 +0100
Committer:     Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Wed May 6 10:52:02 2009 +0100

cman: Improve node name search

If getnameinfo() fails then cman gives up the search of interfaces totally,
when it should really move on to the next one.

This helps with bz#488565 but it doesn't resolve it completely
as the cause seems to be ouside of cman's control.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
 cman/daemon/cmanccs.c |   59 ++++++++++++++++++++++++-------------------------
 1 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/cman/daemon/cmanccs.c b/cman/daemon/cmanccs.c
index b9fb898..d8995e1 100644
--- a/cman/daemon/cmanccs.c
+++ b/cman/daemon/cmanccs.c
@@ -335,44 +335,43 @@ static int verify_nodename(int cd, char *nodename)
 			continue;
 
 		error = getnameinfo(sa, sizeof(*sa), nodename2,
-				    sizeof(nodename2), NULL, 0, 0);
-		if (error)
-			goto out;
-
-		str = NULL;
-		memset(path, 0, 256);
-		sprintf(path, NODE_NAME_PATH_BYNAME, nodename2);
-
-		error = ccs_get(cd, path, &str);
+				    sizeof(nodename2), NULL, 0, NI_NAMEREQD);
 		if (!error) {
-			free(str);
-			strcpy(nodename, nodename2);
-			goto out;
-		}
 
-		/* truncate this name and try again */
+			str = NULL;
+			memset(path, 0, 256);
+			sprintf(path, NODE_NAME_PATH_BYNAME, nodename2);
 
-		dot = strstr(nodename2, ".");
-		if (!dot)
-			continue;
-		*dot = '\0';
+			error = ccs_get(cd, path, &str);
+			if (!error) {
+				free(str);
+				strcpy(nodename, nodename2);
+				goto out;
+			}
 
-		str = NULL;
-		memset(path, 0, 256);
-		sprintf(path, NODE_NAME_PATH_BYNAME, nodename2);
+			/* Truncate this name and try again */
+			dot = strstr(nodename2, ".");
+			if (dot) {
+				*dot = '\0';
 
-		error = ccs_get(cd, path, &str);
-		if (!error) {
-			free(str);
-			strcpy(nodename, nodename2);
-			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;
+				}
+			}
 		}
 
 		/* 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;
+			continue;
 
 		str = NULL;
 		memset(path, 0, 256);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-06  9:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-06  9:54 cluster: RHEL5 - cman: Improve node name search Christine Caulfield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).