Bring back the PRU_ATTACH constant and description. Then trpt(8)
authorbluhm <bluhm@openbsd.org>
Tue, 23 Jan 2018 20:49:58 +0000 (20:49 +0000)
committerbluhm <bluhm@openbsd.org>
Tue, 23 Jan 2018 20:49:58 +0000 (20:49 +0000)
prints the ATTACH action for TCP debugging socketes correctly.
OK bluhm@

sys/netinet/tcp_usrreq.c
sys/sys/protosw.h

index c534f0e..4c33de8 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: tcp_usrreq.c,v 1.164 2018/01/22 20:27:28 bluhm Exp $  */
+/*     $OpenBSD: tcp_usrreq.c,v 1.165 2018/01/23 20:49:58 bluhm Exp $  */
 /*     $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
 
 /*
@@ -602,8 +602,8 @@ tcp_attach(struct socket *so, int proto)
        if ((so->so_options & SO_LINGER) && so->so_linger == 0)
                so->so_linger = TCP_LINGERTIME;
 
-       if (tp && (so->so_options & SO_DEBUG))
-               tcp_trace(TA_USER, 0, tp, (caddr_t)0, 0 /* XXX */, 0);
+       if (so->so_options & SO_DEBUG)
+               tcp_trace(TA_USER, TCPS_CLOSED, tp, (caddr_t)0, PRU_ATTACH, 0);
        return (0);
 }
 
index 4bd22c8..995a038 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: protosw.h,v 1.30 2018/01/23 20:41:42 bluhm Exp $      */
+/*     $OpenBSD: protosw.h,v 1.31 2018/01/23 20:49:58 bluhm Exp $      */
 /*     $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
 
 /*-
@@ -121,6 +121,7 @@ struct protosw {
  * A non-zero return from usrreq gives an
  * UNIX error number which should be passed to higher level software.
  */
+#define        PRU_ATTACH              0       /* attach protocol to up */
 #define        PRU_DETACH              1       /* detach protocol from up */
 #define        PRU_BIND                2       /* bind socket to address */
 #define        PRU_LISTEN              3       /* listen for connection */
@@ -148,7 +149,7 @@ struct protosw {
 
 #ifdef PRUREQUESTS
 const char *prurequests[] = {
-       "",             "DETACH",       "BIND",         "LISTEN",
+       "ATTACH",       "DETACH",       "BIND",         "LISTEN",
        "CONNECT",      "ACCEPT",       "DISCONNECT",   "SHUTDOWN",
        "RCVD",         "SEND",         "ABORT",        "CONTROL",
        "SENSE",        "RCVOOB",       "SENDOOB",      "SOCKADDR",