diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-06-04 02:24:38 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-06-04 02:24:38 -0400 |
commit | bdad2fefb206d9727d4a3254f7883b8455452d89 (patch) | |
tree | f700c40bc61308cf7ac1a66d63f5bb16e1aca6eb /src/network/getaddrinfo.c | |
parent | 8041af59881219c32267c3491bee43591d3c3fe6 (diff) | |
download | musl-bdad2fefb206d9727d4a3254f7883b8455452d89.tar.gz musl-bdad2fefb206d9727d4a3254f7883b8455452d89.tar.xz musl-bdad2fefb206d9727d4a3254f7883b8455452d89.zip |
add support for ipv6 scope_id to getaddrinfo and getnameinfo
for all address types, a scope_id specified as a decimal value is accepted. for addresses with link-local scope, a string containing the interface name is also accepted. some changes are made to error handling to avoid unwanted fallbacks in the case where the scope_id is invalid: if an earlier name lookup backend fails with an error rather than simply "0 results", this failure now suppresses any later attempts with other backends. in getnameinfo, a light "itoa" type function is added for generating decimal scope_id results, and decimal port strings for services are also generated using this function now so as not to pull in the dependency on snprintf. in netdb.h, a definition for the NI_NUMERICSCOPE flag is added. this is required by POSIX (it was previously missing) and needed to allow callers to suppress interface-name lookups.
Diffstat (limited to 'src/network/getaddrinfo.c')
-rw-r--r-- | src/network/getaddrinfo.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c index 70b6cfda..d9913445 100644 --- a/src/network/getaddrinfo.c +++ b/src/network/getaddrinfo.c @@ -105,6 +105,7 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru case AF_INET6: out[k].sa.sin6.sin6_family = AF_INET6; out[k].sa.sin6.sin6_port = htons(ports[j].port); + out[k].sa.sin6.sin6_scope_id = addrs[i].scopeid; memcpy(&out[k].sa.sin6.sin6_addr, &addrs[i].addr, 16); break; } |