diff options
author | hrs <hrs@FreeBSD.org> | 2012-11-17 20:19:00 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2012-11-17 20:19:00 +0000 |
commit | 456b7a93418939408dbedc100658b7b995c87a8b (patch) | |
tree | 326b0fd08a208cf214b04ab6ac6f069d7ca658c2 /usr.sbin/rpcbind | |
parent | 9a8531105a4561079ee099a51460bb789ef9cfd1 (diff) | |
download | FreeBSD-src-456b7a93418939408dbedc100658b7b995c87a8b.zip FreeBSD-src-456b7a93418939408dbedc100658b7b995c87a8b.tar.gz |
Fill sin6_scope_id in sockaddr_in6 before passing it from the kernel to
userland via routing socket or sysctl. This eliminates the following
KAME-specific sin6_scope_id handling routine from each userland utility:
sin6.sin6_scope_id = ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);
This behavior can be controlled by net.inet6.ip6.deembed_scopeid. This is
set to 1 by default (sin6_scope_id will be filled in the kernel).
Reviewed by: bz
Diffstat (limited to 'usr.sbin/rpcbind')
-rw-r--r-- | usr.sbin/rpcbind/util.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/usr.sbin/rpcbind/util.c b/usr.sbin/rpcbind/util.c index 16e6f70..8ddb13e 100644 --- a/usr.sbin/rpcbind/util.c +++ b/usr.sbin/rpcbind/util.c @@ -57,9 +57,6 @@ static struct sockaddr_in6 *local_in6; #endif static int bitmaskcmp(void *, void *, void *, int); -#ifdef INET6 -static void in6_fillscopeid(struct sockaddr_in6 *); -#endif /* * For all bits set in "mask", compare the corresponding bits in @@ -79,26 +76,6 @@ bitmaskcmp(void *dst, void *src, void *mask, int bytelen) } /* - * Similar to code in ifconfig.c. Fill in the scope ID for link-local - * addresses returned by getifaddrs(). - */ -#ifdef INET6 -static void -in6_fillscopeid(struct sockaddr_in6 *sin6) -{ - u_int16_t ifindex; - - if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - ifindex = ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); - if (sin6->sin6_scope_id == 0 && ifindex != 0) { - sin6->sin6_scope_id = ifindex; - *(u_int16_t *)&sin6->sin6_addr.s6_addr[2] = 0; - } - } -} -#endif - -/* * Find a server address that can be used by `caller' to contact * the local service specified by `serv_uaddr'. If `clnt_uaddr' is * non-NULL, it is used instead of `caller' as a hint suggesting @@ -202,7 +179,6 @@ addrmerge(struct netbuf *caller, char *serv_uaddr, char *clnt_uaddr, * a link-local address then use the scope id to see * which one. */ - in6_fillscopeid(SA2SIN6(ifsa)); if (IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(ifsa)) && IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(caller_sa)) && IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(hint_sa))) { |