Parcourir la source

Correctly handle point-to-point IP

Main difference between IFA_LOCAL and IFA_ADDRESS:

IFA_ADDRESS is prefix address, rather than local interface address.
It makes no difference for normally configured broadcast interfaces,
but for point-to-point IFA_ADDRESS is DESTINATION address,
local address is supplied in IFA_LOCAL attribute.

We are now using IFA_LOCAL insted of IFA_ADDRESS to correctly find out
local address.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Jan Friesse il y a 13 ans
Parent
commit
a853b6180e
1 fichiers modifiés avec 5 ajouts et 3 suppressions
  1. 5 3
      exec/totemip.c

+ 5 - 3
exec/totemip.c

@@ -596,9 +596,11 @@ int totemip_iface_check(struct totem_ip_address *bindnet,
 
 				parse_rtattr(tb, IFA_MAX, IFA_RTA(ifa), len);
 
-				memcpy(ipaddr.addr, RTA_DATA(tb[IFA_ADDRESS]), TOTEMIP_ADDRLEN);
-				if (totemip_equal(&ipaddr, bindnet)) {
-					found_if = 1;
+				if (tb[IFA_LOCAL]) {
+					memcpy(ipaddr.addr, RTA_DATA(tb[IFA_LOCAL]), TOTEMIP_ADDRLEN);
+					if (totemip_equal(&ipaddr, bindnet)) {
+						found_if = 1;
+					}
 				}
 
 				/* If the address we have is an IPv4 network address, then