public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE2 - cman: Don't give up on the node config if getnameinfo fails
@ 2009-03-05 14:51 Christine Caulfield
  0 siblings, 0 replies; only message in thread
From: Christine Caulfield @ 2009-03-05 14:51 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4cef00a9ce2345804aa745d92f36294b94793edd
Commit:        4cef00a9ce2345804aa745d92f36294b94793edd
Parent:        92f5bc5d34de47e2fdc45f847725578e3af399f9
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Thu Mar 5 14:50:06 2009 +0000
Committer:     Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Thu Mar 5 14:50:06 2009 +0000

cman: Don't give up on the node config if getnameinfo fails

If getnameinfo fails to resolve the IP address of an interface then
cman will give up on configration totally rather
than skipping to the next interface. It also gives up if
getnameinfo returns a fully-qualified name and the name in objdb
is a simple name.

This fixes those issues by changing "goto out" into "continue" and
some re-blocking.

In actuality getaddrinfo very rarely seems to fail, so this is not a big
problem, if it cannot resolve an address it returns the IP number as the
string instead of the node name. However I have no doubt that it CAN fail
and will do at inopportune moments. It could be responsible for bz#488565
which, although reported against RHEL5, can affect almost all subsequent
releases.

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

diff --git a/cman/daemon/cmanccs.c b/cman/daemon/cmanccs.c
index 0819b12..1def234 100644
--- a/cman/daemon/cmanccs.c
+++ b/cman/daemon/cmanccs.c
@@ -361,49 +361,49 @@ static int verify_nodename(int cd, char *nodename)
 
 		error = getnameinfo(sa, sizeof(*sa), nodename2,
 				    sizeof(nodename2), NULL, 0, 0);
-		if (error)
-			goto out;
-
-		str = NULL;
-		ret = snprintf(path, sizeof(path), NODE_NAME_PATH_BYNAME, nodename2);
-		if (ret < 0 || (size_t) ret >= sizeof(path)) {
-			error = -E2BIG;
-			goto out;
-		}
-
-		error = ccs_get(cd, path, &str);
 		if (!error) {
-			free(str);
-			strcpy(nodename, nodename2);
-			goto out;
-		}
 
-		/* truncate this name and try again */
-
-		dot = strchr(nodename2, '.');
-		if (!dot)
-			continue;
-		*dot = '\0';
+			str = NULL;
+			ret = snprintf(path, sizeof(path), NODE_NAME_PATH_BYNAME, nodename2);
+			if (ret < 0 || (size_t) ret >= sizeof(path)) {
+				error = -E2BIG;
+				goto out;
+			}
 
-		str = NULL;
-		ret = snprintf(path, sizeof(path), NODE_NAME_PATH_BYNAME, nodename2);
-		if (ret < 0 || (size_t) ret >= sizeof(path)) {
-			error = -E2BIG;
-			goto out;
-		}
+			error = ccs_get(cd, path, &str);
+			if (!error) {
+				free(str);
+				strcpy(nodename, nodename2);
+				goto out;
+			}
 
-		error = ccs_get(cd, path, &str);
-		if (!error) {
-			free(str);
-			strcpy(nodename, nodename2);
-			goto out;
+			/* Truncate this name and try again */
+			dot = strchr(nodename2, '.');
+			if (dot) {
+
+				*dot = '\0';
+
+				str = NULL;
+				ret = snprintf(path, sizeof(path), NODE_NAME_PATH_BYNAME, nodename2);
+				if (ret < 0 || (size_t) ret >= sizeof(path)) {
+					error = -E2BIG;
+					goto out;
+				}
+
+				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;
 		ret = snprintf(path, sizeof(path), NODE_NAME_PATH_BYNAME, nodename2);


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

only message in thread, other threads:[~2009-03-05 14:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-05 14:51 cluster: STABLE2 - cman: Don't give up on the node config if getnameinfo fails 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).