tcp_timer.c revision 1.51 1 /* $NetBSD: tcp_timer.c,v 1.51 2001/09/10 20:15:14 thorpej Exp $ */
2
3 /*
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the project nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32 /*-
33 * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
34 * All rights reserved.
35 *
36 * This code is derived from software contributed to The NetBSD Foundation
37 * by Jason R. Thorpe and Kevin M. Lahey of the Numerical Aerospace Simulation
38 * Facility, NASA Ames Research Center.
39 *
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
42 * are met:
43 * 1. Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 * 2. Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following disclaimer in the
47 * documentation and/or other materials provided with the distribution.
48 * 3. All advertising materials mentioning features or use of this software
49 * must display the following acknowledgement:
50 * This product includes software developed by the NetBSD
51 * Foundation, Inc. and its contributors.
52 * 4. Neither the name of The NetBSD Foundation nor the names of its
53 * contributors may be used to endorse or promote products derived
54 * from this software without specific prior written permission.
55 *
56 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
57 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
58 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
60 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
61 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
62 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
63 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
64 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
66 * POSSIBILITY OF SUCH DAMAGE.
67 */
68
69 /*
70 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
71 * The Regents of the University of California. All rights reserved.
72 *
73 * Redistribution and use in source and binary forms, with or without
74 * modification, are permitted provided that the following conditions
75 * are met:
76 * 1. Redistributions of source code must retain the above copyright
77 * notice, this list of conditions and the following disclaimer.
78 * 2. Redistributions in binary form must reproduce the above copyright
79 * notice, this list of conditions and the following disclaimer in the
80 * documentation and/or other materials provided with the distribution.
81 * 3. All advertising materials mentioning features or use of this software
82 * must display the following acknowledgement:
83 * This product includes software developed by the University of
84 * California, Berkeley and its contributors.
85 * 4. Neither the name of the University nor the names of its contributors
86 * may be used to endorse or promote products derived from this software
87 * without specific prior written permission.
88 *
89 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
90 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
91 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
92 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
93 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
94 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
95 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
96 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
97 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
98 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
99 * SUCH DAMAGE.
100 *
101 * @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95
102 */
103
104 #include "opt_inet.h"
105 #include "opt_tcp_debug.h"
106
107 #include <sys/param.h>
108 #include <sys/systm.h>
109 #include <sys/malloc.h>
110 #include <sys/mbuf.h>
111 #include <sys/socket.h>
112 #include <sys/socketvar.h>
113 #include <sys/protosw.h>
114 #include <sys/errno.h>
115 #include <sys/kernel.h>
116
117 #include <net/if.h>
118 #include <net/route.h>
119
120 #include <netinet/in.h>
121 #include <netinet/in_systm.h>
122 #include <netinet/ip.h>
123 #include <netinet/in_pcb.h>
124 #include <netinet/ip_var.h>
125
126 #ifdef INET6
127 #ifndef INET
128 #include <netinet/in.h>
129 #endif
130 #include <netinet/ip6.h>
131 #include <netinet6/in6_pcb.h>
132 #endif
133
134 #include <netinet/tcp.h>
135 #include <netinet/tcp_fsm.h>
136 #include <netinet/tcp_seq.h>
137 #include <netinet/tcp_timer.h>
138 #include <netinet/tcp_var.h>
139 #include <netinet/tcpip.h>
140 #ifdef TCP_DEBUG
141 #include <netinet/tcp_debug.h>
142 #endif
143
144 int tcp_keepidle = TCPTV_KEEP_IDLE;
145 int tcp_keepintvl = TCPTV_KEEPINTVL;
146 int tcp_keepcnt = TCPTV_KEEPCNT; /* max idle probes */
147 int tcp_maxpersistidle = TCPTV_KEEP_IDLE; /* max idle time in persist */
148 int tcp_maxidle;
149
150 /*
151 * Time to delay the ACK. This is initialized in tcp_init(), unless
152 * its patched.
153 */
154 int tcp_delack_ticks = 0;
155
156 void tcp_timer_rexmt(void *);
157 void tcp_timer_persist(void *);
158 void tcp_timer_keep(void *);
159 void tcp_timer_2msl(void *);
160
161 tcp_timer_func_t tcp_timer_funcs[TCPT_NTIMERS] = {
162 tcp_timer_rexmt,
163 tcp_timer_persist,
164 tcp_timer_keep,
165 tcp_timer_2msl,
166 };
167
168 /*
169 * Callout to process delayed ACKs for a TCPCB.
170 */
171 void
172 tcp_delack(void *arg)
173 {
174 struct tcpcb *tp = arg;
175 int s;
176
177 /*
178 * If tcp_output() wasn't able to transmit the ACK
179 * for whatever reason, it will restart the delayed
180 * ACK callout.
181 */
182
183 s = splsoftnet();
184 tp->t_flags |= TF_ACKNOW;
185 (void) tcp_output(tp);
186 splx(s);
187 }
188
189 /*
190 * Tcp protocol timeout routine called every 500 ms.
191 * Updates the timers in all active tcb's and
192 * causes finite state machine actions if timers expire.
193 */
194 void
195 tcp_slowtimo()
196 {
197 struct inpcb *inp, *ninp;
198 struct tcpcb *tp;
199 #ifdef INET6
200 struct in6pcb *in6p, *nin6p;
201 #endif
202 int s;
203 long i;
204 static int syn_cache_last = 0;
205 int skip, mask;
206
207 skip = mask = 0;
208
209 s = splsoftnet();
210 tcp_maxidle = tcp_keepcnt * tcp_keepintvl;
211 /*
212 * Search through tcb's and update active timers.
213 */
214 mask |= 1;
215 inp = tcbtable.inpt_queue.cqh_first;
216 if (inp == (struct inpcb *)0) { /* XXX */
217 skip |= 1;
218 goto dotcb6;
219 }
220 for (; inp != (struct inpcb *)&tcbtable.inpt_queue; inp = ninp) {
221 ninp = inp->inp_queue.cqe_next;
222 tp = intotcpcb(inp);
223 if (tp == 0 || tp->t_state == TCPS_LISTEN)
224 continue;
225 for (i = 0; i < TCPT_NTIMERS; i++) {
226 if (TCP_TIMER_ISEXPIRED(tp, i)) {
227 TCP_TIMER_DISARM(tp, i);
228 (*(tcp_timer_funcs[i]))(tp);
229 /* XXX NOT MP SAFE */
230 if ((ninp == (void *)&tcbtable.inpt_queue &&
231 tcbtable.inpt_queue.cqh_last != inp) ||
232 ninp->inp_queue.cqe_prev != inp)
233 goto tpgone;
234 }
235 }
236 tpgone:
237 ;
238 }
239 dotcb6:
240 #ifdef INET6
241 mask |= 2;
242 in6p = tcb6.in6p_next;
243 if (in6p == (struct in6pcb *)0) { /* XXX */
244 skip |= 2;
245 goto doiss;
246 }
247 for (; in6p != (struct in6pcb *)&tcb6; in6p = nin6p) {
248 nin6p = in6p->in6p_next;
249 tp = in6totcpcb(in6p);
250 if (tp == 0 || tp->t_state == TCPS_LISTEN)
251 continue;
252 for (i = 0; i < TCPT_NTIMERS; i++) {
253 if (TCP_TIMER_ISEXPIRED(tp, i)) {
254 TCP_TIMER_DISARM(tp, i);
255 (*(tcp_timer_funcs[i]))(tp);
256 /* XXX NOT MP SAFE */
257 if ((nin6p == (void *)&tcb6 &&
258 tcb6.in6p_prev != in6p) ||
259 nin6p->in6p_prev != in6p)
260 goto tp6gone;
261 }
262 }
263 tp6gone:
264 ;
265 }
266
267 doiss:
268 #endif
269 if (mask == skip)
270 goto done;
271 tcp_iss_seq += TCP_ISSINCR; /* increment iss */
272 tcp_now++; /* for timestamps */
273 if (++syn_cache_last >= tcp_syn_cache_interval) {
274 syn_cache_timer();
275 syn_cache_last = 0;
276 }
277 done:
278 splx(s);
279 }
280
281 /*
282 * Cancel all timers for TCP tp.
283 */
284 void
285 tcp_canceltimers(tp)
286 struct tcpcb *tp;
287 {
288 int i;
289
290 for (i = 0; i < TCPT_NTIMERS; i++)
291 TCP_TIMER_DISARM(tp, i);
292 }
293
294 int tcp_backoff[TCP_MAXRXTSHIFT + 1] =
295 { 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 };
296
297 int tcp_totbackoff = 511; /* sum of tcp_backoff[] */
298
299 /*
300 * TCP timer processing.
301 */
302
303 void
304 tcp_timer_rexmt(void *arg)
305 {
306 struct tcpcb *tp = arg;
307 uint32_t rto;
308 int s;
309 #ifdef TCP_DEBUG
310 struct socket *so;
311 short ostate;
312 #endif
313
314 s = splsoftnet();
315
316 #ifdef TCP_DEBUG
317 #ifdef INET
318 if (tp->t_inpcb)
319 so = tp->t_inpcb->inp_socket;
320 #endif
321 #ifdef INET6
322 if (tp->t_in6pcb)
323 so = tp->t_in6pcb->in6p_socket;
324 #endif
325 ostate = tp->t_state;
326 #endif /* TCP_DEBUG */
327
328 /*
329 * Retransmission timer went off. Message has not
330 * been acked within retransmit interval. Back off
331 * to a longer retransmit interval and retransmit one segment.
332 */
333
334 if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) {
335 tp->t_rxtshift = TCP_MAXRXTSHIFT;
336 tcpstat.tcps_timeoutdrop++;
337 tp = tcp_drop(tp, tp->t_softerror ?
338 tp->t_softerror : ETIMEDOUT);
339 goto out;
340 }
341 tcpstat.tcps_rexmttimeo++;
342 rto = TCP_REXMTVAL(tp);
343 if (rto < tp->t_rttmin)
344 rto = tp->t_rttmin;
345 TCPT_RANGESET(tp->t_rxtcur, rto * tcp_backoff[tp->t_rxtshift],
346 tp->t_rttmin, TCPTV_REXMTMAX);
347 TCP_TIMER_ARM(tp, TCPT_REXMT, tp->t_rxtcur);
348 #if 0
349 /*
350 * If we are losing and we are trying path MTU discovery,
351 * try turning it off. This will avoid black holes in
352 * the network which suppress or fail to send "packet
353 * too big" ICMP messages. We should ideally do
354 * lots more sophisticated searching to find the right
355 * value here...
356 */
357 if (ip_mtudisc && tp->t_rxtshift > TCP_MAXRXTSHIFT / 6) {
358 struct rtentry *rt = NULL;
359
360 #ifdef INET
361 if (tp->t_inpcb)
362 rt = in_pcbrtentry(tp->t_inpcb);
363 #endif
364 #ifdef INET6
365 if (tp->t_in6pcb)
366 rt = in6_pcbrtentry(tp->t_in6pcb);
367 #endif
368
369 /* XXX: Black hole recovery code goes here */
370 }
371 #endif /* 0 */
372 /*
373 * If losing, let the lower level know and try for
374 * a better route. Also, if we backed off this far,
375 * our srtt estimate is probably bogus. Clobber it
376 * so we'll take the next rtt measurement as our srtt;
377 * move the current srtt into rttvar to keep the current
378 * retransmit times until then.
379 */
380 if (tp->t_rxtshift > TCP_MAXRXTSHIFT / 4) {
381 #ifdef INET
382 if (tp->t_inpcb)
383 in_losing(tp->t_inpcb);
384 #endif
385 #ifdef INET6
386 if (tp->t_in6pcb)
387 in6_losing(tp->t_in6pcb);
388 #endif
389 tp->t_rttvar += (tp->t_srtt >> TCP_RTT_SHIFT);
390 tp->t_srtt = 0;
391 }
392 tp->snd_nxt = tp->snd_una;
393 /*
394 * If timing a segment in this window, stop the timer.
395 */
396 tp->t_rtttime = 0;
397 /*
398 * Remember if we are retransmitting a SYN, because if
399 * we do, set the initial congestion window must be set
400 * to 1 segment.
401 */
402 if (tp->t_state == TCPS_SYN_SENT)
403 tp->t_flags |= TF_SYN_REXMT;
404 /*
405 * Close the congestion window down to one segment
406 * (we'll open it by one segment for each ack we get).
407 * Since we probably have a window's worth of unacked
408 * data accumulated, this "slow start" keeps us from
409 * dumping all that data as back-to-back packets (which
410 * might overwhelm an intermediate gateway).
411 *
412 * There are two phases to the opening: Initially we
413 * open by one mss on each ack. This makes the window
414 * size increase exponentially with time. If the
415 * window is larger than the path can handle, this
416 * exponential growth results in dropped packet(s)
417 * almost immediately. To get more time between
418 * drops but still "push" the network to take advantage
419 * of improving conditions, we switch from exponential
420 * to linear window opening at some threshhold size.
421 * For a threshhold, we use half the current window
422 * size, truncated to a multiple of the mss.
423 *
424 * (the minimum cwnd that will give us exponential
425 * growth is 2 mss. We don't allow the threshhold
426 * to go below this.)
427 */
428 {
429 u_int win = min(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_segsz;
430 if (win < 2)
431 win = 2;
432 /* Loss Window MUST be one segment. */
433 tp->snd_cwnd = tp->t_segsz;
434 tp->snd_ssthresh = win * tp->t_segsz;
435 tp->t_dupacks = 0;
436 }
437 (void) tcp_output(tp);
438
439 out:
440 #ifdef TCP_DEBUG
441 if (tp && so->so_options & SO_DEBUG)
442 tcp_trace(TA_USER, ostate, tp, NULL,
443 PRU_SLOWTIMO | (TCPT_REXMT << 8));
444 #endif
445 splx(s);
446 }
447
448 void
449 tcp_timer_persist(void *arg)
450 {
451 struct tcpcb *tp = arg;
452 struct socket *so;
453 uint32_t rto;
454 int s;
455 #ifdef TCP_DEBUG
456 short ostate;
457 #endif
458
459 s = splsoftnet();
460
461 #ifdef INET
462 if (tp->t_inpcb)
463 so = tp->t_inpcb->inp_socket;
464 #endif
465 #ifdef INET6
466 if (tp->t_in6pcb)
467 so = tp->t_in6pcb->in6p_socket;
468 #endif
469
470 #ifdef TCP_DEBUG
471 ostate = tp->t_state;
472 #endif
473
474 /*
475 * Persistance timer into zero window.
476 * Force a byte to be output, if possible.
477 */
478
479 /*
480 * Hack: if the peer is dead/unreachable, we do not
481 * time out if the window is closed. After a full
482 * backoff, drop the connection if the idle time
483 * (no responses to probes) reaches the maximum
484 * backoff that we would use if retransmitting.
485 */
486 rto = TCP_REXMTVAL(tp);
487 if (rto < tp->t_rttmin)
488 rto = tp->t_rttmin;
489 if (tp->t_rxtshift == TCP_MAXRXTSHIFT &&
490 ((tcp_now - tp->t_rcvtime) >= tcp_maxpersistidle ||
491 (tcp_now - tp->t_rcvtime) >= rto * tcp_totbackoff)) {
492 tcpstat.tcps_persistdrops++;
493 tp = tcp_drop(tp, ETIMEDOUT);
494 goto out;
495 }
496 tcpstat.tcps_persisttimeo++;
497 tcp_setpersist(tp);
498 tp->t_force = 1;
499 (void) tcp_output(tp);
500 tp->t_force = 0;
501
502 out:
503 #ifdef TCP_DEBUG
504 if (tp && so->so_options & SO_DEBUG)
505 tcp_trace(TA_USER, ostate, tp, NULL,
506 PRU_SLOWTIMO | (TCPT_PERSIST << 8));
507 #endif
508 splx(s);
509 }
510
511 void
512 tcp_timer_keep(void *arg)
513 {
514 struct tcpcb *tp = arg;
515 struct socket *so;
516 int s;
517 #ifdef TCP_DEBUG
518 short ostate;
519 #endif
520
521 s = splsoftnet();
522
523 #ifdef TCP_DEBUG
524 ostate = tp->t_state;
525 #endif /* TCP_DEBUG */
526
527 /*
528 * Keep-alive timer went off; send something
529 * or drop connection if idle for too long.
530 */
531
532 tcpstat.tcps_keeptimeo++;
533 if (TCPS_HAVEESTABLISHED(tp->t_state) == 0)
534 goto dropit;
535 #ifdef INET
536 if (tp->t_inpcb)
537 so = tp->t_inpcb->inp_socket;
538 #endif
539 #ifdef INET6
540 if (tp->t_in6pcb)
541 so = tp->t_in6pcb->in6p_socket;
542 #endif
543 if (so->so_options & SO_KEEPALIVE &&
544 tp->t_state <= TCPS_CLOSE_WAIT) {
545 if ((tcp_maxidle > 0) &&
546 ((tcp_now - tp->t_rcvtime) >=
547 tcp_keepidle + tcp_maxidle))
548 goto dropit;
549 /*
550 * Send a packet designed to force a response
551 * if the peer is up and reachable:
552 * either an ACK if the connection is still alive,
553 * or an RST if the peer has closed the connection
554 * due to timeout or reboot.
555 * Using sequence number tp->snd_una-1
556 * causes the transmitted zero-length segment
557 * to lie outside the receive window;
558 * by the protocol spec, this requires the
559 * correspondent TCP to respond.
560 */
561 tcpstat.tcps_keepprobe++;
562 if (tcp_compat_42) {
563 /*
564 * The keepalive packet must have nonzero
565 * length to get a 4.2 host to respond.
566 */
567 (void)tcp_respond(tp, tp->t_template,
568 (struct mbuf *)NULL, NULL, tp->rcv_nxt - 1,
569 tp->snd_una - 1, 0);
570 } else {
571 (void)tcp_respond(tp, tp->t_template,
572 (struct mbuf *)NULL, NULL, tp->rcv_nxt,
573 tp->snd_una - 1, 0);
574 }
575 TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepintvl);
576 } else
577 TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle);
578
579 #ifdef TCP_DEBUG
580 if (tp && so->so_options & SO_DEBUG)
581 tcp_trace(TA_USER, ostate, tp, NULL,
582 PRU_SLOWTIMO | (TCPT_KEEP << 8));
583 #endif
584 splx(s);
585 return;
586
587 dropit:
588 tcpstat.tcps_keepdrops++;
589 (void) tcp_drop(tp, ETIMEDOUT);
590 splx(s);
591 }
592
593 void
594 tcp_timer_2msl(void *arg)
595 {
596 struct tcpcb *tp = arg;
597 struct socket *so;
598 int s;
599 #ifdef TCP_DEBUG
600 short ostate;
601 #endif
602
603 s = splsoftnet();
604
605 #ifdef INET
606 if (tp->t_inpcb)
607 so = tp->t_inpcb->inp_socket;
608 #endif
609 #ifdef INET6
610 if (tp->t_in6pcb)
611 so = tp->t_in6pcb->in6p_socket;
612 #endif
613
614 #ifdef TCP_DEBUG
615 ostate = tp->t_state;
616 #endif
617
618 /*
619 * 2 MSL timeout in shutdown went off. If we're closed but
620 * still waiting for peer to close and connection has been idle
621 * too long, or if 2MSL time is up from TIME_WAIT, delete connection
622 * control block. Otherwise, check again in a bit.
623 */
624 if (tp->t_state != TCPS_TIME_WAIT &&
625 ((tcp_maxidle == 0) || ((tcp_now - tp->t_rcvtime) <= tcp_maxidle)))
626 TCP_TIMER_ARM(tp, TCPT_2MSL, tcp_keepintvl);
627 else
628 tp = tcp_close(tp);
629
630 #ifdef TCP_DEBUG
631 if (tp && so->so_options & SO_DEBUG)
632 tcp_trace(TA_USER, ostate, tp, NULL,
633 PRU_SLOWTIMO | (TCPT_2MSL << 8));
634 #endif
635 splx(s);
636 }
637