1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-01 12:29:03 +00:00

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.
This commit is contained in:
kris
2008-05-20 05:21:29 +00:00
parent ce3ce4f541
commit 7d38c4dc6e
3 changed files with 12 additions and 3 deletions

View File

@@ -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