From nobody Wed Dec 14 17:54:38 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NXNKp6Tl7z4kBS6; Wed, 14 Dec 2022 17:54:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NXNKp67dTz3nVF; Wed, 14 Dec 2022 17:54:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671040478; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2MrA5RCe6j2cmHG+4V3AtHGZYonx3FGjDbAfO1lDVGY=; b=TNVSOwek+RoDxoGJ0oGCD91wlMYlelYMPG4XreUvDYuoqI52ITO/FxDCL63vilJAX1Wt+1 1GWCXYiZf92TrIm7jznISMDvsVj+5cklsGpN4ka9W48BkL12iMx+VVkzMcf9wNGpIgntwJ RjLqoQneGZpgoZevTRibpWUNsCQ8YIvjKMmx1+BuOGeatxStEeshzvtcNeXsRB4pH0XxvY SbLo3sPDS7cO7sG68ljgboH+BwYRqetmoMLrdra6VHzSwBFPkASJVLBLcC+OluZDPtmOX7 L84JwvHVtgoh8XZRrrHTu17Q4jUtYf1PGX0a7omczr/aOYUNCsAp9D5id1c3aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671040478; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2MrA5RCe6j2cmHG+4V3AtHGZYonx3FGjDbAfO1lDVGY=; b=rKHFphe5IKucYpnMHnALrvTZ+8NgRk8OAnLotZePG9rx9H5apOE+gqc1E1kSHsQ7SLNLuC +hFIVf1P9e5nJBykRjCUtMJMxzqLcrSwPtKzDu9uRrXHxCifXKbn9DrOHfuT43B806+i6e /4GREGcwROWA9dkHrrDP4HjyTTScfOButwr2/+Jx9mUEAF4t58BI28VAftmo3LhvcbEJDo NNKDn7YczoX3ENH2BK16P9/y/qW8hxO62o52zOe9h5dknyce20q2WvUPQiXV8gwhzdlGEY R8VXBXGX7tmcfgIpbsiqDtfhFJqLQKESwVaVg39jZmdHXUetaMTr4ir0PeZEmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671040478; a=rsa-sha256; cv=none; b=iYqyAgY8i0VOSEPqOEWnybP7JDboyUP0ir02RqcBGsm2+oybodCl+94+9VlS0uRY9uZu2r QdyKINnwgJb9u01ZNQDURuB369NU+Alw6rZs6LjhLpdmEPnZ6MU5vpT+OBNhqXmXUcKIII dT4dmYjD8TIvWnCG63292gJ422BAdAM8liBa8VI/vKYJnAEzrjoZ/hMQbdbZ7liQzrRg7X Kb2WqrTQgSFlE6IqtHQ+sDtR3JazMMvXnK6Ox2pXbGi/6AmM837cCnF2GYUESI+qbMAR9L jLYfcs/ip1yv+oy2j2pxKDowlxO6o6zNPQ4N6OZ/XRdpMdKEORdZIASDOnENEg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NXNKp58rGz135b; Wed, 14 Dec 2022 17:54:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BEHsc9r077997; Wed, 14 Dec 2022 17:54:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BEHscms077996; Wed, 14 Dec 2022 17:54:38 GMT (envelope-from git) Date: Wed, 14 Dec 2022 17:54:38 GMT Message-Id: <202212141754.2BEHscms077996@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: eaabc9376483 - main - tcp: retire TCPDEBUG List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eaabc93764836c720f44d6852b30fda1901f3a66 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=eaabc93764836c720f44d6852b30fda1901f3a66 commit eaabc93764836c720f44d6852b30fda1901f3a66 Author: Gleb Smirnoff AuthorDate: 2022-12-14 17:54:06 +0000 Commit: Gleb Smirnoff CommitDate: 2022-12-14 17:54:06 +0000 tcp: retire TCPDEBUG This subsystem is superseded by modern debugging facilities, e.g. DTrace probes and TCP black box logging. We intentionally leave SO_DEBUG in place, as many utilities may set it on a socket. Also the tcp::debug DTrace probes look at this flag on a socket. Reviewed by: gnn, tuexen Discussed with: rscheff, rrs, jtl Differential revision: https://reviews.freebsd.org/D37694 --- ObsoleteFiles.inc | 3 + sys/conf/NOTES | 5 - sys/conf/files | 1 - sys/conf/options | 1 - sys/modules/tcp/bbr/Makefile | 1 - sys/modules/tcp/rack/Makefile | 1 - sys/netinet/in_kdtrace.h | 51 +++++++ sys/netinet/tcp_debug.c | 225 ------------------------------- sys/netinet/tcp_debug.h | 119 ---------------- sys/netinet/tcp_ecn.c | 1 - sys/netinet/tcp_hpts.c | 4 - sys/netinet/tcp_input.c | 63 --------- sys/netinet/tcp_output.c | 30 ----- sys/netinet/tcp_ratelimit.c | 1 - sys/netinet/tcp_reass.c | 4 - sys/netinet/tcp_sack.c | 4 - sys/netinet/tcp_stacks/bbr.c | 64 +-------- sys/netinet/tcp_stacks/rack.c | 33 ----- sys/netinet/tcp_stacks/rack_bbr_common.c | 4 - sys/netinet/tcp_subr.c | 8 -- sys/netinet/tcp_timer.c | 2 - sys/netinet/tcp_timewait.c | 4 - sys/netinet/tcp_usrreq.c | 63 --------- usr.bin/systat/netstat.c | 1 - 24 files changed, 55 insertions(+), 638 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index be9f81dd3cb0..30f129d66487 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -52,6 +52,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20221214: TCPDEBUG removed +OLD_FILES+=usr/include/netinet/tcp_debug.h + # 20221213: remove sync serial drivers and utilities OLD_FILES+=sbin/sconfig OLD_FILES+=usr/share/man/man4/ce.4 diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 1c763b2a2ceb..dede651eaf9f 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1009,10 +1009,6 @@ device wg # # PF_DEFAULT_TO_DROP causes the default pf(4) rule to deny everything. # -# TCPDEBUG enables code which keeps traces of the TCP state machine -# for sockets with the SO_DEBUG option set, which can then be examined -# using the trpt(8) utility. -# # TCPPCAP enables code which keeps the last n packets sent and received # on a TCP socket. # @@ -1037,7 +1033,6 @@ options IPFILTER_LOOKUP #ipfilter pools options IPFILTER_DEFAULT_BLOCK #block all packets by default options IPSTEALTH #support for stealth forwarding options PF_DEFAULT_TO_DROP #drop everything by default -options TCPDEBUG options TCPPCAP options TCP_BLACKBOX options TCP_HHOOK diff --git a/sys/conf/files b/sys/conf/files index 60c5c749c40b..943817f282aa 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4387,7 +4387,6 @@ netinet/sctp_timer.c optional inet sctp | inet6 sctp netinet/sctp_usrreq.c optional inet sctp | inet6 sctp netinet/sctputil.c optional inet sctp | inet6 sctp netinet/siftr.c optional inet siftr alq | inet6 siftr alq -netinet/tcp_debug.c optional tcpdebug netinet/tcp_ecn.c optional inet | inet6 netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 tcp_rfc7413 netinet/tcp_hostcache.c optional inet | inet6 diff --git a/sys/conf/options b/sys/conf/options index 00019b1c2e5c..85f456555447 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -465,7 +465,6 @@ ROUTETABLES opt_route.h FIB_ALGO opt_route.h RSS opt_rss.h SLIP_IFF_OPTS opt_slip.h -TCPDEBUG TCPPCAP opt_global.h SIFTR TCP_BLACKBOX opt_global.h diff --git a/sys/modules/tcp/bbr/Makefile b/sys/modules/tcp/bbr/Makefile index b94ffd0b518e..72c44f22efec 100644 --- a/sys/modules/tcp/bbr/Makefile +++ b/sys/modules/tcp/bbr/Makefile @@ -11,7 +11,6 @@ SRCS= bbr.c sack_filter.c rack_bbr_common.c SRCS+= opt_inet.h opt_inet6.h opt_ipsec.h SRCS+= opt_kern_tls.h SRCS+= opt_ratelimit.h -SRCS+= opt_tcpdebug.h # # Enable full debugging diff --git a/sys/modules/tcp/rack/Makefile b/sys/modules/tcp/rack/Makefile index ba9dca32babe..68ce40cc074e 100644 --- a/sys/modules/tcp/rack/Makefile +++ b/sys/modules/tcp/rack/Makefile @@ -11,7 +11,6 @@ SRCS= rack.c sack_filter.c rack_bbr_common.c SRCS+= opt_inet.h opt_inet6.h opt_ipsec.h SRCS+= opt_kern_tls.h SRCS+= opt_ratelimit.h -SRCS+= opt_tcpdebug.h # # Enable full debugging diff --git a/sys/netinet/in_kdtrace.h b/sys/netinet/in_kdtrace.h index ff0430db2faf..fa88dc437fe7 100644 --- a/sys/netinet/in_kdtrace.h +++ b/sys/netinet/in_kdtrace.h @@ -78,4 +78,55 @@ SDT_PROBE_DECLARE(udp, , , send); SDT_PROBE_DECLARE(udplite, , , receive); SDT_PROBE_DECLARE(udplite, , , send); +/* + * These constants originate from the 4.4BSD sys/protosw.h. They lost + * their initial purpose in 2c37256e5a59, when single pr_usrreq method + * was split into multiple methods. However, they were used by TCPDEBUG, + * a feature barely used, but it kept them in the tree for many years. + * In 5d06879adb95 DTrace probes started to use them. Note that they + * are not documented in dtrace_tcp(4), so they are likely to be + * eventually renamed to something better and extended/trimmed. + */ +#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 */ +#define PRU_CONNECT 4 /* establish connection to peer */ +#define PRU_ACCEPT 5 /* accept connection from peer */ +#define PRU_DISCONNECT 6 /* disconnect from peer */ +#define PRU_SHUTDOWN 7 /* won't send any more data */ +#define PRU_RCVD 8 /* have taken data; more room now */ +#define PRU_SEND 9 /* send this data */ +#define PRU_ABORT 10 /* abort (fast DISCONNECT, DETATCH) */ +#define PRU_CONTROL 11 /* control operations on protocol */ +#define PRU_SENSE 12 /* return status into m */ +#define PRU_RCVOOB 13 /* retrieve out of band data */ +#define PRU_SENDOOB 14 /* send out of band data */ +#define PRU_SOCKADDR 15 /* fetch socket's address */ +#define PRU_PEERADDR 16 /* fetch peer's address */ +#define PRU_CONNECT2 17 /* connect two sockets */ +/* begin for protocols internal use */ +#define PRU_FASTTIMO 18 /* 200ms timeout */ +#define PRU_SLOWTIMO 19 /* 500ms timeout */ +#define PRU_PROTORCV 20 /* receive from below */ +#define PRU_PROTOSEND 21 /* send to below */ +/* end for protocol's internal use */ +#define PRU_SEND_EOF 22 /* send and close */ +#define PRU_SOSETLABEL 23 /* MAC label change */ +#define PRU_CLOSE 24 /* socket close */ +#define PRU_FLUSH 25 /* flush the socket */ +#define PRU_NREQ 25 + +#ifdef PRUREQUESTS +const char *prurequests[] = { + "ATTACH", "DETACH", "BIND", "LISTEN", + "CONNECT", "ACCEPT", "DISCONNECT", "SHUTDOWN", + "RCVD", "SEND", "ABORT", "CONTROL", + "SENSE", "RCVOOB", "SENDOOB", "SOCKADDR", + "PEERADDR", "CONNECT2", "FASTTIMO", "SLOWTIMO", + "PROTORCV", "PROTOSEND", "SEND_EOF", "SOSETLABEL", + "CLOSE", "FLUSH", +}; +#endif + #endif diff --git a/sys/netinet/tcp_debug.c b/sys/netinet/tcp_debug.c deleted file mode 100644 index e00dc095b01f..000000000000 --- a/sys/netinet/tcp_debug.c +++ /dev/null @@ -1,225 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp_debug.c 8.1 (Berkeley) 6/10/93 - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_inet6.h" -#include "opt_tcpdebug.h" - -#ifdef TCPDEBUG -/* load symbolic names */ -#define PRUREQUESTS -#define TCPSTATES -#define TCPTIMERS -#define TANAMES -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#ifdef INET6 -#include -#endif -#include -#include -#include -#include -#include -#include -#include - -#ifdef TCPDEBUG -static int tcpconsdebug = 0; -#endif - -/* - * Global ring buffer of TCP debugging state. Each entry captures a snapshot - * of TCP connection state at any given moment. tcp_debx addresses at the - * next available slot. There is no explicit export of this data structure; - * it will be read via /dev/kmem by debugging tools. - */ -static struct tcp_debug tcp_debug[TCP_NDEBUG]; -static int tcp_debx; - -/* - * All global state is protected by tcp_debug_mtx; tcp_trace() is split into - * two parts, one of which saves connection and other state into the global - * array (locked by tcp_debug_mtx). - */ -struct mtx tcp_debug_mtx; -MTX_SYSINIT(tcp_debug_mtx, &tcp_debug_mtx, "tcp_debug_mtx", MTX_DEF); - -/* - * Save TCP state at a given moment; optionally, both tcpcb and TCP packet - * header state will be saved. - */ -void -tcp_trace(short act, short ostate, struct tcpcb *tp, void *ipgen, - struct tcphdr *th, int req) -{ -#ifdef INET6 - int isipv6; -#endif /* INET6 */ - tcp_seq seq, ack; - int len, flags; - struct tcp_debug *td; - - mtx_lock(&tcp_debug_mtx); - td = &tcp_debug[tcp_debx++]; - if (tcp_debx == TCP_NDEBUG) - tcp_debx = 0; - bzero(td, sizeof(*td)); -#ifdef INET6 - isipv6 = (ipgen != NULL && ((struct ip *)ipgen)->ip_v == 6) ? 1 : 0; -#endif /* INET6 */ - td->td_family = -#ifdef INET6 - (isipv6 != 0) ? AF_INET6 : -#endif - AF_INET; -#ifdef INET - td->td_time = iptime(); -#endif - td->td_act = act; - td->td_ostate = ostate; - td->td_tcb = (caddr_t)tp; - if (tp != NULL) - td->td_cb = *tp; - if (ipgen != NULL) { - switch (td->td_family) { -#ifdef INET - case AF_INET: - bcopy(ipgen, &td->td_ti.ti_i, sizeof(td->td_ti.ti_i)); - break; -#endif -#ifdef INET6 - case AF_INET6: - bcopy(ipgen, td->td_ip6buf, sizeof(td->td_ip6buf)); - break; -#endif - } - } - if (th != NULL) { - switch (td->td_family) { -#ifdef INET - case AF_INET: - td->td_ti.ti_t = *th; - break; -#endif -#ifdef INET6 - case AF_INET6: - td->td_ti6.th = *th; - break; -#endif - } - } - td->td_req = req; - mtx_unlock(&tcp_debug_mtx); -#ifdef TCPDEBUG - if (tcpconsdebug == 0) - return; - if (tp != NULL) - printf("%p %s:", tp, tcpstates[ostate]); - else - printf("???????? "); - printf("%s ", tanames[act]); - switch (act) { - case TA_INPUT: - case TA_OUTPUT: - case TA_DROP: - if (ipgen == NULL || th == NULL) - break; - seq = th->th_seq; - ack = th->th_ack; - len = -#ifdef INET6 - isipv6 ? ntohs(((struct ip6_hdr *)ipgen)->ip6_plen) : -#endif - ntohs(((struct ip *)ipgen)->ip_len); - if (act == TA_OUTPUT) { - seq = ntohl(seq); - ack = ntohl(ack); - } - if (act == TA_OUTPUT) - len -= sizeof (struct tcphdr); - if (len) - printf("[%x..%x)", seq, seq+len); - else - printf("%x", seq); - printf("@%x, urp=%x", ack, th->th_urp); - flags = tcp_get_flags(th); - if (flags) { - char *cp = "<"; -#define pf(f) { \ - if (tcp_get_flags(th) & TH_##f) { \ - printf("%s%s", cp, #f); \ - cp = ","; \ - } \ -} - pf(SYN); pf(ACK); pf(FIN); pf(RST); pf(PUSH); pf(URG); - printf(">"); - } - break; - - case TA_USER: - printf("%s", prurequests[req&0xff]); - if ((req & 0xff) == PRU_SLOWTIMO) - printf("<%s>", tcptimers[req>>8]); - break; - } - if (tp != NULL) - printf(" -> %s", tcpstates[tp->t_state]); - /* print out internal state of tp !?! */ - printf("\n"); - if (tp == NULL) - return; - printf( - "\trcv_(nxt,wnd,up) (%lx,%lx,%lx) snd_(una,nxt,max) (%lx,%lx,%lx)\n", - (u_long)tp->rcv_nxt, (u_long)tp->rcv_wnd, (u_long)tp->rcv_up, - (u_long)tp->snd_una, (u_long)tp->snd_nxt, (u_long)tp->snd_max); - printf("\tsnd_(wl1,wl2,wnd) (%lx,%lx,%lx)\n", - (u_long)tp->snd_wl1, (u_long)tp->snd_wl2, (u_long)tp->snd_wnd); -#endif /* TCPDEBUG */ -} diff --git a/sys/netinet/tcp_debug.h b/sys/netinet/tcp_debug.h deleted file mode 100644 index 6bb296ea0e52..000000000000 --- a/sys/netinet/tcp_debug.h +++ /dev/null @@ -1,119 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp_debug.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD$ - */ - -#ifndef _NETINET_TCP_DEBUG_H_ -#define _NETINET_TCP_DEBUG_H_ - -struct tcp_debug { - uint32_t td_time; /* network format */ - short td_act; - short td_ostate; - caddr_t td_tcb; - int td_family; - /* - * Co-existense of td_ti and td_ti6 below is ugly, but it is necessary - * to achieve backword compatibility to some extent. - */ - struct tcpiphdr td_ti; - struct { -#define IP6_HDR_LEN 40 /* sizeof(struct ip6_hdr) */ -#if !defined(_KERNEL) && defined(INET6) - struct ip6_hdr ip6; -#else - u_char ip6buf[IP6_HDR_LEN]; -#endif - struct tcphdr th; - } td_ti6; -#define td_ip6buf td_ti6.ip6buf - short td_req; - struct tcpcb td_cb; -}; - -#define TA_INPUT 0 -#define TA_OUTPUT 1 -#define TA_USER 2 -#define TA_RESPOND 3 -#define TA_DROP 4 - -#ifdef TANAMES -static const char *tanames[] = - { "input", "output", "user", "respond", "drop" }; -#endif - -#define TCP_NDEBUG 100 - -/* These older constants are still present in order to support TCP debugging. */ -#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 */ -#define PRU_CONNECT 4 /* establish connection to peer */ -#define PRU_ACCEPT 5 /* accept connection from peer */ -#define PRU_DISCONNECT 6 /* disconnect from peer */ -#define PRU_SHUTDOWN 7 /* won't send any more data */ -#define PRU_RCVD 8 /* have taken data; more room now */ -#define PRU_SEND 9 /* send this data */ -#define PRU_ABORT 10 /* abort (fast DISCONNECT, DETATCH) */ -#define PRU_CONTROL 11 /* control operations on protocol */ -#define PRU_SENSE 12 /* return status into m */ -#define PRU_RCVOOB 13 /* retrieve out of band data */ -#define PRU_SENDOOB 14 /* send out of band data */ -#define PRU_SOCKADDR 15 /* fetch socket's address */ -#define PRU_PEERADDR 16 /* fetch peer's address */ -#define PRU_CONNECT2 17 /* connect two sockets */ -/* begin for protocols internal use */ -#define PRU_FASTTIMO 18 /* 200ms timeout */ -#define PRU_SLOWTIMO 19 /* 500ms timeout */ -#define PRU_PROTORCV 20 /* receive from below */ -#define PRU_PROTOSEND 21 /* send to below */ -/* end for protocol's internal use */ -#define PRU_SEND_EOF 22 /* send and close */ -#define PRU_SOSETLABEL 23 /* MAC label change */ -#define PRU_CLOSE 24 /* socket close */ -#define PRU_FLUSH 25 /* flush the socket */ -#define PRU_NREQ 25 - -#ifdef PRUREQUESTS -const char *prurequests[] = { - "ATTACH", "DETACH", "BIND", "LISTEN", - "CONNECT", "ACCEPT", "DISCONNECT", "SHUTDOWN", - "RCVD", "SEND", "ABORT", "CONTROL", - "SENSE", "RCVOOB", "SENDOOB", "SOCKADDR", - "PEERADDR", "CONNECT2", "FASTTIMO", "SLOWTIMO", - "PROTORCV", "PROTOSEND", "SEND_EOF", "SOSETLABEL", - "CLOSE", "FLUSH", -}; -#endif - -#endif /* !_NETINET_TCP_DEBUG_H_ */ diff --git a/sys/netinet/tcp_ecn.c b/sys/netinet/tcp_ecn.c index 5b19ed93225f..579c0b407ae1 100644 --- a/sys/netinet/tcp_ecn.c +++ b/sys/netinet/tcp_ecn.c @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_tcpdebug.h" #include #include diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c index d3e923406784..5731e9a81e19 100644 --- a/sys/netinet/tcp_hpts.c +++ b/sys/netinet/tcp_hpts.c @@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_rss.h" -#include "opt_tcpdebug.h" /** * Some notes about usage. @@ -157,9 +156,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef tcpdebug -#include -#endif /* tcpdebug */ #ifdef tcp_offload #include #endif diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 96812afd3b37..5141903522bf 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" -#include "opt_tcpdebug.h" #include #include @@ -117,7 +116,6 @@ __FBSDID("$FreeBSD$"); #include #endif #include -#include #ifdef TCP_OFFLOAD #include #endif @@ -632,15 +630,6 @@ tcp_input_with_port(struct mbuf **mp, int *offp, int proto, uint16_t port) #endif /* INET6 */ struct tcpopt to; /* options in this segment */ char *s = NULL; /* address and port logging */ -#ifdef TCPDEBUG - /* - * The size of tcp_saveipgen must be the size of the max ip header, - * now IPv6. - */ - u_char tcp_saveipgen[IP6_HDR_LEN]; - struct tcphdr tcp_savetcp; - short ostate = 0; -#endif NET_EPOCH_ASSERT(); @@ -1021,18 +1010,6 @@ findpcb: #endif so = inp->inp_socket; KASSERT(so != NULL, ("%s: so == NULL", __func__)); -#ifdef TCPDEBUG - if (so->so_options & SO_DEBUG) { - ostate = tp->t_state; -#ifdef INET6 - if (isipv6) { - bcopy((char *)ip6, (char *)tcp_saveipgen, sizeof(*ip6)); - } else -#endif - bcopy((char *)ip, (char *)tcp_saveipgen, sizeof(*ip)); - tcp_savetcp = *th; - } -#endif /* TCPDEBUG */ /* * When the socket is accepting connections (the INPCB is in LISTEN * state) we look into the SYN cache if this is a new connection @@ -1344,11 +1321,6 @@ tfo_socket_result: * SYN appears to be valid. Create compressed TCP state * for syncache. */ -#ifdef TCPDEBUG - if (so->so_options & SO_DEBUG) - tcp_trace(TA_INPUT, ostate, tp, - (void *)tcp_saveipgen, &tcp_savetcp, 0); -#endif TCP_PROBE3(debug__input, tp, th, m); tcp_dooptions(&to, optp, optlen, TO_SYN); if ((so = syncache_add(&inc, &to, th, inp, so, m, NULL, NULL, @@ -1528,15 +1500,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, int tfo_syn; u_int maxseg; -#ifdef TCPDEBUG - /* - * The size of tcp_saveipgen must be the size of the max ip header, - * now IPv6. - */ - u_char tcp_saveipgen[IP6_HDR_LEN]; - struct tcphdr tcp_savetcp; - short ostate = 0; -#endif thflags = tcp_get_flags(th); tp->sackhint.last_sack_ack = 0; sack_changed = 0; @@ -1856,12 +1819,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, * are ready to send, let tcp_output * decide between more output or persist. */ -#ifdef TCPDEBUG - if (so->so_options & SO_DEBUG) - tcp_trace(TA_INPUT, ostate, tp, - (void *)tcp_saveipgen, - &tcp_savetcp, 0); -#endif TCP_PROBE3(debug__input, tp, th, m); /* * Clear t_acktime if remote side has ACKd @@ -1918,11 +1875,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->rcv_up = tp->rcv_nxt; TCPSTAT_ADD(tcps_rcvpack, nsegs); TCPSTAT_ADD(tcps_rcvbyte, tlen); -#ifdef TCPDEBUG - if (so->so_options & SO_DEBUG) - tcp_trace(TA_INPUT, ostate, tp, - (void *)tcp_saveipgen, &tcp_savetcp, 0); -#endif TCP_PROBE3(debug__input, tp, th, m); newsize = tcp_autorcvbuf(m, th, so, tp, tlen); @@ -3298,11 +3250,6 @@ dodata: /* XXX */ return; } } -#ifdef TCPDEBUG - if (so->so_options & SO_DEBUG) - tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen, - &tcp_savetcp, 0); -#endif TCP_PROBE3(debug__input, tp, th, m); /* @@ -3344,11 +3291,6 @@ dropafterack: tcp_log_end_status(tp, TCP_EI_STATUS_RST_IN_FRONT); goto dropwithreset; } -#ifdef TCPDEBUG - if (so->so_options & SO_DEBUG) - tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen, - &tcp_savetcp, 0); -#endif TCP_PROBE3(debug__input, tp, th, m); tp->t_flags |= TF_ACKNOW; (void) tcp_output(tp); @@ -3368,11 +3310,6 @@ drop: /* * Drop space held by incoming segment and return. */ -#ifdef TCPDEBUG - if (tp == NULL || (inp->inp_socket->so_options & SO_DEBUG)) - tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen, - &tcp_savetcp, 0); -#endif TCP_PROBE3(debug__input, tp, th, m); if (tp != NULL) { INP_WUNLOCK(inp); diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index aa4bfef9a9ff..e0e8dfeb46ef 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_ipsec.h" #include "opt_kern_tls.h" -#include "opt_tcpdebug.h" #include #include @@ -93,9 +92,6 @@ __FBSDID("$FreeBSD$"); #ifdef TCPPCAP #include #endif -#ifdef TCPDEBUG -#include -#endif #ifdef TCP_OFFLOAD #include #endif @@ -206,9 +202,6 @@ tcp_default_output(struct tcpcb *tp) u_int if_hw_tsomaxsegsize = 0; struct mbuf *m; struct ip *ip = NULL; -#ifdef TCPDEBUG - struct ipovly *ipov = NULL; -#endif struct tcphdr *th; u_char opt[TCP_MAXOLEN]; unsigned ipoptlen, optlen, hdrlen, ulen; @@ -1175,9 +1168,6 @@ send: #endif /* INET6 */ { ip = mtod(m, struct ip *); -#ifdef TCPDEBUG - ipov = (struct ipovly *)ip; -#endif if (tp->t_port) { udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); @@ -1419,26 +1409,6 @@ send: hhook_run_tcp_est_out(tp, th, &to, len, tso); #endif -#ifdef TCPDEBUG - /* - * Trace. - */ - if (so->so_options & SO_DEBUG) { - u_short save = 0; -#ifdef INET6 - if (!isipv6) -#endif - { - save = ipov->ih_len; - ipov->ih_len = htons(m->m_pkthdr.len /* - hdrlen + (th->th_off << 2) */); - } - tcp_trace(TA_OUTPUT, tp->t_state, tp, mtod(m, void *), th, 0); -#ifdef INET6 - if (!isipv6) -#endif - ipov->ih_len = save; - } -#endif /* TCPDEBUG */ TCP_PROBE3(debug__output, tp, th, m); /* We're getting ready to send; log now. */ diff --git a/sys/netinet/tcp_ratelimit.c b/sys/netinet/tcp_ratelimit.c index f6567d159b36..dc207d10311c 100644 --- a/sys/netinet/tcp_ratelimit.c +++ b/sys/netinet/tcp_ratelimit.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" -#include "opt_tcpdebug.h" #include "opt_ratelimit.h" #include #include diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index 0a620d173d88..77d1d9fa31bf 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_tcpdebug.h" /* For debugging we want counters and BB logging */ /* #define TCP_REASS_COUNTERS 1 */ @@ -81,9 +80,6 @@ __FBSDID("$FreeBSD$"); #include #endif #include -#ifdef TCPDEBUG -#include -#endif /* TCPDEBUG */ #define TCP_R_LOG_ADD 1 #define TCP_R_LOG_LIMIT_REACHED 2 diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 23ebb346ff5e..558773f91228 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_tcpdebug.h" #include #include @@ -119,9 +118,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef TCPDEBUG -#include -#endif /* TCPDEBUG */ #include diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 5a1e3de4c416..4f74fdd1dd76 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" -#include "opt_tcpdebug.h" #include "opt_ratelimit.h" #include #include @@ -99,9 +98,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef TCPDEBUG -#include -#endif /* TCPDEBUG */ #ifdef TCP_OFFLOAD #include #endif @@ -8409,16 +8405,7 @@ bbr_do_fastnewdata(struct mbuf *m, struct tcphdr *th, struct socket *so, #ifdef NETFLIX_SB_LIMITS u_int mcnt, appended; #endif -#ifdef TCPDEBUG - /* - * The size of tcp_saveipgen must be the size of the max ip header, - * now IPv6. - */ - u_char tcp_saveipgen[IP6_HDR_LEN]; - struct tcphdr tcp_savetcp; - short ostate = 0; -#endif /* On the hpts and we would have called output */ bbr = (struct tcp_bbr *)tp->t_fb_ptr; @@ -8493,11 +8480,6 @@ bbr_do_fastnewdata(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->rcv_up = tp->rcv_nxt; KMOD_TCPSTAT_ADD(tcps_rcvpack, (int)nsegs); KMOD_TCPSTAT_ADD(tcps_rcvbyte, tlen); -#ifdef TCPDEBUG - if (so->so_options & SO_DEBUG) - tcp_trace(TA_INPUT, ostate, tp, - (void *)tcp_saveipgen, &tcp_savetcp, 0); -#endif newsize = tcp_autorcvbuf(m, th, so, tp, tlen); /* Add data to socket buffer. */ @@ -8555,16 +8537,6 @@ bbr_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so, int32_t acked; uint16_t nsegs; uint32_t sack_changed; -#ifdef TCPDEBUG - /* - * The size of tcp_saveipgen must be the size of the max ip header, - * now IPv6. - */ - u_char tcp_saveipgen[IP6_HDR_LEN]; - struct tcphdr tcp_savetcp; - short ostate = 0; - -#endif uint32_t prev_acked = 0; struct tcp_bbr *bbr; @@ -8704,14 +8676,8 @@ bbr_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so, * value. If process is waiting for space, wakeup/selwakeup/signal. * If data are ready to send, let tcp_output decide between more * output or persist. + * Wake up the socket if we have room to write more. */ -#ifdef TCPDEBUG - if (so->so_options & SO_DEBUG) - tcp_trace(TA_INPUT, ostate, tp, - (void *)tcp_saveipgen, - &tcp_savetcp, 0); -#endif - /* Wake up the socket if we have room to write more */ sowwakeup(so); if (tp->snd_una == tp->snd_max) { /* Nothing left outstanding */ @@ -11847,9 +11813,6 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeval *tv) uint32_t if_hw_tsomaxsegsize = 0; uint32_t if_hw_tsomax = 0; struct ip *ip = NULL; -#ifdef TCPDEBUG - struct ipovly *ipov = NULL; -#endif struct tcp_bbr *bbr; struct tcphdr *th; struct udphdr *udp = NULL; @@ -13298,9 +13261,6 @@ send: #endif /* INET6 */ { ip = mtod(m, struct ip *); -#ifdef TCPDEBUG - ipov = (struct ipovly *)ip; -#endif if (tp->t_port) { udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); @@ -13511,28 +13471,6 @@ send: /* Run HHOOK_TC_ESTABLISHED_OUT helper hooks. */ hhook_run_tcp_est_out(tp, th, &to, len, tso); #endif -#ifdef TCPDEBUG - /* - * Trace. - */ - if (so->so_options & SO_DEBUG) { - u_short save = 0; - -#ifdef INET6 - if (!isipv6) -#endif - { - save = ipov->ih_len; - ipov->ih_len = htons(m->m_pkthdr.len /* - hdrlen + - * (th->th_off << 2) */ ); - } - tcp_trace(TA_OUTPUT, tp->t_state, tp, mtod(m, void *), th, 0); -#ifdef INET6 - if (!isipv6) -#endif - ipov->ih_len = save; - } -#endif /* TCPDEBUG */ /* Log to the black box */ if (tp->t_logstate != TCP_LOG_STATE_OFF) { diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c *** 587 LINES SKIPPED ***