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