cluster/cman/daemon cmanccs.c
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: pcaulfield at sourceware.org 2007-05-23 10:31:00
Modified files:
cman/daemon : cmanccs.c
Log message:
Move fix for bz #232068 (IP addresses in cluster.conf) to RHEL5 branch
cman/daemon/cmanccs.c +22 -3
@@ -246,7 +246,6 @@return 0 ; } -static int verify_nodename (int cd,char *nodename) {char path[MAX_PATH_LEN ];
@@ -316,14 +315,17 @@free (str); } -/* The cluster.conf names may not be related to uname at all, -they may match a hostname on some network interface */ +they may match a hostname on some network interface. +NOTE: This is IPv4 only */ error =getifaddrs (&ifa_list);if (error)return -1 ;for (ifa = ifa_list; ifa; ifa = ifa->ifa_next) { + +/* Restore this */ +strcpy (nodename2, nodename); sa = ifa->ifa_addr;if (!sa || sa->sa_family !=AF_INET )continue ;
@@ -361,6 +363,23 @@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; + + 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; + } } error =-1 ;