-/* $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 $ */
/*
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
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.
* 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);
}
-/* $OpenBSD: protosw.h,v 1.28 2017/11/23 13:45:46 mpi Exp $ */
+/* $OpenBSD: protosw.h,v 1.29 2018/01/22 20:27:28 bluhm Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
* A non-zero return from usrreq gives an
* UNIX error number which should be passed to higher level software.
*/
+#define PRU_DETACH 1 /* detach protocol from up */
#define PRU_BIND 2 /* bind socket to address */
#define PRU_LISTEN 3 /* listen for connection */
#define PRU_CONNECT 4 /* establish connection to peer */