Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/udp_usrreq.c
Show First 20 Lines • Show All 957 Lines • ▼ Show 20 Lines | SYSCTL_PROC(_net_inet_udp, UDPCTL_PCBLIST, pcblist, | ||||
udp_pcblist, "S,xinpcb", "List of active UDP sockets"); | udp_pcblist, "S,xinpcb", "List of active UDP sockets"); | ||||
#ifdef INET | #ifdef INET | ||||
static int | static int | ||||
udp_getcred(SYSCTL_HANDLER_ARGS) | udp_getcred(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct xucred xuc; | struct xucred xuc; | ||||
struct sockaddr_in addrs[2]; | struct sockaddr_in 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); | ||||
error = SYSCTL_IN(req, addrs, sizeof(addrs)); | error = SYSCTL_IN(req, addrs, sizeof(addrs)); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
NET_EPOCH_ENTER(et); | |||||
inp = in_pcblookup(&V_udbinfo, addrs[1].sin_addr, addrs[1].sin_port, | inp = in_pcblookup(&V_udbinfo, addrs[1].sin_addr, addrs[1].sin_port, | ||||
addrs[0].sin_addr, addrs[0].sin_port, | addrs[0].sin_addr, addrs[0].sin_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_canseeinpcb(req->td->td_ucred, inp); | error = cr_canseeinpcb(req->td->td_ucred, inp); | ||||
if (error == 0) | if (error == 0) | ||||
cru2x(inp->inp_cred, &xuc); | cru2x(inp->inp_cred, &xuc); | ||||
▲ Show 20 Lines • Show All 869 Lines • Show Last 20 Lines |