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
This commit is contained in:
Andrew Beekhof 2008-12-02 14:50:51 +00:00
parent f2f20533fd
commit a3571b016b

View File

@ -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;
}