From 7d38c4dc6efce0181cf8000ed2f2b7f6f6d84db4 Mon Sep 17 00:00:00 2001 From: kris Date: Tue, 20 May 2008 05:21:29 +0000 Subject: [PATCH] o Nmap now understands the RFC 4007 percent syntax for IPv6 Zone IDs. On Windows, this ID has to be a numeric index. On Linux and some other OS's, this ID can instead be an interface name. Some examples of this syntax: fe80::20f:b0ff:fec6:15af%2 fe80::20f:b0ff:fec6:15af%eth0 This was a lot simpler than the method I previously implemented and posted to nmap-dev. Now I just extract the zone ID from the already available getaddrinfo() data rather than parsing it out myself. --- CHANGELOG | 8 ++++++++ TargetGroup.cc | 5 +++-- TargetGroup.h | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ad3b129a9..821f15911 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -31,6 +31,14 @@ o We now compile in IPv6 support on Windows. In order to use this, but must be downloaded from MS for XP. See http://www.microsoft.com/technet/network/ipv6/ipv6faq.mspx . [Kris] +o Nmap now understands the RFC 4007 percent syntax for IPv6 Zone IDs. + On Windows, this ID has to be a numeric index. On Linux and some + other OS's, this ID can instead be an interface name. Some examples + of this syntax: + fe80::20f:b0ff:fec6:15af%2 + fe80::20f:b0ff:fec6:15af%eth0 + [Kris] + o The Zenmap installer and uninstaller are more careful about escaping filenames and dealing with an installation root (DESTDIR). [David] diff --git a/TargetGroup.cc b/TargetGroup.cc index 2a4490254..81d5e9a6e 100644 --- a/TargetGroup.cc +++ b/TargetGroup.cc @@ -296,7 +296,7 @@ int TargetGroup::parse_expr(const char * const target_expr, int af) { } assert(result->ai_addrlen == sizeof(struct sockaddr_in6)); struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) result->ai_addr; - memcpy(ip6.s6_addr, sin6->sin6_addr.s6_addr, 16); + memcpy(&ip6, sin6, sizeof(struct sockaddr_in6)); ipsleft = 1; freeaddrinfo(result); #else // HAVE_IPV6 @@ -443,7 +443,8 @@ int TargetGroup::get_next_host(struct sockaddr_storage *ss, size_t *sslen) { #ifdef SIN_LEN sin6->sin6_len = *sslen; #endif /* SIN_LEN */ - memcpy(sin6->sin6_addr.s6_addr, ip6.s6_addr, 16); + memcpy(sin6->sin6_addr.s6_addr, ip6.sin6_addr.s6_addr, 16); + sin6->sin6_scope_id = ip6.sin6_scope_id; #else fatal("IPV6 not supported on this platform"); #endif // HAVE_IPV6 diff --git a/TargetGroup.h b/TargetGroup.h index 262d97c27..06279c533 100644 --- a/TargetGroup.h +++ b/TargetGroup.h @@ -143,7 +143,7 @@ class TargetGroup { void Initialize(); #if HAVE_IPV6 - struct in6_addr ip6; + struct sockaddr_in6 ip6; #endif /* These 4 are used for the '/mask' style of specifying target