[Cluster-devel] cluster/cman/daemon ais.c cmanccs.c

pcaulfield at sourceware.org pcaulfield at sourceware.org
Mon Oct 2 08:50:04 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	pcaulfield at sourceware.org	2006-10-02 08:50:02

Modified files:
	cman/daemon    : ais.c cmanccs.c 

Log message:
	Don't even start up if the local host name resolves to 127.0.0.1

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/ais.c.diff?cvsroot=cluster&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cmanccs.c.diff?cvsroot=cluster&r1=1.20&r2=1.21

--- cluster/cman/daemon/ais.c	2006/09/25 11:38:53	1.40
+++ cluster/cman/daemon/ais.c	2006/10/02 08:50:02	1.41
@@ -285,6 +285,7 @@
 
 int ais_add_ifaddr(char *mcast, char *ifaddr, int portnum)
 {
+	struct totem_ip_address localhost;
 	unsigned int totem_object_handle;
 	unsigned int interface_object_handle;
 	char tmp[132];
@@ -321,10 +322,19 @@
 			if (!ret)
 				ret = totemip_parse(&ifaddrs[num_interfaces], ifaddr,
 						    mcast_addr[num_interfaces].family);
-			if (!ret)
-				num_interfaces++;
-			else
+			if (ret) {
+				errno = EPROTOTYPE;
 				return ret;
+			}
+
+			/* Check it's not bound to localhost, sigh */
+			totemip_localhost(mcast_addr[num_interfaces].family, &localhost);
+			if (totemip_equal(&localhost, &ifaddrs[num_interfaces])) {
+				errno = EADDRINUSE;
+				return -1;
+			}
+
+			num_interfaces++;
 		}
 	}
 
--- cluster/cman/daemon/cmanccs.c	2006/08/15 10:27:13	1.20
+++ cluster/cman/daemon/cmanccs.c	2006/10/02 08:50:02	1.21
@@ -228,7 +228,10 @@
 	for (i = 0; i<num_nodenames; i++) {
 		error = ais_add_ifaddr(mcast[i], nodenames[i], portnums[i]);
 		if (error) {
-			write_cman_pipe("Multicast and node address families differ.");
+			if (errno == EADDRINUSE)
+				write_cman_pipe("Local host name resolves to 127.0.0.1; fix /etc/hosts before starting cluster.");
+			else
+				write_cman_pipe("Multicast and node address families differ.");
 			return error;
 		}
 	}




More information about the Cluster-devel mailing list