From 88c7bba592d07711248e3f377659d48df9cb4d22 Mon Sep 17 00:00:00 2001 From: harti Date: Wed, 13 Aug 2003 08:46:54 +0000 Subject: [PATCH] A number of patches in the last years have created new return paths in tcp_input that leave the function before hitting the tcp_trace function call for the TCPDEBUG option. This has made TCPDEBUG mostly useless (and tools like ports/benchmarks/dbs not working). Add tcp_trace calls to the return paths that could be identified in this maze. This is a NOP unless you compile with TCPDEBUG. --- sys/netinet/tcp_input.c | 21 +++++++++++++++++++++ sys/netinet/tcp_reass.c | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index a58e83041daa..54a87bc350af 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -445,6 +445,10 @@ tcp_input(m, off0) ip->ip_len + IPPROTO_TCP)); th->th_sum ^= 0xffff; +#ifdef TCPDEBUG + ipov->ih_len = (u_short)tlen; + ipov->ih_len = htons(ipov->ih_len); +#endif } else { /* * Checksum extended TCP header and data. @@ -864,6 +868,11 @@ tcp_input(m, off0) * for syncache, or perform t/tcp connection. */ if (so->so_qlen <= so->so_qlimit) { +#ifdef TCPDEBUG + if (so->so_options & SO_DEBUG) + tcp_trace(TA_INPUT, ostate, tp, + (void *)tcp_saveipgen, &tcp_savetcp, 0); +#endif tcp_dooptions(&to, optp, optlen, 1); if (!syncache_add(&inc, &to, th, &so, m)) goto drop; @@ -1058,6 +1067,13 @@ tcp_input(m, off0) * wakeup/selwakeup/signal. 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 (tp->snd_una == tp->snd_max) callout_stop(tp->tt_rexmt); @@ -1097,6 +1113,11 @@ tcp_input(m, off0) tcpstat.tcps_rcvbyte += tlen; ND6_HINT(tp); /* some progress has been done */ /* +#ifdef TCPDEBUG + if (so->so_options & SO_DEBUG) + tcp_trace(TA_INPUT, ostate, tp, + (void *)tcp_saveipgen, &tcp_savetcp, 0); +#endif * Add data to socket buffer. */ if (so->so_state & SS_CANTRCVMORE) { diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index a58e83041daa..54a87bc350af 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -445,6 +445,10 @@ tcp_input(m, off0) ip->ip_len + IPPROTO_TCP)); th->th_sum ^= 0xffff; +#ifdef TCPDEBUG + ipov->ih_len = (u_short)tlen; + ipov->ih_len = htons(ipov->ih_len); +#endif } else { /* * Checksum extended TCP header and data. @@ -864,6 +868,11 @@ tcp_input(m, off0) * for syncache, or perform t/tcp connection. */ if (so->so_qlen <= so->so_qlimit) { +#ifdef TCPDEBUG + if (so->so_options & SO_DEBUG) + tcp_trace(TA_INPUT, ostate, tp, + (void *)tcp_saveipgen, &tcp_savetcp, 0); +#endif tcp_dooptions(&to, optp, optlen, 1); if (!syncache_add(&inc, &to, th, &so, m)) goto drop; @@ -1058,6 +1067,13 @@ tcp_input(m, off0) * wakeup/selwakeup/signal. 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 (tp->snd_una == tp->snd_max) callout_stop(tp->tt_rexmt); @@ -1097,6 +1113,11 @@ tcp_input(m, off0) tcpstat.tcps_rcvbyte += tlen; ND6_HINT(tp); /* some progress has been done */ /* +#ifdef TCPDEBUG + if (so->so_options & SO_DEBUG) + tcp_trace(TA_INPUT, ostate, tp, + (void *)tcp_saveipgen, &tcp_savetcp, 0); +#endif * Add data to socket buffer. */ if (so->so_state & SS_CANTRCVMORE) {