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
This commit is contained in:
Gleb Smirnoff 2022-12-14 09:54:06 -08:00
parent ab8b2d108c
commit eaabc93764
24 changed files with 55 additions and 638 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mbuf.h>
#include <sys/mutex.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/in_pcb.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#ifdef INET6
#include <netinet/ip6.h>
#endif
#include <netinet/ip_var.h>
#include <netinet/tcp.h>
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet/tcpip.h>
#include <netinet/tcp_debug.h>
#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 */
}

View file

@ -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_ */

View file

@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
#include <sys/systm.h>

View file

@ -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 <netinet/tcp_hpts.h>
#include <netinet/tcp_log_buf.h>
#ifdef tcpdebug
#include <netinet/tcp_debug.h>
#endif /* tcpdebug */
#ifdef tcp_offload
#include <netinet/tcp_offload.h>
#endif

View file

@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
#include <sys/arb.h>
@ -117,7 +116,6 @@ __FBSDID("$FreeBSD$");
#include <netinet/tcp_pcap.h>
#endif
#include <netinet/tcp_syncache.h>
#include <netinet/tcp_debug.h>
#ifdef TCP_OFFLOAD
#include <netinet/tcp_offload.h>
#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 @@ tcp_input_with_port(struct mbuf **mp, int *offp, int proto, uint16_t port)
#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 @@ tcp_input_with_port(struct mbuf **mp, int *offp, int proto, uint16_t port)
* 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 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
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 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
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 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
/*
* 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);

View file

@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_kern_tls.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -93,9 +92,6 @@ __FBSDID("$FreeBSD$");
#ifdef TCPPCAP
#include <netinet/tcp_pcap.h>
#endif
#ifdef TCPDEBUG
#include <netinet/tcp_debug.h>
#endif
#ifdef TCP_OFFLOAD
#include <netinet/tcp_offload.h>
#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 @@ tcp_default_output(struct tcpcb *tp)
#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 @@ tcp_default_output(struct tcpcb *tp)
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. */

View file

@ -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 <sys/param.h>
#include <sys/kernel.h>

View file

@ -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 <netinet/tcp_hpts.h>
#endif
#include <netinet/tcpip.h>
#ifdef TCPDEBUG
#include <netinet/tcp_debug.h>
#endif /* TCPDEBUG */
#define TCP_R_LOG_ADD 1
#define TCP_R_LOG_LIMIT_REACHED 2

View file

@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -119,9 +118,6 @@ __FBSDID("$FreeBSD$");
#include <netinet/tcp_var.h>
#include <netinet/tcpip.h>
#include <netinet/cc/cc.h>
#ifdef TCPDEBUG
#include <netinet/tcp_debug.h>
#endif /* TCPDEBUG */
#include <machine/in_cksum.h>

View file

