[Openais] [Corosync/Whitetank Patch] Improve handling of bindnetaddr

Andrew Beekhof beekhof at gmail.com
Thu Nov 13 11:42:34 PST 2008


This patch allows whitetank/corosync to behave correctly when the  
supplied value of bindnetaddr has more precision than the netmask, but  
is not a full IPv4 address.

For example, currently, if the netmask is /16 but the user specifies  
192.168.1.0, then OpenAIS is unable to determine the correct address  
and uses the loopback address instead.

The following patch allows OpenAIS to correctly determine which  
interface/address to use.

--- a/exec/totemip.c	Tue Nov 11 10:48:41 2008 +0100
+++ b/exec/totemip.c	Thu Nov 13 20:36:58 2008 +0100
@@ -516,7 +516,7 @@ int totemip_iface_check(struct totem_ip_
  					memcpy(&network, RTA_DATA(tb[IFA_BROADCAST]), sizeof(uint32_t));
  					memcpy(&addr, bindnet->addr, sizeof(uint32_t));

-					if (addr == (network & netmask)) {
+					if ((addr & netmask) == (network & netmask)) {
  						memcpy(ipaddr.addr, RTA_DATA(tb[IFA_ADDRESS]), TOTEMIP_ADDRLEN);
  						found_if = 1;
  					}



More information about the Openais mailing list