From a89c8ae3a9bdf3183da941f35222ecbac0fc7ccf Mon Sep 17 00:00:00 2001 From: bluhm Date: Mon, 22 Jan 2018 20:27:28 +0000 Subject: Bring back the detach messages in trpt(8) for tcp debugging. They got lost with the pr_detach conversion. While there, remove some dead code. OK mpi@ --- sys/netinet/tcp_usrreq.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'sys/netinet/tcp_usrreq.c') diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index cc2b23e0661..c534f0eb2b7 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.163 2018/01/09 15:14:23 mpi Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.164 2018/01/22 20:27:28 bluhm Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -170,9 +170,8 @@ tcp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, if (inp) { tp = intotcpcb(inp); /* tp might get 0 when using socket splicing */ - if (tp == NULL) { + if (tp == NULL) return (0); - } #ifdef KPROF tcp_acounts[tp->t_state][req]++; #endif @@ -628,21 +627,16 @@ tcp_detach(struct socket *so) error = so->so_error; if (error == 0) error = EINVAL; - return (error); } - if (inp) { - tp = intotcpcb(inp); - /* tp might get 0 when using socket splicing */ - if (tp == NULL) { - return (0); - } + tp = intotcpcb(inp); + /* tp might get 0 when using socket splicing */ + if (tp == NULL) + return (0); #ifdef KPROF - tcp_acounts[tp->t_state][req]++; + tcp_acounts[tp->t_state][req]++; #endif - ostate = tp->t_state; - } else - ostate = 0; + ostate = tp->t_state; /* * Detach the TCP protocol from the socket. @@ -651,8 +645,10 @@ tcp_detach(struct socket *so) * which may finish later; embryonic TCB's can just * be discarded here. */ - tcp_disconnect(tp); + tp = tcp_disconnect(tp); + if (tp && (so->so_options & SO_DEBUG)) + tcp_trace(TA_USER, ostate, tp, (caddr_t)0, PRU_DETACH, 0); return (error); } -- cgit v1.2.3-59-g8ed1b