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

Christine Caulfield chrissie@fedoraproject.org
Thu Mar 5 11:05:00 GMT 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=008a640d28abb403a03a46ba0d438e1465d9d115
Commit:        008a640d28abb403a03a46ba0d438e1465d9d115
Parent:        8d17295f8edbc0dcd284f3b0537a646709f758cd
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Thu Mar 5 10:47:41 2009 +0000
Committer:     Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Thu Mar 5 11:05:00 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/cman-preconfig.c |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index c7a9837..1dbaab0 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -408,31 +408,30 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
 
 		error = getnameinfo(sa, sizeof(*sa), nodename2,
 				    sizeof(nodename2), NULL, 0, 0);
-		if (error)
-			goto out;
+		if (!error) {
 
-		if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
-			strcpy(nodename, nodename2);
-			goto out;
-		}
+			if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
+				strcpy(nodename, nodename2);
+				goto out;
+			}
 
-		/* truncate this name and try again */
+			/* Truncate this name and try again */
+			dot = strchr(nodename2, '.');
+			if (dot) {
+				*dot = '\0';
 
-		dot = strchr(nodename2, '.');
-		if (!dot)
-			continue;
-		*dot = '\0';
-
-		if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
-			strcpy(nodename, nodename2);
-			goto out;
+				if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
+					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;
 
 		if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
 			strcpy(nodename, nodename2);



More information about the Cluster-cvs mailing list