This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
cluster: STABLE2 - cman: Don't give up on the node config ifgetnameinfo fails
- From: Christine Caulfield <chrissie at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Thu, 5 Mar 2009 14:50:41 +0000 (UTC)
- Subject: cluster: STABLE2 - cman: Don't give up on the node config ifgetnameinfo fails
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);