Browse Source

totemip: Properly detect ipv6 address

Commit a853b618 introduced regression in finding IPv6 address. For IPv6,
IFA_ADDRESS must be checked, instead of IFA_LOCAL, because IFA_LOCAL is
returned empty.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Jan Friesse 13 years ago
parent
commit
d76759ec26
1 changed files with 7 additions and 0 deletions
  1. 7 0
      exec/totemip.c

+ 7 - 0
exec/totemip.c

@@ -598,6 +598,13 @@ int totemip_iface_check(struct totem_ip_address *bindnet,
 
 
 				parse_rtattr(tb, IFA_MAX, IFA_RTA(ifa), len);
 				parse_rtattr(tb, IFA_MAX, IFA_RTA(ifa), len);
 
 
+				if (ifa->ifa_family == AF_INET6 && tb[IFA_ADDRESS]) {
+					memcpy(ipaddr.addr, RTA_DATA(tb[IFA_ADDRESS]), TOTEMIP_ADDRLEN);
+					if (totemip_equal(&ipaddr, bindnet)) {
+						found_if = 1;
+						exact_match_found = 1;
+					}
+				}
 				if (tb[IFA_LOCAL]) {
 				if (tb[IFA_LOCAL]) {
 					memcpy(ipaddr.addr, RTA_DATA(tb[IFA_LOCAL]), TOTEMIP_ADDRLEN);
 					memcpy(ipaddr.addr, RTA_DATA(tb[IFA_LOCAL]), TOTEMIP_ADDRLEN);
 					if (totemip_equal(&ipaddr, bindnet)) {
 					if (totemip_equal(&ipaddr, bindnet)) {