tcp: add some debug output

Also log, when dropping text or FIN after having received a FIN.
This is the intended behavior described in RFC 9293.
A follow-up patch will enforce this behavior for the base stack
and the RACK stack.
Reviewed by:		rscheff
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44669
This commit is contained in:
Michael Tuexen 2024-04-07 22:41:24 +02:00
parent 4c983a2886
commit e8c149ab85

View file

@ -3272,6 +3272,35 @@ tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th,
len = so->so_rcv.sb_hiwat;
#endif
} else {
if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
if (tlen > 0) {
if ((thflags & TH_FIN) != 0) {
log(LOG_DEBUG, "%s; %s: %s: "
"Received %d bytes of data and FIN "
"after having received a FIN, "
"just dropping both\n",
s, __func__,
tcpstates[tp->t_state], tlen);
} else {
log(LOG_DEBUG, "%s; %s: %s: "
"Received %d bytes of data "
"after having received a FIN, "
"just dropping it\n",
s, __func__,
tcpstates[tp->t_state], tlen);
}
} else {
if ((thflags & TH_FIN) != 0) {
log(LOG_DEBUG, "%s; %s: %s: "
"Received FIN "
"after having received a FIN, "
"just dropping it\n",
s, __func__,
tcpstates[tp->t_state]);
}
}
free(s, M_TCPLOG);
}
m_freem(m);
thflags &= ~TH_FIN;
}