MCPcopy Create free account
hub / github.com/F-Stack/f-stack / in6_fillscopeid

Function in6_fillscopeid

tools/netstat/route.c:620–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618
619#ifdef INET6
620void
621in6_fillscopeid(struct sockaddr_in6 *sa6)
622{
623#if defined(__KAME__)
624 /*
625 * XXX: This is a special workaround for KAME kernels.
626 * sin6_scope_id field of SA should be set in the future.
627 */
628 if (IN6_IS_ADDR_LINKLOCAL(&sa6->sin6_addr) ||
629 IN6_IS_ADDR_MC_NODELOCAL(&sa6->sin6_addr) ||
630 IN6_IS_ADDR_MC_LINKLOCAL(&sa6->sin6_addr)) {
631 if (sa6->sin6_scope_id == 0)
632 sa6->sin6_scope_id =
633 ntohs(*(u_int16_t *)&sa6->sin6_addr.s6_addr[2]);
634 sa6->sin6_addr.s6_addr[2] = sa6->sin6_addr.s6_addr[3] = 0;
635 }
636#endif
637}
638
639/* Mask to length table. To check an invalid value, (length + 1) is used. */
640static const u_char masktolen[256] = {

Callers 2

fmt_sockaddrFunction · 0.85
inet6.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected