Просмотр исходного кода

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
Andrew Beekhof 17 лет назад
Родитель
Сommit
a3571b016b
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      exec/totemip.c

+ 1 - 1
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;
 					}