diff options
author | 2018-05-10 13:30:25 +0000 | |
---|---|---|
committer | 2018-05-10 13:30:25 +0000 | |
commit | 36d7e348842069f02503ea4ec0b5b49506982214 (patch) | |
tree | 9a6e2d8ab006208fd17c1c7f287f86542e9ec754 /sys/netinet/tcp_timer.c | |
parent | pf route-to should not send packets from 127.0.0.1 or ::1 address (diff) | |
download | wireguard-openbsd-36d7e348842069f02503ea4ec0b5b49506982214.tar.xz wireguard-openbsd-36d7e348842069f02503ea4ec0b5b49506982214.zip |
TCP debug sockets still had code for old TCP timers that were
implemented as slow and fast protocol user requests. Replace that
with a proper timer debug implementation.
OK visa@
Diffstat (limited to 'sys/netinet/tcp_timer.c')
-rw-r--r-- | sys/netinet/tcp_timer.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 689ac152c1f..898c8e83304 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_timer.c,v 1.65 2018/05/08 15:10:33 bluhm Exp $ */ +/* $OpenBSD: tcp_timer.c,v 1.66 2018/05/10 13:30:25 bluhm Exp $ */ /* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */ /* @@ -51,6 +51,7 @@ #include <netinet/tcp_fsm.h> #include <netinet/tcp_timer.h> #include <netinet/tcp_var.h> +#include <netinet/tcp_debug.h> #include <netinet/ip_icmp.h> #include <netinet/tcp_seq.h> @@ -109,6 +110,7 @@ void tcp_timer_delack(void *arg) { struct tcpcb *tp = arg; + short ostate; /* * If tcp_output() wasn't able to transmit the ACK @@ -122,8 +124,11 @@ tcp_timer_delack(void *arg) goto out; CLR((tp)->t_flags, TF_TMR_DELACK); + ostate = tp->t_state; tp->t_flags |= TF_ACKNOW; (void) tcp_output(tp); + if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) + tcp_trace(TA_TIMER, ostate, tp, (caddr_t)0, TCPT_DELACK, 0); out: NET_UNLOCK(); } @@ -189,6 +194,7 @@ tcp_timer_rexmt(void *arg) { struct tcpcb *tp = arg; uint32_t rto; + short ostate; NET_LOCK(); /* Ignore canceled timeouts or timeouts that have been rescheduled. */ @@ -233,6 +239,7 @@ tcp_timer_rexmt(void *arg) tp->t_softerror : ETIMEDOUT); goto out; } + ostate = tp->t_state; tcpstat_inc(tcps_rexmttimeo); rto = TCP_REXMTVAL(tp); if (rto < tp->t_rttmin) @@ -367,7 +374,8 @@ tcp_timer_rexmt(void *arg) #endif } (void) tcp_output(tp); - + if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) + tcp_trace(TA_TIMER, ostate, tp, (caddr_t)0, TCPT_REXMT, 0); out: NET_UNLOCK(); } @@ -377,6 +385,7 @@ tcp_timer_persist(void *arg) { struct tcpcb *tp = arg; uint32_t rto; + short ostate; NET_LOCK(); /* Ignore canceled timeouts or timeouts that have been rescheduled. */ @@ -387,6 +396,8 @@ tcp_timer_persist(void *arg) if (TCP_TIMER_ISARMED(tp, TCPT_REXMT)) goto out; + + ostate = tp->t_state; tcpstat_inc(tcps_persisttimeo); /* * Hack: if the peer is dead/unreachable, we do not @@ -409,6 +420,8 @@ tcp_timer_persist(void *arg) tp->t_force = 1; (void) tcp_output(tp); tp->t_force = 0; + if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) + tcp_trace(TA_TIMER, ostate, tp, (caddr_t)0, TCPT_PERSIST, 0); out: NET_UNLOCK(); } @@ -417,6 +430,7 @@ void tcp_timer_keep(void *arg) { struct tcpcb *tp = arg; + short ostate; NET_LOCK(); /* Ignore canceled timeouts or timeouts that have been rescheduled. */ @@ -425,6 +439,7 @@ tcp_timer_keep(void *arg) goto out; CLR((tp)->t_flags, TF_TMR_KEEP); + ostate = tp->t_state; tcpstat_inc(tcps_keeptimeo); if (TCPS_HAVEESTABLISHED(tp->t_state) == 0) goto dropit; @@ -452,6 +467,8 @@ tcp_timer_keep(void *arg) TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepintvl); } else TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle); + if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) + tcp_trace(TA_TIMER, ostate, tp, (caddr_t)0, TCPT_KEEP, 0); out: NET_UNLOCK(); return; @@ -466,6 +483,7 @@ void tcp_timer_2msl(void *arg) { struct tcpcb *tp = arg; + short ostate; NET_LOCK(); /* Ignore canceled timeouts or timeouts that have been rescheduled. */ @@ -474,6 +492,7 @@ tcp_timer_2msl(void *arg) goto out; CLR((tp)->t_flags, TF_TMR_2MSL); + ostate = tp->t_state; tcp_timer_freesack(tp); if (tp->t_state != TCPS_TIME_WAIT && @@ -481,7 +500,8 @@ tcp_timer_2msl(void *arg) TCP_TIMER_ARM(tp, TCPT_2MSL, tcp_keepintvl); else tp = tcp_close(tp); - + if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) + tcp_trace(TA_TIMER, ostate, tp, (caddr_t)0, TCPT_2MSL, 0); out: NET_UNLOCK(); } |