Tue May 26 00:17:56 2009 UTC ()
POOL_INIT -> pool_init


(pooka)
diff -r1.109 -r1.110 src/sys/netinet6/in6_pcb.c

cvs diff -r1.109 -r1.110 src/sys/netinet6/in6_pcb.c (expand / switch to unified diff)

--- src/sys/netinet6/in6_pcb.c 2009/05/12 22:22:46 1.109
+++ src/sys/netinet6/in6_pcb.c 2009/05/26 00:17:56 1.110
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: in6_pcb.c,v 1.109 2009/05/12 22:22:46 elad Exp $ */ 1/* $NetBSD: in6_pcb.c,v 1.110 2009/05/26 00:17:56 pooka Exp $ */
2/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */ 2/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -52,44 +52,45 @@ @@ -52,44 +52,45 @@
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE. 59 * SUCH DAMAGE.
60 * 60 *
61 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 61 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.109 2009/05/12 22:22:46 elad Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.110 2009/05/26 00:17:56 pooka Exp $");
66 66
67#include "opt_inet.h" 67#include "opt_inet.h"
68#include "opt_ipsec.h" 68#include "opt_ipsec.h"
69 69
70#include <sys/param.h> 70#include <sys/param.h>
71#include <sys/systm.h> 71#include <sys/systm.h>
72#include <sys/malloc.h> 72#include <sys/malloc.h>
73#include <sys/mbuf.h> 73#include <sys/mbuf.h>
74#include <sys/protosw.h> 74#include <sys/protosw.h>
75#include <sys/socket.h> 75#include <sys/socket.h>
76#include <sys/socketvar.h> 76#include <sys/socketvar.h>
77#include <sys/ioctl.h> 77#include <sys/ioctl.h>
78#include <sys/errno.h> 78#include <sys/errno.h>
79#include <sys/time.h> 79#include <sys/time.h>
80#include <sys/proc.h> 80#include <sys/proc.h>
81#include <sys/kauth.h> 81#include <sys/kauth.h>
82#include <sys/domain.h> 82#include <sys/domain.h>
 83#include <sys/once.h>
83 84
84#include <net/if.h> 85#include <net/if.h>
85#include <net/route.h> 86#include <net/route.h>
86 87
87#include <netinet/in.h> 88#include <netinet/in.h>
88#include <netinet/in_var.h> 89#include <netinet/in_var.h>
89#include <netinet/in_systm.h> 90#include <netinet/in_systm.h>
90#include <netinet/ip.h> 91#include <netinet/ip.h>
91#include <netinet/in_pcb.h> 92#include <netinet/in_pcb.h>
92#include <netinet/ip6.h> 93#include <netinet/ip6.h>
93#include <netinet6/ip6_var.h> 94#include <netinet6/ip6_var.h>
94#include <netinet6/in6_pcb.h> 95#include <netinet6/in6_pcb.h>
95#include <netinet6/scope6_var.h> 96#include <netinet6/scope6_var.h>
@@ -120,35 +121,46 @@ const struct in6_addr zeroin6_addr; @@ -120,35 +121,46 @@ const struct in6_addr zeroin6_addr;
120#define IN6PCBHASH_CONNECT(table, faddr, fport, laddr, lport) \ 121#define IN6PCBHASH_CONNECT(table, faddr, fport, laddr, lport) \
121 &(table)->inpt_bindhashtbl[ \ 122 &(table)->inpt_bindhashtbl[ \
122 ((((faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^ \ 123 ((((faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^ \
123 (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3]) + ntohs(fport)) + \ 124 (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3]) + ntohs(fport)) + \
124 (((laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^ \ 125 (((laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^ \
125 (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3]) + \ 126 (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3]) + \
126 ntohs(lport))) & (table)->inpt_bindhash] 127 ntohs(lport))) & (table)->inpt_bindhash]
127 128
128int ip6_anonportmin = IPV6PORT_ANONMIN; 129int ip6_anonportmin = IPV6PORT_ANONMIN;
129int ip6_anonportmax = IPV6PORT_ANONMAX; 130int ip6_anonportmax = IPV6PORT_ANONMAX;
130int ip6_lowportmin = IPV6PORT_RESERVEDMIN; 131int ip6_lowportmin = IPV6PORT_RESERVEDMIN;
131int ip6_lowportmax = IPV6PORT_RESERVEDMAX; 132int ip6_lowportmax = IPV6PORT_RESERVEDMAX;
132 133
133POOL_INIT(in6pcb_pool, sizeof(struct in6pcb), 0, 0, 0, "in6pcbpl", NULL, 134static struct pool in6pcb_pool;
134 IPL_SOFTNET); 135
 136static int
 137in6pcb_poolinit(void)
 138{
 139
 140 pool_init(&in6pcb_pool, sizeof(struct in6pcb), 0, 0, 0, "in6pcbpl",
 141 NULL, IPL_SOFTNET);
 142 return 0;
 143}
135 144
136void 145void
137in6_pcbinit(struct inpcbtable *table, int bindhashsize, int connecthashsize) 146in6_pcbinit(struct inpcbtable *table, int bindhashsize, int connecthashsize)
138{ 147{
 148 static ONCE_DECL(control);
139 149
140 in_pcbinit(table, bindhashsize, connecthashsize); 150 in_pcbinit(table, bindhashsize, connecthashsize);
141 table->inpt_lastport = (u_int16_t)ip6_anonportmax; 151 table->inpt_lastport = (u_int16_t)ip6_anonportmax;
 152
 153 RUN_ONCE(&control, in6pcb_poolinit);
142} 154}
143 155
144int 156int
145in6_pcballoc(struct socket *so, void *v) 157in6_pcballoc(struct socket *so, void *v)
146{ 158{
147 struct inpcbtable *table = v; 159 struct inpcbtable *table = v;
148 struct in6pcb *in6p; 160 struct in6pcb *in6p;
149 int s; 161 int s;
150#if defined(IPSEC) || defined(FAST_IPSEC) 162#if defined(IPSEC) || defined(FAST_IPSEC)
151 int error; 163 int error;
152#endif 164#endif
153 165
154 s = splnet(); 166 s = splnet();