@ -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 <sys/param.h>
#include <sys/arb.h>
@ -99,9 +98,6 @@ __FBSDID("$FreeBSD$");
#include <netinet/tcp_log_buf.h>
#include <netinet/tcp_ratelimit.h>
#include <netinet/tcp_lro.h>
#ifdef TCPDEBUG
#include <netinet/tcp_debug.h>
#endif /* TCPDEBUG */
#ifdef TCP_OFFLOAD
#include <netinet/tcp_offload.h>
#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 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeval *tv)
#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 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeval *tv)
/* 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) {

View file

@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_tcpdebug.h"
#include "opt_ratelimit.h"
#include "opt_kern_tls.h"
#include <sys/param.h>
@ -105,9 +104,6 @@ __FBSDID("$FreeBSD$");
#ifdef NETFLIX_SHARED_CWND
#include <netinet/tcp_shared_cwnd.h>
#endif
#ifdef TCPDEBUG
#include <netinet/tcp_debug.h>
#endif /* TCPDEBUG */
#ifdef TCP_OFFLOAD
#include <netinet/tcp_offload.h>
#endif
@ -10796,16 +10792,7 @@ rack_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
/*
* If last ACK falls within this segment's sequence numbers, record
* the timestamp. NOTE that the test is modified according to the
@ -10881,11 +10868,6 @@ rack_do_fastnewdata(struct mbuf *m, struct tcphdr *th, struct socket *so,
tp->rcv_up = tp->rcv_nxt;
KMOD_TCPSTAT_ADD(tcps_rcvpack, 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. */
@ -10936,15 +10918,6 @@ rack_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so,
{
int32_t acked;
int32_t nsegs;
#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
int32_t under_pacing = 0;
struct tcp_rack *rack;
@ -11113,12 +11086,6 @@ rack_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so,
* If data 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
if (under_pacing &&
(rack->use_fixed_rate == 0) &&
(rack->in_probe_rtt == 0) &&

View file

@ -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 "opt_kern_tls.h"
#include <sys/param.h>
@ -100,9 +99,6 @@ __FBSDID("$FreeBSD$");
#include <netinet/tcp_lro.h>
#include <netinet/cc/cc.h>
#include <netinet/tcp_log_buf.h>
#ifdef TCPDEBUG
#include <netinet/tcp_debug.h>
#endif /* TCPDEBUG */
#ifdef TCP_OFFLOAD
#include <netinet/tcp_offload.h>
#endif

View file

@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_kern_tls.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -115,9 +114,6 @@ __FBSDID("$FreeBSD$");
#ifdef TCPPCAP
#include <netinet/tcp_pcap.h>
#endif
#ifdef TCPDEBUG
#include <netinet/tcp_debug.h>
#endif
#ifdef TCP_OFFLOAD
#include <netinet/tcp_offload.h>
#endif
@ -2077,10 +2073,6 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m,
}
}
#endif /* INET */
#ifdef TCPDEBUG
if (tp == NULL || (inp->inp_socket->so_options & SO_DEBUG))
tcp_trace(TA_OUTPUT, 0, tp, mtod(m, void *), th, 0);
#endif
TCP_PROBE3(debug__output, tp, th, m);
if (flags & TH_RST)
TCP_PROBE5(accept__refused, NULL, NULL, m, tp, nth);

View file

