Hi,
Is it normal that getifaddrs() leaks the kernel's scope ID
representation of IPv6 link-local addresses?
In other words, is every user of getifaddrs() expected to fill the
sin6_scope_id member from the 3rd byte of the address, and then clear
that byte?
Looking at ifconfig.c, it's full of calls to this function:
void
in6_fillscopeid(struct sockaddr_in6 *sin6)
{
#ifdef __KAME__
if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
sin6->sin6_scope_id =
ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]);
sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0;
}
#endif /* __KAME__ */
}
Shouldn't this be done once in getifaddrs() itself instead of replicated
everywhere it's used?
Simon