Browse Source

totemip: Be more selective when matching bindnetaddr to IP addresses

For instance, the IPs are:
eth0: 10.150.10.81/8
eth1: 10.150.10.91/24

The bindnetaddr in corosync is: 10.150.10.0 and the addr of eth1 is
selected in UDPU mode. Then the bindto address mistakenly
choosees the addr of eth0.

This does not affect binding to a fully-specific IP address.

Signed-off-by: Lidong Zhong <lzhong@suse.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Christine Caulfield 10 years ago
parent
commit
8e90c68fc0
1 changed files with 1 additions and 1 deletions
  1. 1 1
      exec/totemip.c

+ 1 - 1
exec/totemip.c

@@ -626,7 +626,7 @@ int totemip_iface_check(struct totem_ip_address *bindnet,
 					memcpy(&network, RTA_DATA(tb[IFA_LOCAL]), sizeof(uint32_t));
 					memcpy(&network, RTA_DATA(tb[IFA_LOCAL]), sizeof(uint32_t));
 					memcpy(&addr, bindnet->addr, sizeof(uint32_t));
 					memcpy(&addr, bindnet->addr, sizeof(uint32_t));
 
 
-					if ((addr & netmask) == (network & netmask)) {
+					if ((addr) == (network & netmask)) {
 						memcpy(ipaddr.addr, RTA_DATA(tb[IFA_ADDRESS]), TOTEMIP_ADDRLEN);
 						memcpy(ipaddr.addr, RTA_DATA(tb[IFA_ADDRESS]), TOTEMIP_ADDRLEN);
 						found_if = 1;
 						found_if = 1;
 					}
 					}