summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2006-04-01 23:53:25 +0000
committerrwatson <rwatson@FreeBSD.org>2006-04-01 23:53:25 +0000
commitace109901c9d2c2778de311362942c7ba6da35a3 (patch)
tree164cd45f9369a07507e51566d5d02b292b9c63f8 /sys/netinet/tcp_usrreq.c
parentefafd28314fe42905437e567774448a86e98a88c (diff)
downloadFreeBSD-src-ace109901c9d2c2778de311362942c7ba6da35a3.zip
FreeBSD-src-ace109901c9d2c2778de311362942c7ba6da35a3.tar.gz
Properly handle an edge case previously not handled correctly: a
socket can have a tcp connection that has entered time wait attached to it, in the event that shutdown() is called on the socket and the FINs properly exchange before close(). In this case we don't detach or free the inpcb, just leave the tcptw detached and freed, but we must release the inpcb lock (which we didn't previously). MFC after: 3 months
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 99b5e17..29c0da8 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -169,8 +169,11 @@ tcp_usr_detach(struct socket *so)
if (inp->inp_vflag & INP_DROPPED) {
/*
* Connection was in time wait and has been dropped;
- * the calling path is via tcp_twclose(), which will
- * free the tcptw, so we can discard the remainder.
+ * the calling path is either via tcp_twclose(), or
+ * as a result of an eventual soclose() after
+ * tcp_twclose() has been called. In either case,
+ * tcp_twclose() has detached the tcptw from the
+ * inpcb, so we just detach and free the inpcb.
*
* XXXRW: Would it be cleaner to free the tcptw
* here?
OpenPOWER on IntegriCloud