diff options
author | ume <ume@FreeBSD.org> | 2005-02-04 14:43:05 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2005-02-04 14:43:05 +0000 |
commit | a0122cc509bc12762ea472b0577480fcf8f1088b (patch) | |
tree | ac67f445baf11e1bce1d11df93a25f938c0a8a2b /sys/netinet | |
parent | 9aed1e79d6e86bc774458a39bf00e29afac6541c (diff) | |
download | FreeBSD-src-a0122cc509bc12762ea472b0577480fcf8f1088b.zip FreeBSD-src-a0122cc509bc12762ea472b0577480fcf8f1088b.tar.gz |
teach scope of IPv6 address to net.inet6.tcp6.getcred.
MFC after: 1 week
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_subr.c | 14 | ||||
-rw-r--r-- | sys/netinet/tcp_timewait.c | 14 |
2 files changed, 20 insertions, 8 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 1f0cfe4..c8a4438 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1035,6 +1035,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) { struct xucred xuc; struct sockaddr_in6 addrs[2]; + struct in6_addr a6[2]; struct inpcb *inp; int error, s, mapped = 0; @@ -1049,6 +1050,13 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) mapped = 1; else return (EINVAL); + } else { + error = in6_embedscope(&a6[0], &addrs[0], NULL, NULL); + if (error) + return (EINVAL); + error = in6_embedscope(&a6[1], &addrs[1], NULL, NULL); + if (error) + return (EINVAL); } s = splnet(); INP_INFO_RLOCK(&tcbinfo); @@ -1060,10 +1068,8 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) addrs[0].sin6_port, 0, NULL); else - inp = in6_pcblookup_hash(&tcbinfo, &addrs[1].sin6_addr, - addrs[1].sin6_port, - &addrs[0].sin6_addr, addrs[0].sin6_port, - 0, NULL); + inp = in6_pcblookup_hash(&tcbinfo, &a6[1], addrs[1].sin6_port, + &a6[0], addrs[0].sin6_port, 0, NULL); if (inp == NULL) { error = ENOENT; goto outunlocked; diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 1f0cfe4..c8a4438 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -1035,6 +1035,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) { struct xucred xuc; struct sockaddr_in6 addrs[2]; + struct in6_addr a6[2]; struct inpcb *inp; int error, s, mapped = 0; @@ -1049,6 +1050,13 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) mapped = 1; else return (EINVAL); + } else { + error = in6_embedscope(&a6[0], &addrs[0], NULL, NULL); + if (error) + return (EINVAL); + error = in6_embedscope(&a6[1], &addrs[1], NULL, NULL); + if (error) + return (EINVAL); } s = splnet(); INP_INFO_RLOCK(&tcbinfo); @@ -1060,10 +1068,8 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) addrs[0].sin6_port, 0, NULL); else - inp = in6_pcblookup_hash(&tcbinfo, &addrs[1].sin6_addr, - addrs[1].sin6_port, - &addrs[0].sin6_addr, addrs[0].sin6_port, - 0, NULL); + inp = in6_pcblookup_hash(&tcbinfo, &a6[1], addrs[1].sin6_port, + &a6[0], addrs[0].sin6_port, 0, NULL); if (inp == NULL) { error = ENOENT; goto outunlocked; |