Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet6/udp6_usrreq.c
Show First 20 Lines • Show All 628 Lines • ▼ Show 20 Lines | udplite6_ctlinput(int cmd, struct sockaddr *sa, void *d) | ||||
return (udp6_common_ctlinput(cmd, sa, d, &V_ulitecbinfo)); | return (udp6_common_ctlinput(cmd, sa, d, &V_ulitecbinfo)); | ||||
} | } | ||||
static int | static int | ||||
udp6_getcred(SYSCTL_HANDLER_ARGS) | udp6_getcred(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct xucred xuc; | struct xucred xuc; | ||||
struct sockaddr_in6 addrs[2]; | struct sockaddr_in6 addrs[2]; | ||||
struct epoch_tracker et; | |||||
struct inpcb *inp; | struct inpcb *inp; | ||||
int error; | int error; | ||||
error = priv_check(req->td, PRIV_NETINET_GETCRED); | error = priv_check(req->td, PRIV_NETINET_GETCRED); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
if (req->newlen != sizeof(addrs)) | if (req->newlen != sizeof(addrs)) | ||||
return (EINVAL); | return (EINVAL); | ||||
if (req->oldlen != sizeof(struct xucred)) | if (req->oldlen != sizeof(struct xucred)) | ||||
return (EINVAL); | return (EINVAL); | ||||
error = SYSCTL_IN(req, addrs, sizeof(addrs)); | error = SYSCTL_IN(req, addrs, sizeof(addrs)); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
if ((error = sa6_embedscope(&addrs[0], V_ip6_use_defzone)) != 0 || | if ((error = sa6_embedscope(&addrs[0], V_ip6_use_defzone)) != 0 || | ||||
(error = sa6_embedscope(&addrs[1], V_ip6_use_defzone)) != 0) { | (error = sa6_embedscope(&addrs[1], V_ip6_use_defzone)) != 0) { | ||||
return (error); | return (error); | ||||
} | } | ||||
NET_EPOCH_ENTER(et); | |||||
inp = in6_pcblookup(&V_udbinfo, &addrs[1].sin6_addr, | inp = in6_pcblookup(&V_udbinfo, &addrs[1].sin6_addr, | ||||
addrs[1].sin6_port, &addrs[0].sin6_addr, addrs[0].sin6_port, | addrs[1].sin6_port, &addrs[0].sin6_addr, addrs[0].sin6_port, | ||||
INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, NULL); | INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, NULL); | ||||
NET_EPOCH_EXIT(et); | |||||
if (inp != NULL) { | if (inp != NULL) { | ||||
INP_RLOCK_ASSERT(inp); | INP_RLOCK_ASSERT(inp); | ||||
if (inp->inp_socket == NULL) | if (inp->inp_socket == NULL) | ||||
error = ENOENT; | error = ENOENT; | ||||
if (error == 0) | if (error == 0) | ||||
error = cr_canseesocket(req->td->td_ucred, | error = cr_canseesocket(req->td->td_ucred, | ||||
inp->inp_socket); | inp->inp_socket); | ||||
if (error == 0) | if (error == 0) | ||||
▲ Show 20 Lines • Show All 749 Lines • Show Last 20 Lines |