@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_tcpdebug.h"
#include "opt_rss.h"
#include <sys/param.h>
@ -77,7 +76,6 @@ __FBSDID("$FreeBSD$");
#include <netinet6/tcp6_var.h>
#endif
#include <netinet/tcpip.h>
#include <netinet/tcp_debug.h>
int tcp_persmin;
SYSCTL_PROC(_net_inet_tcp, OID_AUTO, persmin,

View file

@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -83,9 +82,6 @@ __FBSDID("$FreeBSD$");
#include <netinet/tcp_var.h>
#include <netinet/tcp_hpts.h>
#include <netinet/tcpip.h>
#ifdef TCPDEBUG
#include <netinet/tcp_debug.h>
#endif
#include <netinet/udp.h>
#include <netinet/udp_var.h>

View file

@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$");
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_kern_tls.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -103,7 +102,6 @@ __FBSDID("$FreeBSD$");
#ifdef TCPPCAP
#include <netinet/tcp_pcap.h>
#endif
#include <netinet/tcp_debug.h>
#ifdef TCP_OFFLOAD
#include <netinet/tcp_offload.h>
#endif
@ -133,17 +131,6 @@ static void tcp_fill_info(struct tcpcb *, struct tcp_info *);
static int tcp_pru_options_support(struct tcpcb *tp, int flags);
#ifdef TCPDEBUG
#define TCPDEBUG0 int ostate = 0
#define TCPDEBUG1() ostate = tp ? tp->t_state : 0
#define TCPDEBUG2(req) if (tp && (so->so_options & SO_DEBUG)) \
tcp_trace(TA_USER, ostate, tp, 0, 0, req)
#else
#define TCPDEBUG0
#define TCPDEBUG1()
#define TCPDEBUG2(req)
#endif
/*
* tcp_require_unique port requires a globally-unique source port for each
* outgoing connection. The default is to require the 4-tuple to be unique.
@ -164,11 +151,9 @@ tcp_usr_attach(struct socket *so, int proto, struct thread *td)
struct inpcb *inp;
struct tcpcb *tp = NULL;
int error;
TCPDEBUG0;
inp = sotoinpcb(so);
KASSERT(inp == NULL, ("tcp_usr_attach: inp != NULL"));
TCPDEBUG1();
error = soreserve(so, V_tcp_sendspace, V_tcp_recvspace);
if (error)
@ -191,7 +176,6 @@ tcp_usr_attach(struct socket *so, int proto, struct thread *td)
INP_WUNLOCK(inp);
TCPSTATES_INC(TCPS_CLOSED);
out:
TCPDEBUG2(PRU_ATTACH);
TCP_PROBE2(debug__user, tp, PRU_ATTACH);
return (error);
}
@ -260,7 +244,6 @@ tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
if (IN_MULTICAST(ntohl(sinp->sin_addr.s_addr)))
return (EAFNOSUPPORT);
TCPDEBUG0;
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_bind: inp == NULL"));
INP_WLOCK(inp);
@ -271,12 +254,10 @@ tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
#ifdef KDTRACE_HOOKS
tp = intotcpcb(inp);
#endif
TCPDEBUG1();
INP_HASH_WLOCK(&V_tcbinfo);
error = in_pcbbind(inp, nam, td->td_ucred);
INP_HASH_WUNLOCK(&V_tcbinfo);
out:
TCPDEBUG2(PRU_BIND);
TCP_PROBE2(debug__user, tp, PRU_BIND);
INP_WUNLOCK(inp);
@ -309,7 +290,6 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
return (EAFNOSUPPORT);
TCPDEBUG0;
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL"));
INP_WLOCK(inp);
@ -321,7 +301,6 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
#ifdef KDTRACE_HOOKS
tp = intotcpcb(inp);
#endif
TCPDEBUG1();
INP_HASH_WLOCK(&V_tcbinfo);
inp->inp_vflag &= ~INP_IPV4;
inp->inp_vflag |= INP_IPV6;
@ -352,7 +331,6 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
out:
if (error != 0)
inp->inp_vflag = vflagsav;
TCPDEBUG2(PRU_BIND);
TCP_PROBE2(debug__user, tp, PRU_BIND);
INP_WUNLOCK(inp);
return (error);
@ -370,7 +348,6 @@ tcp_usr_listen(struct socket *so, int backlog, struct thread *td)
struct inpcb *inp;
struct tcpcb *tp = NULL;
TCPDEBUG0;
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_listen: inp == NULL"));
INP_WLOCK(inp);
@ -379,7 +356,6 @@ tcp_usr_listen(struct socket *so, int backlog, struct thread *td)
goto out;
}
tp = intotcpcb(inp);
TCPDEBUG1();
SOCK_LOCK(so);
error = solisten_proto_check(so);
if (error != 0) {
@ -407,7 +383,6 @@ tcp_usr_listen(struct socket *so, int backlog, struct thread *td)
tp->t_tfo_pending = tcp_fastopen_alloc_counter();
out:
TCPDEBUG2(PRU_LISTEN);
TCP_PROBE2(debug__user, tp, PRU_LISTEN);
INP_WUNLOCK(inp);
return (error);
@ -423,7 +398,6 @@ tcp6_usr_listen(struct socket *so, int backlog, struct thread *td)
struct tcpcb *tp = NULL;
u_char vflagsav;
TCPDEBUG0;
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp6_usr_listen: inp == NULL"));
INP_WLOCK(inp);
@ -433,7 +407,6 @@ tcp6_usr_listen(struct socket *so, int backlog, struct thread *td)
}
vflagsav = inp->inp_vflag;
tp = intotcpcb(inp);
TCPDEBUG1();
SOCK_LOCK(so);
error = solisten_proto_check(so);
if (error != 0) {
@ -467,7 +440,6 @@ tcp6_usr_listen(struct socket *so, int backlog, struct thread *td)
inp->inp_vflag = vflagsav;
out:
TCPDEBUG2(PRU_LISTEN);
TCP_PROBE2(debug__user, tp, PRU_LISTEN);
INP_WUNLOCK(inp);
return (error);
@ -507,7 +479,6 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
if ((error = prison_remote_ip4(td->td_ucred, &sinp->sin_addr)) != 0)
return (error);
TCPDEBUG0;
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_connect: inp == NULL"));
INP_WLOCK(inp);
@ -520,7 +491,6 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
goto out;
}
tp = intotcpcb(inp);
TCPDEBUG1();
NET_EPOCH_ENTER(et);
if ((error = tcp_connect(tp, nam, td)) != 0)
goto out_in_epoch;
@ -537,7 +507,6 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
out_in_epoch:
NET_EPOCH_EXIT(et);
out:
TCPDEBUG2(PRU_CONNECT);
TCP_PROBE2(debug__user, tp, PRU_CONNECT);
INP_WUNLOCK(inp);
return (error);
@ -556,8 +525,6 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
u_int8_t incflagsav;
u_char vflagsav;
TCPDEBUG0;
sin6 = (struct sockaddr_in6 *)nam;
if (nam->sa_family != AF_INET6)
return (EAFNOSUPPORT);
@ -584,7 +551,6 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
goto out;
}
tp = intotcpcb(inp);
TCPDEBUG1();
#ifdef INET
/*
* XXXRW: Some confusion: V4/V6 flags relate to binding, and
@ -665,7 +631,6 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
inp->inp_inc.inc_flags = incflagsav;
}
TCPDEBUG2(PRU_CONNECT);
TCP_PROBE2(debug__user, tp, PRU_CONNECT);
INP_WUNLOCK(inp);
return (error);
@ -691,7 +656,6 @@ tcp_usr_disconnect(struct socket *so)
struct epoch_tracker et;
int error = 0;
TCPDEBUG0;
NET_EPOCH_ENTER(et);
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_disconnect: inp == NULL"));
@ -701,10 +665,8 @@ tcp_usr_disconnect(struct socket *so)
goto out;
}
tp = intotcpcb(inp);
TCPDEBUG1();
tcp_disconnect(tp);
out:
TCPDEBUG2(PRU_DISCONNECT);
TCP_PROBE2(debug__user, tp, PRU_DISCONNECT);
INP_WUNLOCK(inp);
NET_EPOCH_EXIT(et);
@ -726,7 +688,6 @@ tcp_usr_accept(struct socket *so, struct sockaddr **nam)
#endif
struct in_addr addr;
in_port_t port = 0;
TCPDEBUG0;
if (so->so_state & SS_ISDISCONNECTED)
return (ECONNABORTED);
@ -741,7 +702,6 @@ tcp_usr_accept(struct socket *so, struct sockaddr **nam)
#ifdef KDTRACE_HOOKS
tp = intotcpcb(inp);
#endif
TCPDEBUG1();
/*
* We inline in_getpeeraddr and COMMON_END here, so that we can
@ -752,7 +712,6 @@ tcp_usr_accept(struct socket *so, struct sockaddr **nam)
addr = inp->inp_faddr;
out:
TCPDEBUG2(PRU_ACCEPT);
TCP_PROBE2(debug__user, tp, PRU_ACCEPT);
INP_WUNLOCK(inp);
if (error == 0)
@ -775,7 +734,6 @@ tcp6_usr_accept(struct socket *so, struct sockaddr **nam)
struct epoch_tracker et;
in_port_t port = 0;
int v4 = 0;
TCPDEBUG0;
if (so->so_state & SS_ISDISCONNECTED)
return (ECONNABORTED);
@ -791,7 +749,6 @@ tcp6_usr_accept(struct socket *so, struct sockaddr **nam)
#ifdef KDTRACE_HOOKS
tp = intotcpcb(inp);
#endif
TCPDEBUG1();
/*
* We inline in6_mapped_peeraddr and COMMON_END here, so that we can
@ -808,7 +765,6 @@ tcp6_usr_accept(struct socket *so, struct sockaddr **nam)
}
out:
TCPDEBUG2(PRU_ACCEPT);
TCP_PROBE2(debug__user, tp, PRU_ACCEPT);
INP_WUNLOCK(inp);
NET_EPOCH_EXIT(et);
@ -833,7 +789,6 @@ tcp_usr_shutdown(struct socket *so)
struct tcpcb *tp = NULL;
struct epoch_tracker et;
TCPDEBUG0;
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("inp == NULL"));
INP_WLOCK(inp);
@ -843,12 +798,10 @@ tcp_usr_shutdown(struct socket *so)
}
tp = intotcpcb(inp);
NET_EPOCH_ENTER(et);
TCPDEBUG1();
socantsendmore(so);
tcp_usrclosed(tp);
if (!(inp->inp_flags & INP_DROPPED))
error = tcp_output_nodrop(tp);
TCPDEBUG2(PRU_SHUTDOWN);
TCP_PROBE2(debug__user, tp, PRU_SHUTDOWN);
error = tcp_unlock_or_drop(tp, error);
NET_EPOCH_EXIT(et);
@ -867,7 +820,6 @@ tcp_usr_rcvd(struct socket *so, int flags)
struct tcpcb *tp = NULL;
int outrv = 0, error = 0;
TCPDEBUG0;
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_rcvd: inp == NULL"));
INP_WLOCK(inp);
@ -877,7 +829,6 @@ tcp_usr_rcvd(struct socket *so, int flags)
}
tp = intotcpcb(inp);
NET_EPOCH_ENTER(et);
TCPDEBUG1();
/*
* For passively-created TFO connections, don't attempt a window
* update while still in SYN_RECEIVED as this may trigger an early
@ -895,7 +846,6 @@ tcp_usr_rcvd(struct socket *so, int flags)
#endif
outrv = tcp_output_nodrop(tp);
out:
TCPDEBUG2(PRU_RCVD);
TCP_PROBE2(debug__user, tp, PRU_RCVD);
(void) tcp_unlock_or_drop(tp, outrv);
NET_EPOCH_EXIT(et);
@ -929,7 +879,6 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m,
u_int8_t incflagsav;
u_char vflagsav;
bool restoreflags;
TCPDEBUG0;
if (control != NULL) {
/* TCP doesn't do control messages (rights, creds, etc) */
@ -960,7 +909,6 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m,
(error = tcp_pru_options_support(tp, PRUS_OOB)) != 0)
goto out;
TCPDEBUG1();
if (nam != NULL && tp->t_state < TCPS_SYN_SENT) {
if (tp->t_state == TCPS_LISTEN) {
error = EINVAL;
@ -1222,8 +1170,6 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m,
inp->inp_vflag = vflagsav;
inp->inp_inc.inc_flags = incflagsav;
}
TCPDEBUG2((flags & PRUS_OOB) ? PRU_SENDOOB :
((flags & PRUS_EOF) ? PRU_SEND_EOF : PRU_SEND));
TCP_PROBE2(debug__user, tp, (flags & PRUS_OOB) ? PRU_SENDOOB :
((flags & PRUS_EOF) ? PRU_SEND_EOF : PRU_SEND));
error = tcp_unlock_or_drop(tp, error);
@ -1271,7 +1217,6 @@ tcp_usr_abort(struct socket *so)
struct inpcb *inp;
struct tcpcb *tp = NULL;
struct epoch_tracker et;
TCPDEBUG0;
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_abort: inp == NULL"));
@ -1286,11 +1231,9 @@ tcp_usr_abort(struct socket *so)
*/
if (!(inp->inp_flags & INP_DROPPED)) {
tp = intotcpcb(inp);
TCPDEBUG1();
tp = tcp_drop(tp, ECONNABORTED);
if (tp == NULL)
goto dropped;
TCPDEBUG2(PRU_ABORT);
TCP_PROBE2(debug__user, tp, PRU_ABORT);
}
if (!(inp->inp_flags & INP_DROPPED)) {
@ -1311,7 +1254,6 @@ tcp_usr_close(struct socket *so)
struct inpcb *inp;
struct tcpcb *tp = NULL;
struct epoch_tracker et;
TCPDEBUG0;
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_close: inp == NULL"));
@ -1328,9 +1270,7 @@ tcp_usr_close(struct socket *so)
if (!(inp->inp_flags & INP_DROPPED)) {
tp = intotcpcb(inp);
tp->t_flags |= TF_CLOSED;
TCPDEBUG1();
tcp_disconnect(tp);
TCPDEBUG2(PRU_CLOSE);
TCP_PROBE2(debug__user, tp, PRU_CLOSE);
}
if (!(inp->inp_flags & INP_DROPPED)) {
@ -1369,7 +1309,6 @@ tcp_usr_rcvoob(struct socket *so, struct mbuf *m, int flags)
struct inpcb *inp;
struct tcpcb *tp = NULL;
TCPDEBUG0;
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_rcvoob: inp == NULL"));
INP_WLOCK(inp);
@ -1382,7 +1321,6 @@ tcp_usr_rcvoob(struct socket *so, struct mbuf *m, int flags)
if (error) {
goto out;
}
TCPDEBUG1();
if ((so->so_oobmark == 0 &&
(so->so_rcv.sb_state & SBS_RCVATMARK) == 0) ||
so->so_options & SO_OOBINLINE ||
@ -1400,7 +1338,6 @@ tcp_usr_rcvoob(struct socket *so, struct mbuf *m, int flags)
tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA);
out:
TCPDEBUG2(PRU_RCVOOB);
TCP_PROBE2(debug__user, tp, PRU_RCVOOB);
INP_WUNLOCK(inp);
return (error);

View file

@ -69,7 +69,6 @@ static const char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93";
#include <netinet/tcp_timer.h>
#define _WANT_TCPCB
#include <netinet/tcp_var.h>
#include <netinet/tcp_debug.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>