|
From: Lee D. <ld...@su...> - 2013-02-28 00:56:21
|
The target was returning two identical target address records in
response to a SendTargets=all request because it was failing to filter
out the second entry as a duplicate of the first. This was because one
version of the IPv6 address had the IPv6 Zone ID appended, and the
other one had it stripped off, so the comparison failed.
Fixed target_list_build_ifaddrs() to strip Zone ID off IPv6 addresses,
if present, as target_print_addr() already does, so that only one
TargetAddress is returned in response to an IPv6 SendTargets.
Signed-off-by: Lee Duncan <ld...@su...>
---
target.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/trunk/usr/target.c b/trunk/usr/target.c
--- a/trunk/usr/target.c (revision 489)
+++ b/trunk/usr/target.c (working copy)
@@ -92,7 +92,7 @@
int family)
{
struct ifaddrs *ifaddr, *ifa;
- char if_addr[NI_MAXHOST];
+ char if_addr[NI_MAXHOST], *ptr;
getifaddrs(&ifaddr);
@@ -110,6 +110,10 @@
NULL, 0, NI_NUMERICHOST))
continue;
+ /* strip ipv6 zone id */
+ ptr = if_addr;
+ (void) strsep(&ptr, "%");
+
if (strcmp(addr, if_addr) && !is_addr_loopback(if_addr)
&& cops->target_allow(tid, ifa->ifa_addr))
target_print_addr(conn, if_addr, family);
|