have tcp6_drain

This commit is contained in:
itojun 2002-03-15 09:25:41 +00:00
parent 5a142891ab
commit 38f3d28842
3 changed files with 38 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_subr.c,v 1.123 2002/03/08 20:48:44 thorpej Exp $ */
/* $NetBSD: tcp_subr.c,v 1.124 2002/03/15 09:25:41 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.123 2002/03/08 20:48:44 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.124 2002/03/15 09:25:41 itojun Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -1105,6 +1105,34 @@ tcp_drain()
}
}
#ifdef INET6
void
tcp6_drain()
{
struct in6pcb *in6p;
struct tcpcb *tp;
struct in6pcb *head = &tcb6;
/*
* Free the sequence queue of all TCP connections.
*/
for (in6p = head->in6p_next; in6p != head; in6p = in6p->in6p_next) {
if ((tp = in6totcpcb(in6p)) != NULL) {
/*
* We may be called from a device's interrupt
* context. If the tcpcb is already busy,
* just bail out now.
*/
if (tcp_reass_lock_try(tp) == 0)
continue;
if (tcp_freeq(tp))
tcpstat.tcps_connsdrained++;
TCP_REASS_UNLOCK(tp);
}
}
}
#endif
/*
* Notify a tcp user of an asynchronous error;
* store error as soft error, but wake up user

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_var.h,v 1.88 2002/01/24 02:12:30 itojun Exp $ */
/* $NetBSD: tcp_var.h,v 1.89 2002/03/15 09:25:42 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -691,6 +691,9 @@ struct tcpcb *
void tcp_dooptions __P((struct tcpcb *,
u_char *, int, struct tcphdr *, struct tcp_opt_info *));
void tcp_drain __P((void));
#ifdef INET6
void tcp6_drain __P((void));
#endif
void tcp_established __P((struct tcpcb *));
void tcp_init __P((void));
#ifdef INET6

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_proto.c,v 1.38 2001/12/21 08:54:19 itojun Exp $ */
/* $NetBSD: in6_proto.c,v 1.39 2002/03/15 09:25:43 itojun Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/*
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.38 2001/12/21 08:54:19 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.39 2002/03/15 09:25:43 itojun Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -148,9 +148,9 @@ struct ip6protosw inet6sw[] = {
tcp6_input, 0, tcp6_ctlinput, tcp_ctloutput,
tcp_usrreq,
#ifdef INET /* don't call initialization and timeout routines twice */
0, 0, 0, tcp_drain,
0, 0, 0, tcp6_drain,
#else
tcp_init, 0, tcp_slowtimo, tcp_drain,
tcp_init, 0, tcp_slowtimo, tcp6_drain,
#endif
tcp_sysctl,
},