summaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
authordyoung <dyoung@NetBSD.org>2011-05-03 17:44:30 +0000
committerdyoung <dyoung@NetBSD.org>2011-05-03 17:44:30 +0000
commite75dee61d4264faca8a339e18f5ce25859485bbc (patch)
tree10b2fd8f0f0d9c8c26a3f342ce6c0d58b6a45158 /sys/netinet6
parent0f20a1d8e8e289ef82d4ee3d5665f2bf9203e070 (diff)
*_drain() routines may be called with locks held, so instead of doing
any work in *_drain(), set a drain-needed flag. Do the work in the fasttimo handler. Contributed by Coyote Point Systems, Inc.
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/frag6.c21
-rw-r--r--sys/netinet6/in6_proto.c10
-rw-r--r--sys/netinet6/ip6_var.h4
3 files changed, 28 insertions, 7 deletions
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c
index 82155c597b9..567be0dd071 100644
--- a/sys/netinet6/frag6.c
+++ b/sys/netinet6/frag6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: frag6.c,v 1.48 2011/01/22 18:26:36 mlelstv Exp $ */
+/* $NetBSD: frag6.c,v 1.49 2011/05/03 17:44:30 dyoung Exp $ */
/* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.48 2011/01/22 18:26:36 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.49 2011/05/03 17:44:30 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -65,6 +65,8 @@ static void frag6_remque(struct ip6q *);
static void frag6_freef(struct ip6q *);
static int ip6q_locked;
+static int frag6_drainwanted;
+
u_int frag6_nfragpackets;
u_int frag6_nfrags;
struct ip6q ip6q; /* ip6 reassemble queue */
@@ -670,6 +672,15 @@ frag6_remque(struct ip6q *p6)
p6->ip6q_next->ip6q_prev = p6->ip6q_prev;
}
+void
+frag6_fasttimo(void)
+{
+ if (frag6_drainwanted) {
+ frag6_drain();
+ frag6_drainwanted = 0;
+ }
+}
+
/*
* IPv6 reassembling timer processing;
* if a timer expires on a reassembly
@@ -722,6 +733,12 @@ frag6_slowtimo(void)
mutex_exit(softnet_lock);
}
+void
+frag6_drainstub(void)
+{
+ frag6_drainwanted = 1;
+}
+
/*
* Drain off all datagram fragments.
*/
diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c
index 56f860bcb5e..a6ff00f1305 100644
--- a/sys/netinet6/in6_proto.c
+++ b/sys/netinet6/in6_proto.c
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_proto.c,v 1.90 2011/03/31 19:40:52 dyoung Exp $ */
+/* $NetBSD: in6_proto.c,v 1.91 2011/05/03 17:44:30 dyoung Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.90 2011/03/31 19:40:52 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.91 2011/05/03 17:44:30 dyoung Exp $");
#include "opt_gateway.h"
#include "opt_inet.h"
@@ -193,8 +193,9 @@ const struct ip6protosw inet6sw[] = {
{ .pr_domain = &inet6domain,
.pr_protocol = IPPROTO_IPV6,
.pr_init = ip6_init,
+ .pr_fasttimo = frag6_fasttimo,
.pr_slowtimo = frag6_slowtimo,
- .pr_drain = frag6_drain,
+ .pr_drain = frag6_drainstub,
},
{ .pr_type = SOCK_DGRAM,
.pr_domain = &inet6domain,
@@ -216,8 +217,9 @@ const struct ip6protosw inet6sw[] = {
.pr_usrreq = tcp_usrreq,
#ifndef INET /* don't call initialization and timeout routines twice */
.pr_init = tcp_init,
+ .pr_fasttimo = tcp_fasttimo,
.pr_slowtimo = tcp_slowtimo,
- .pr_drain = tcp_drain,
+ .pr_drain = tcp_drainstub,
#endif
},
{ .pr_type = SOCK_RAW,
diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
index 0992738504b..b1f8899eae4 100644
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_var.h,v 1.53 2009/05/06 21:41:59 elad Exp $ */
+/* $NetBSD: ip6_var.h,v 1.54 2011/05/03 17:44:30 dyoung Exp $ */
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
/*
@@ -358,7 +358,9 @@ int route6_input(struct mbuf **, int *, int);
void frag6_init(void);
int frag6_input(struct mbuf **, int *, int);
void frag6_slowtimo(void);
+void frag6_fasttimo(void);
void frag6_drain(void);
+void frag6_drainstub(void);
int ip6flow_init(int);
void ip6flow_poolinit(void);