aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2006-04-01 15:42:02 +0000
committerRobert Watson <rwatson@FreeBSD.org>2006-04-01 15:42:02 +0000
commitbc725eafc7f7d0cb3d3746b71b3cad9b2bc9d499 (patch)
tree7431f8c0d78c14bc446d524dcda6a00888732015 /sys/netinet/udp_usrreq.c
parentf7f45ac8e2adcda53ed2c3f4d3801fb2657c3a4b (diff)
downloadsrc-bc725eafc7f7d0cb3d3746b71b3cad9b2bc9d499.tar.gz
src-bc725eafc7f7d0cb3d3746b71b3cad9b2bc9d499.zip
Chance protocol switch method pru_detach() so that it returns void
rather than an error. Detaches do not "fail", they other occur or the protocol flags SS_PROTOREF to take ownership of the socket. soclose() no longer looks at so_pcb to see if it's NULL, relying entirely on the protocol to decide whether it's time to free the socket or not using SS_PROTOREF. so_pcb is now entirely owned and managed by the protocol code. Likewise, no longer test so_pcb in other socket functions, such as soreceive(), which have no business digging into protocol internals. Protocol detach routines no longer try to free the socket on detach, this is performed in the socket code if the protocol permits it. In rts_detach(), no longer test for rp != NULL in detach, and likewise in other protocols that don't permit a NULL so_pcb, reduce the incidence of testing for it during detach. netinet and netinet6 are not fully updated to this change, which will be in an upcoming commit. In their current state they may leak memory or panic. MFC after: 3 months
Notes
Notes: svn path=/head/; revision=157370
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 69ba6fea5163..23d430132d1b 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -125,7 +125,7 @@ SYSCTL_STRUCT(_net_inet_udp, UDPCTL_STATS, stats, CTLFLAG_RW,
static void udp_append(struct inpcb *last, struct ip *ip, struct mbuf *n,
int off, struct sockaddr_in *udp_in);
-static int udp_detach(struct socket *so);
+static void udp_detach(struct socket *so);
static int udp_output(struct inpcb *, struct mbuf *, struct sockaddr *,
struct mbuf *, struct thread *);
@@ -1027,7 +1027,7 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
return error;
}
-static int
+static void
udp_detach(struct socket *so)
{
struct inpcb *inp;
@@ -1036,12 +1036,10 @@ udp_detach(struct socket *so)
inp = sotoinpcb(so);
if (inp == 0) {
INP_INFO_WUNLOCK(&udbinfo);
- return EINVAL;
}
INP_LOCK(inp);
in_pcbdetach(inp);
INP_INFO_WUNLOCK(&udbinfo);
- return 0;
}
static int