From a3571b016b61d67bd7f30f56444903d8b6b53b50 Mon Sep 17 00:00:00 2001 From: Andrew Beekhof Date: Tue, 2 Dec 2008 14:50:51 +0000 Subject: [PATCH] Correctly compare local addresses with bindnetaddr 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. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1702 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/totemip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec/totemip.c b/exec/totemip.c index 289f8882..02841072 100644 --- a/exec/totemip.c +++ b/exec/totemip.c @@ -472,7 +472,7 @@ int totemip_iface_check(struct totem_ip_address *bindnet, 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; }