Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/udp_usrreq.c
Show First 20 Lines • Show All 1,484 Lines • ▼ Show 20 Lines | |||||
release: | release: | ||||
INP_UNLOCK(inp); | INP_UNLOCK(inp); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
m_freem(m); | m_freem(m); | ||||
return (error); | return (error); | ||||
} | } | ||||
static void | pr_abort_t udp_abort; /* shared with udp6_usrreq.c */ | ||||
void | |||||
udp_abort(struct socket *so) | udp_abort(struct socket *so) | ||||
{ | { | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
struct inpcbinfo *pcbinfo; | struct inpcbinfo *pcbinfo; | ||||
pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); | pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); | ||||
inp = sotoinpcb(so); | inp = sotoinpcb(so); | ||||
KASSERT(inp != NULL, ("udp_abort: inp == NULL")); | KASSERT(inp != NULL, ("udp_abort: inp == NULL")); | ||||
▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | udp_detach(struct socket *so) | ||||
up = intoudpcb(inp); | up = intoudpcb(inp); | ||||
KASSERT(up != NULL, ("%s: up == NULL", __func__)); | KASSERT(up != NULL, ("%s: up == NULL", __func__)); | ||||
inp->inp_ppcb = NULL; | inp->inp_ppcb = NULL; | ||||
in_pcbdetach(inp); | in_pcbdetach(inp); | ||||
in_pcbfree(inp); | in_pcbfree(inp); | ||||
udp_discardcb(up); | udp_discardcb(up); | ||||
} | } | ||||
static int | pr_disconnect_t udp_disconnect; /* shared with udp6_usrreq.c */ | ||||
int | |||||
udp_disconnect(struct socket *so) | udp_disconnect(struct socket *so) | ||||
{ | { | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
struct inpcbinfo *pcbinfo; | struct inpcbinfo *pcbinfo; | ||||
pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); | pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); | ||||
inp = sotoinpcb(so); | inp = sotoinpcb(so); | ||||
KASSERT(inp != NULL, ("udp_disconnect: inp == NULL")); | KASSERT(inp != NULL, ("udp_disconnect: inp == NULL")); | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
if (inp->inp_faddr.s_addr == INADDR_ANY) { | if (inp->inp_faddr.s_addr == INADDR_ANY) { | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
return (ENOTCONN); | return (ENOTCONN); | ||||
} | } | ||||
INP_HASH_WLOCK(pcbinfo); | INP_HASH_WLOCK(pcbinfo); | ||||
in_pcbdisconnect(inp); | in_pcbdisconnect(inp); | ||||
inp->inp_laddr.s_addr = INADDR_ANY; | inp->inp_laddr.s_addr = INADDR_ANY; | ||||
INP_HASH_WUNLOCK(pcbinfo); | INP_HASH_WUNLOCK(pcbinfo); | ||||
SOCK_LOCK(so); | SOCK_LOCK(so); | ||||
so->so_state &= ~SS_ISCONNECTED; /* XXX */ | so->so_state &= ~SS_ISCONNECTED; /* XXX */ | ||||
SOCK_UNLOCK(so); | SOCK_UNLOCK(so); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | pr_send_t udp_send; /* shared with udp6_usrreq.c */ | ||||
int | |||||
udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, | udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, | ||||
struct mbuf *control, struct thread *td) | struct mbuf *control, struct thread *td) | ||||
{ | { | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
int error; | int error; | ||||
inp = sotoinpcb(so); | inp = sotoinpcb(so); | ||||
KASSERT(inp != NULL, ("udp_send: inp == NULL")); | KASSERT(inp != NULL, ("udp_send: inp == NULL")); | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |