MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tcp_trace

Function tcp_trace

freebsd/netinet/tcp_debug.c:98–225  ·  view source on GitHub ↗

* Save TCP state at a given moment; optionally, both tcpcb and TCP packet * header state will be saved. */

Source from the content-addressed store, hash-verified

96 * header state will be saved.
97 */
98void
99tcp_trace(short act, short ostate, struct tcpcb *tp, void *ipgen,
100 struct tcphdr *th, int req)
101{
102#ifdef INET6
103 int isipv6;
104#endif /* INET6 */
105 tcp_seq seq, ack;
106 int len, flags;
107 struct tcp_debug *td;
108
109 mtx_lock(&tcp_debug_mtx);
110 td = &tcp_debug[tcp_debx++];
111 if (tcp_debx == TCP_NDEBUG)
112 tcp_debx = 0;
113 bzero(td, sizeof(*td));
114#ifdef INET6
115 isipv6 = (ipgen != NULL && ((struct ip *)ipgen)->ip_v == 6) ? 1 : 0;
116#endif /* INET6 */
117 td->td_family =
118#ifdef INET6
119 (isipv6 != 0) ? AF_INET6 :
120#endif
121 AF_INET;
122#ifdef INET
123 td->td_time = iptime();
124#endif
125 td->td_act = act;
126 td->td_ostate = ostate;
127 td->td_tcb = (caddr_t)tp;
128 if (tp != NULL)
129 td->td_cb = *tp;
130 if (ipgen != NULL) {
131 switch (td->td_family) {
132#ifdef INET
133 case AF_INET:
134 bcopy(ipgen, &td->td_ti.ti_i, sizeof(td->td_ti.ti_i));
135 break;
136#endif
137#ifdef INET6
138 case AF_INET6:
139 bcopy(ipgen, td->td_ip6buf, sizeof(td->td_ip6buf));
140 break;
141#endif
142 }
143 }
144 if (th != NULL) {
145 switch (td->td_family) {
146#ifdef INET
147 case AF_INET:
148 td->td_ti.ti_t = *th;
149 break;
150#endif
151#ifdef INET6
152 case AF_INET6:
153 td->td_ti6.th = *th;
154 break;
155#endif

Callers 14

tcp_timer_2mslFunction · 0.85
tcp_timer_keepFunction · 0.85
tcp_timer_persistFunction · 0.85
tcp_timer_rexmtFunction · 0.85
tcp_output.cFile · 0.85
tcp_inputFunction · 0.85
tcp_do_segmentFunction · 0.85
tcp_respondFunction · 0.85
rack_do_fastnewdataFunction · 0.85
rack_fastackFunction · 0.85
rack.cFile · 0.85
bbr_do_fastnewdataFunction · 0.85

Calls 5

bzeroFunction · 0.85
iptimeFunction · 0.85
mtx_lockFunction · 0.50
mtx_unlockFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected