aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_pcb.c159
-rw-r--r--sys/netinet/in_pcb.h24
-rw-r--r--sys/netinet/tcp_input.c5
-rw-r--r--sys/netinet/tcp_syncache.c17
-rw-r--r--sys/netinet/tcp_syncache.h1
-rw-r--r--sys/netinet/tcp_usrreq.c286
-rw-r--r--sys/netinet/tcp_var.h29
7 files changed, 85 insertions, 436 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 712ff28768dc..b7dae78fb2c2 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -3058,143 +3058,7 @@ db_print_inconninfo(struct in_conninfo *inc, const char *name, int indent)
ntohs(inc->inc_fport));
}
-static void
-db_print_inpflags(int inp_flags)
-{
- int comma;
-
- comma = 0;
- if (inp_flags & INP_RECVOPTS) {
- db_printf("%sINP_RECVOPTS", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_RECVRETOPTS) {
- db_printf("%sINP_RECVRETOPTS", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_RECVDSTADDR) {
- db_printf("%sINP_RECVDSTADDR", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_ORIGDSTADDR) {
- db_printf("%sINP_ORIGDSTADDR", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_HDRINCL) {
- db_printf("%sINP_HDRINCL", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_HIGHPORT) {
- db_printf("%sINP_HIGHPORT", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_LOWPORT) {
- db_printf("%sINP_LOWPORT", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_ANONPORT) {
- db_printf("%sINP_ANONPORT", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_RECVIF) {
- db_printf("%sINP_RECVIF", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_MTUDISC) {
- db_printf("%sINP_MTUDISC", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_RECVTTL) {
- db_printf("%sINP_RECVTTL", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_DONTFRAG) {
- db_printf("%sINP_DONTFRAG", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_RECVTOS) {
- db_printf("%sINP_RECVTOS", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & IN6P_IPV6_V6ONLY) {
- db_printf("%sIN6P_IPV6_V6ONLY", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & IN6P_PKTINFO) {
- db_printf("%sIN6P_PKTINFO", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & IN6P_HOPLIMIT) {
- db_printf("%sIN6P_HOPLIMIT", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & IN6P_HOPOPTS) {
- db_printf("%sIN6P_HOPOPTS", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & IN6P_DSTOPTS) {
- db_printf("%sIN6P_DSTOPTS", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & IN6P_RTHDR) {
- db_printf("%sIN6P_RTHDR", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & IN6P_RTHDRDSTOPTS) {
- db_printf("%sIN6P_RTHDRDSTOPTS", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & IN6P_TCLASS) {
- db_printf("%sIN6P_TCLASS", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & IN6P_AUTOFLOWLABEL) {
- db_printf("%sIN6P_AUTOFLOWLABEL", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_ONESBCAST) {
- db_printf("%sINP_ONESBCAST", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_DROPPED) {
- db_printf("%sINP_DROPPED", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & INP_SOCKREF) {
- db_printf("%sINP_SOCKREF", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & IN6P_RFC2292) {
- db_printf("%sIN6P_RFC2292", comma ? ", " : "");
- comma = 1;
- }
- if (inp_flags & IN6P_MTU) {
- db_printf("IN6P_MTU%s", comma ? ", " : "");
- comma = 1;
- }
-}
-
-static void
-db_print_inpvflag(u_char inp_vflag)
-{
- int comma;
-
- comma = 0;
- if (inp_vflag & INP_IPV4) {
- db_printf("%sINP_IPV4", comma ? ", " : "");
- comma = 1;
- }
- if (inp_vflag & INP_IPV6) {
- db_printf("%sINP_IPV6", comma ? ", " : "");
- comma = 1;
- }
- if (inp_vflag & INP_IPV6PROTO) {
- db_printf("%sINP_IPV6PROTO", comma ? ", " : "");
- comma = 1;
- }
-}
-
-static void
+void
db_print_inpcb(struct inpcb *inp, const char *name, int indent)
{
@@ -3204,38 +3068,39 @@ db_print_inpcb(struct inpcb *inp, const char *name, int indent)
indent += 2;
db_print_indent(indent);
- db_printf("inp_flow: 0x%x\n", inp->inp_flow);
+ db_printf("inp_flow: 0x%x inp_label: %p\n", inp->inp_flow,
+ inp->inp_label);
db_print_inconninfo(&inp->inp_inc, "inp_conninfo", indent);
db_print_indent(indent);
- db_printf("inp_label: %p inp_flags: 0x%x (",
- inp->inp_label, inp->inp_flags);
- db_print_inpflags(inp->inp_flags);
- db_printf(")\n");
+ db_printf("inp_flags: 0x%b\n", inp->inp_flags, INP_FLAGS_BITS);
db_print_indent(indent);
- db_printf("inp_sp: %p inp_vflag: 0x%x (", inp->inp_sp,
- inp->inp_vflag);
- db_print_inpvflag(inp->inp_vflag);
- db_printf(")\n");
+ db_printf("inp_flags2: 0x%b\n", inp->inp_flags2, INP_FLAGS2_BITS);
+
+ db_print_indent(indent);
+ db_printf("inp_sp: %p inp_vflag: 0x%b\n", inp->inp_sp,
+ inp->inp_vflag, INP_VFLAGS_BITS);
db_print_indent(indent);
db_printf("inp_ip_ttl: %d inp_ip_p: %d inp_ip_minttl: %d\n",
inp->inp_ip_ttl, inp->inp_ip_p, inp->inp_ip_minttl);
- db_print_indent(indent);
#ifdef INET6
if (inp->inp_vflag & INP_IPV6) {
+ db_print_indent(indent);
db_printf("in6p_options: %p in6p_outputopts: %p "
"in6p_moptions: %p\n", inp->in6p_options,
inp->in6p_outputopts, inp->in6p_moptions);
+ db_print_indent(indent);
db_printf("in6p_icmp6filt: %p in6p_cksum %d "
"in6p_hops %u\n", inp->in6p_icmp6filt, inp->in6p_cksum,
inp->in6p_hops);
} else
#endif
{
+ db_print_indent(indent);
db_printf("inp_ip_tos: %d inp_ip_options: %p "
"inp_ip_moptions: %p\n", inp->inp_ip_tos,
inp->inp_options, inp->inp_moptions);
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 9e0618e87601..975b8129c70d 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -539,6 +539,9 @@ void inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp,
#define INP_IPV6 0x2
#define INP_IPV6PROTO 0x4 /* opened under IPv6 protocol */
+/* inp_vflags description for use with printf(9) %b identifier. */
+#define INP_VFLAGS_BITS "\20\1INP_IPV4\2INP_IPV6\3INP_IPV6PROTO"
+
/*
* Flags for inp_flags.
*/
@@ -582,6 +585,17 @@ void inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp,
IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\
IN6P_MTU)
+/* inp_flags description for use with printf(9) %b identifier. */
+#define INP_FLAGS_BITS "\20" \
+ "\1INP_RECVOPTS\2INP_RECVRETOPTS\3INP_RECVDSTADDR\4INP_HDRINCL" \
+ "\5INP_HIGHPORT\6INP_LOWPORT\7INP_ANONPORT\10INP_RECVIF" \
+ "\11INP_MTUDISC\12INP_FREED\13INP_RECVTTL\14INP_DONTFRAG" \
+ "\15INP_BINDANY\16INP_INHASHLIST\17INP_RECVTOS\20IN6P_IPV6_V6ONLY" \
+ "\21IN6P_PKTINFO\22IN6P_HOPLIMIT\23IN6P_HOPOPTS\24IN6P_DSTOPTS" \
+ "\25IN6P_RTHDR\26IN6P_RTHDRDSTOPTS\27IN6P_TCLASS\30IN6P_AUTOFLOWLABEL" \
+ "\31INP_INLBGROUP\32INP_ONESBCAST\33INP_DROPPED\34INP_SOCKREF" \
+ "\35INP_RESERVED_0\36INP_BOUNDFIB\37IN6P_RFC2292\40IN6P_MTU"
+
/*
* Flags for inp_flags2.
*/
@@ -610,6 +624,13 @@ void inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp,
#define INP_2PCP_MASK (INP_2PCP_BIT0 | INP_2PCP_BIT1 | INP_2PCP_BIT2)
#define INP_2PCP_SHIFT 18 /* shift PCP field in/out of inp_flags2 */
+/* inp_flags2 description for use with printf(9) %b identifier. */
+#define INP_FLAGS2_BITS "\20" \
+ "\11INP_RECVFLOWID\12INP_RECVRSSBUCKETID" \
+ "\13INP_RATE_LIMIT_CHANGED\14INP_ORIGDSTADDR" \
+ "\22INP_2PCP_SET\23INP_2PCP_BIT0\24INP_2PCP_BIT1" \
+ "\25INP_2PCP_BIT2"
+
/*
* Flags passed to in_pcblookup*(), inp_smr_lock() and inp_next().
*/
@@ -730,6 +751,9 @@ int in_pcbquery_txrlevel(struct inpcb *, uint32_t *);
void in_pcboutput_txrtlmt(struct inpcb *, struct ifnet *, struct mbuf *);
void in_pcboutput_eagain(struct inpcb *);
#endif
+#ifdef DDB
+void db_print_inpcb(struct inpcb *, const char *, int);
+#endif
#endif /* _KERNEL */
#endif /* !_NETINET_IN_PCB_H_ */
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 2146b0cac48f..9c58c2815d13 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1192,11 +1192,10 @@ tfo_socket_result:
if (thflags & TH_ACK) {
if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Listen socket: "
- "SYN|ACK invalid, segment rejected\n",
+ "SYN|ACK invalid, segment ignored\n",
s, __func__);
- syncache_badack(&inc, port); /* XXX: Not needed! */
TCPSTAT_INC(tcps_badsyn);
- goto dropwithreset;
+ goto dropunlock;
}
/*
* If the drop_synfin option is enabled, drop all
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 3a7755e9f09e..fa7035771714 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -713,23 +713,6 @@ done:
}
void
-syncache_badack(struct in_conninfo *inc, uint16_t port)
-{
- struct syncache *sc;
- struct syncache_head *sch;
-
- if (syncache_cookiesonly())
- return;
- sc = syncache_lookup(inc, &sch); /* returns locked sch */
- SCH_LOCK_ASSERT(sch);
- if ((sc != NULL) && (sc->sc_port == port)) {
- syncache_drop(sc, sch);
- TCPSTAT_INC(tcps_sc_badack);
- }
- SCH_UNLOCK(sch);
-}
-
-void
syncache_unreach(struct in_conninfo *inc, tcp_seq th_seq, uint16_t port)
{
struct syncache *sc;
diff --git a/sys/netinet/tcp_syncache.h b/sys/netinet/tcp_syncache.h
index 37f6ff3d6ca9..c916b4de6ae0 100644
--- a/sys/netinet/tcp_syncache.h
+++ b/sys/netinet/tcp_syncache.h
@@ -45,7 +45,6 @@ struct socket * syncache_add(struct in_conninfo *, struct tcpopt *,
void *, void *, uint8_t, uint16_t);
void syncache_chkrst(struct in_conninfo *, struct tcphdr *, struct mbuf *,
uint16_t);
-void syncache_badack(struct in_conninfo *, uint16_t);
int syncache_pcblist(struct sysctl_req *);
struct syncache {
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 98c934955121..4d1a6455d09e 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -2799,258 +2799,6 @@ db_print_tstate(int t_state)
}
static void
-db_print_tflags(u_int t_flags)
-{
- int comma;
-
- comma = 0;
- if (t_flags & TF_ACKNOW) {
- db_printf("%sTF_ACKNOW", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_DELACK) {
- db_printf("%sTF_DELACK", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_NODELAY) {
- db_printf("%sTF_NODELAY", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_NOOPT) {
- db_printf("%sTF_NOOPT", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_SENTFIN) {
- db_printf("%sTF_SENTFIN", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_REQ_SCALE) {
- db_printf("%sTF_REQ_SCALE", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_RCVD_SCALE) {
- db_printf("%sTF_RECVD_SCALE", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_REQ_TSTMP) {
- db_printf("%sTF_REQ_TSTMP", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_RCVD_TSTMP) {
- db_printf("%sTF_RCVD_TSTMP", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_SACK_PERMIT) {
- db_printf("%sTF_SACK_PERMIT", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_NEEDSYN) {
- db_printf("%sTF_NEEDSYN", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_NEEDFIN) {
- db_printf("%sTF_NEEDFIN", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_NOPUSH) {
- db_printf("%sTF_NOPUSH", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_PREVVALID) {
- db_printf("%sTF_PREVVALID", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_WAKESOR) {
- db_printf("%sTF_WAKESOR", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_GPUTINPROG) {
- db_printf("%sTF_GPUTINPROG", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_MORETOCOME) {
- db_printf("%sTF_MORETOCOME", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_SONOTCONN) {
- db_printf("%sTF_SONOTCONN", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_LASTIDLE) {
- db_printf("%sTF_LASTIDLE", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_RXWIN0SENT) {
- db_printf("%sTF_RXWIN0SENT", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_FASTRECOVERY) {
- db_printf("%sTF_FASTRECOVERY", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_WASFRECOVERY) {
- db_printf("%sTF_WASFRECOVERY", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_SIGNATURE) {
- db_printf("%sTF_SIGNATURE", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_FORCEDATA) {
- db_printf("%sTF_FORCEDATA", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_TSO) {
- db_printf("%sTF_TSO", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_TOE) {
- db_printf("%sTF_TOE", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_CLOSED) {
- db_printf("%sTF_CLOSED", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_SENTSYN) {
- db_printf("%sTF_SENTSYN", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_LRD) {
- db_printf("%sTF_LRD", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_CONGRECOVERY) {
- db_printf("%sTF_CONGRECOVERY", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_WASCRECOVERY) {
- db_printf("%sTF_WASCRECOVERY", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags & TF_FASTOPEN) {
- db_printf("%sTF_FASTOPEN", comma ? ", " : "");
- comma = 1;
- }
-}
-
-static void
-db_print_tflags2(u_int t_flags2)
-{
- int comma;
-
- comma = 0;
- if (t_flags2 & TF2_PLPMTU_BLACKHOLE) {
- db_printf("%sTF2_PLPMTU_BLACKHOLE", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_PLPMTU_PMTUD) {
- db_printf("%sTF2_PLPMTU_PMTUD", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_PLPMTU_MAXSEGSNT) {
- db_printf("%sTF2_PLPMTU_MAXSEGSNT", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_LOG_AUTO) {
- db_printf("%sTF2_LOG_AUTO", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_DROP_AF_DATA) {
- db_printf("%sTF2_DROP_AF_DATA", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_ECN_PERMIT) {
- db_printf("%sTF2_ECN_PERMIT", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_ECN_SND_CWR) {
- db_printf("%sTF2_ECN_SND_CWR", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_ECN_SND_ECE) {
- db_printf("%sTF2_ECN_SND_ECE", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_ACE_PERMIT) {
- db_printf("%sTF2_ACE_PERMIT", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_HPTS_CPU_SET) {
- db_printf("%sTF2_HPTS_CPU_SET", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_FBYTES_COMPLETE) {
- db_printf("%sTF2_FBYTES_COMPLETE", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_ECN_USE_ECT1) {
- db_printf("%sTF2_ECN_USE_ECT1", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_TCP_ACCOUNTING) {
- db_printf("%sTF2_TCP_ACCOUNTING", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_HPTS_CALLS) {
- db_printf("%sTF2_HPTS_CALLS", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_MBUF_L_ACKS) {
- db_printf("%sTF2_MBUF_L_ACKS", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_MBUF_ACKCMP) {
- db_printf("%sTF2_MBUF_ACKCMP", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_SUPPORTS_MBUFQ) {
- db_printf("%sTF2_SUPPORTS_MBUFQ", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_MBUF_QUEUE_READY) {
- db_printf("%sTF2_MBUF_QUEUE_READY", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_DONT_SACK_QUEUE) {
- db_printf("%sTF2_DONT_SACK_QUEUE", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_CANNOT_DO_ECN) {
- db_printf("%sTF2_CANNOT_DO_ECN", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_PROC_SACK_PROHIBIT) {
- db_printf("%sTF2_PROC_SACK_PROHIBIT", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_IPSEC_TSO) {
- db_printf("%sTF2_IPSEC_TSO", comma ? ", " : "");
- comma = 1;
- }
- if (t_flags2 & TF2_NO_ISS_CHECK) {
- db_printf("%sTF2_NO_ISS_CHECK", comma ? ", " : "");
- comma = 1;
- }
-}
-
-static void
-db_print_toobflags(char t_oobflags)
-{
- int comma;
-
- comma = 0;
- if (t_oobflags & TCPOOB_HAVEDATA) {
- db_printf("%sTCPOOB_HAVEDATA", comma ? ", " : "");
- comma = 1;
- }
- if (t_oobflags & TCPOOB_HADDATA) {
- db_printf("%sTCPOOB_HADDATA", comma ? ", " : "");
- comma = 1;
- }
-}
-
-static void
db_print_bblog_state(int state)
{
switch (state) {
@@ -3088,7 +2836,8 @@ db_print_bblog_state(int state)
}
static void
-db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog)
+db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog,
+ bool show_inpcb)
{
db_print_indent(indent);
@@ -3096,6 +2845,9 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog)
indent += 2;
+ if (show_inpcb)
+ db_print_inpcb(tptoinpcb(tp), "t_inpcb", indent);
+
db_print_indent(indent);
db_printf("t_segq first: %p t_segqlen: %d t_dupacks: %d\n",
TAILQ_FIRST(&tp->t_segq), tp->t_segqlen, tp->t_dupacks);
@@ -3110,14 +2862,10 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog)
db_printf(")\n");
db_print_indent(indent);
- db_printf("t_flags: 0x%x (", tp->t_flags);
- db_print_tflags(tp->t_flags);
- db_printf(")\n");
+ db_printf("t_flags: 0x%b\n", tp->t_flags, TF_BITS);
db_print_indent(indent);
- db_printf("t_flags2: 0x%x (", tp->t_flags2);
- db_print_tflags2(tp->t_flags2);
- db_printf(")\n");
+ db_printf("t_flags2: 0x%b\n", tp->t_flags2, TF2_BITS);
db_print_indent(indent);
db_printf("snd_una: 0x%08x snd_max: 0x%08x snd_nxt: 0x%08x\n",
@@ -3164,9 +2912,8 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog)
tp->t_rttupdated, tp->max_sndwnd, tp->t_softerror);
db_print_indent(indent);
- db_printf("t_oobflags: 0x%x (", tp->t_oobflags);
- db_print_toobflags(tp->t_oobflags);
- db_printf(") t_iobc: 0x%02x\n", tp->t_iobc);
+ db_printf("t_oobflags: 0x%b t_iobc: 0x%02x\n", tp->t_oobflags,
+ TCPOOB_BITS, tp->t_iobc);
db_print_indent(indent);
db_printf("snd_scale: %u rcv_scale: %u request_r_scale: %u\n",
@@ -3227,33 +2974,36 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog)
DB_SHOW_COMMAND(tcpcb, db_show_tcpcb)
{
struct tcpcb *tp;
- bool show_bblog;
+ bool show_bblog, show_inpcb;
if (!have_addr) {
- db_printf("usage: show tcpcb <addr>\n");
+ db_printf("usage: show tcpcb[/bi] <addr>\n");
return;
}
show_bblog = strchr(modif, 'b') != NULL;
+ show_inpcb = strchr(modif, 'i') != NULL;
tp = (struct tcpcb *)addr;
-
- db_print_tcpcb(tp, "tcpcb", 0, show_bblog);
+ db_print_tcpcb(tp, "tcpcb", 0, show_bblog, show_inpcb);
}
DB_SHOW_ALL_COMMAND(tcpcbs, db_show_all_tcpcbs)
{
VNET_ITERATOR_DECL(vnet_iter);
struct inpcb *inp;
- bool only_locked, show_bblog;
+ struct tcpcb *tp;
+ bool only_locked, show_bblog, show_inpcb;
only_locked = strchr(modif, 'l') != NULL;
show_bblog = strchr(modif, 'b') != NULL;
+ show_inpcb = strchr(modif, 'i') != NULL;
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
CK_LIST_FOREACH(inp, &V_tcbinfo.ipi_listhead, inp_list) {
if (only_locked &&
inp->inp_lock.rw_lock == RW_UNLOCKED)
continue;
- db_print_tcpcb(intotcpcb(inp), "tcpcb", 0, show_bblog);
+ tp = intotcpcb(inp);
+ db_print_tcpcb(tp, "tcpcb", 0, show_bblog, show_inpcb);
if (db_pager_quit)
break;
}
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index c3be95c80798..f9297be46af7 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -795,6 +795,17 @@ tcp_packets_this_ack(struct tcpcb *tp, tcp_seq ack)
#define TF_WASCRECOVERY 0x40000000 /* was in congestion recovery */
#define TF_FASTOPEN 0x80000000 /* TCP Fast Open indication */
+/* t_flags description for use with printf(9) %b identifier. */
+#define TF_BITS "\20" \
+ "\1TF_ACKNOW\2TF_DELACK\3TF_NODELAY\4TF_NOOPT" \
+ "\5TF_SENTFIN\6TF_REQ_SCALE\7TF_RCVD_SCALE\10TF_REQ_TSTMP" \
+ "\11TF_RCVD_TSTMP\12TF_SACK_PERMIT\13TF_NEEDSYN\14TF_NEEDFIN" \
+ "\15TF_NOPUSH\16TF_PREVVALID\17TF_WAKESOR\20TF_GPUTINPROG" \
+ "\21TF_MORETOCOME\22TF_SONOTCONN\23TF_LASTIDLE\24TF_RXWIN0SENT" \
+ "\25TF_FASTRECOVERY\26TF_WASFRECOVERY\27TF_SIGNATURE\30TF_FORCEDATA" \
+ "\31TF_TSO\32TF_TOE\33TF_CLOSED\34TF_SENTSYN" \
+ "\35TF_LRD\36TF_CONGRECOVERY\37TF_WASCRECOVERY\40TF_FASTOPEN"
+
#define IN_FASTRECOVERY(t_flags) (t_flags & TF_FASTRECOVERY)
#define ENTER_FASTRECOVERY(t_flags) t_flags |= TF_FASTRECOVERY
#define EXIT_FASTRECOVERY(t_flags) t_flags &= ~TF_FASTRECOVERY
@@ -815,6 +826,9 @@ tcp_packets_this_ack(struct tcpcb *tp, tcp_seq ack)
#define TCPOOB_HAVEDATA 0x01
#define TCPOOB_HADDATA 0x02
+/* t_oobflags description for use with printf(9) %b identifier. */
+#define TCPOOB_BITS "\20\1TCPOOB_HAVEDATA\2TCPOOB_HADDATA"
+
/*
* Flags for the extended TCP flags field, t_flags2
*/
@@ -842,6 +856,21 @@ tcp_packets_this_ack(struct tcpcb *tp, tcp_seq ack)
#define TF2_IPSEC_TSO 0x00200000 /* IPSEC + TSO supported */
#define TF2_NO_ISS_CHECK 0x00400000 /* Don't check SEG.ACK against ISS */
+/* t_flags2 description for use with printf(9) %b identifier. */
+#define TF2_BITS "\20" \
+ "\1TF2_PLPMTU_BLACKHOLE\2TF2_PLPMTU_PMTUD" \
+ "\3TF2_PLPMTU_MAXSEGSNT\4TF2_LOG_AUTO" \
+ "\5TF2_DROP_AF_DATA\6TF2_ECN_PERMIT" \
+ "\7TF2_ECN_SND_CWR\10TF2_ECN_SND_ECE" \
+ "\11TF2_ACE_PERMIT\12TF2_HPTS_CPU_SET" \
+ "\13TF2_FBYTES_COMPLETE\14TF2_ECN_USE_ECT1" \
+ "\15TF2_TCP_ACCOUNTING\16TF2_HPTS_CALLS" \
+ "\17TF2_MBUF_L_ACKS\20TF2_MBUF_ACKCMP" \
+ "\21TF2_SUPPORTS_MBUFQ\22TF2_MBUF_QUEUE_READY" \
+ "\23TF2_DONT_SACK_QUEUE\24TF2_CANNOT_DO_ECN" \
+ "\25TF2_PROC_SACK_PROHIBIT\26TF2_IPSEC_TSO" \
+ "\27TF2_NO_ISS_CHECK"
+
/*
* Structure to hold TCP options that are only used during segment
* processing (in tcp_input), but not held in the tcpcb.