From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20422 invoked by alias); 4 Jun 2009 16:07:06 -0000 Received: (qmail 20387 invoked by alias); 4 Jun 2009 16:07:05 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: STABLE2 - fence: Allow IP addresses as node names To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE2 X-Git-Reftype: branch X-Git-Oldrev: 88a4dbb59e5643e5dedcb223511cd2f91aeccce2 X-Git-Newrev: 245519e8cac03d10ccc3f09eff6fb7077c24a09f From: Christine Caulfield Message-Id: <20090604160645.82CA9120312@lists.fedorahosted.org> Date: Thu, 04 Jun 2009 16:07:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q2/txt/msg00466.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=245519e8cac03d10ccc3f09eff6fb7077c24a09f Commit: 245519e8cac03d10ccc3f09eff6fb7077c24a09f Parent: 88a4dbb59e5643e5dedcb223511cd2f91aeccce2 Author: Christine Caulfield AuthorDate: Thu Jun 4 16:55:39 2009 +0100 Committer: Christine Caulfield CommitterDate: Thu Jun 4 17:06:21 2009 +0100 fence: Allow IP addresses as node names When checking if a node is a member of the cluster, fenced does a full-string check of the name. If that doesn't match it then assumes that one of the names is a FQDN and one is truncated so it starts checking the bit before the first dot. If the node names are IP addresses then this will match all of the time for most clusters. eg: 192.168.2.1 will match 192.168.2.2 because it just matches the 192. This makes fenced think that the node has rejoined the cluster because it sees the name in the list of active nodes, and won't fence it. This patch abandons the match check afer the full-string one if the node name is found to be an IP address. bz#504158 Signed-off-by: Christine Caulfield --- fence/fenced/member_cman.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/fence/fenced/member_cman.c b/fence/fenced/member_cman.c index 37e3e8a..1231925 100644 --- a/fence/fenced/member_cman.c +++ b/fence/fenced/member_cman.c @@ -1,4 +1,5 @@ #include +#include #include "fd.h" #define BUFLEN 128 @@ -18,6 +19,7 @@ int our_nodeid; static int name_equal(char *name1, char *name2) { char name3[BUFLEN], name4[BUFLEN]; + char addr1[INET6_ADDRSTRLEN]; int i, len1, len2; len1 = strlen(name1); @@ -26,6 +28,16 @@ static int name_equal(char *name1, char *name2) if (len1 == len2 && !strncmp(name1, name2, len1)) return TRUE; + /* + * If the names are IP addresses then don't compare + * what is in front of the dots. + */ + if (inet_pton(AF_INET, name1, addr1) == 0) + return FALSE; + + if (inet_pton(AF_INET6, name1, addr1) == 0) + return FALSE; + memset(name3, 0, BUFLEN); memset(name4, 0, BUFLEN);