Deleted Added
full compact
in6_proto.c (62573) in6_proto.c (62587)
1/* $FreeBSD: head/sys/netinet6/in6_proto.c 62587 2000-07-04 16:35:15Z itojun $ */
2/* $KAME: in6_proto.c,v 1.64 2000/06/20 16:20:27 itojun Exp $ */
3
1/*
2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

23 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/netinet6/in6_proto.c 62573 2000-07-04 11:25:35Z phk $
30 */
31
32/*
33 * Copyright (c) 1982, 1986, 1993
34 * The Regents of the University of California. All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions

--- 22 unchanged lines hidden (view full) ---

60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 * @(#)in_proto.c 8.1 (Berkeley) 6/10/93
65 */
66
67#include "opt_inet.h"
31 */
32
33/*
34 * Copyright (c) 1982, 1986, 1993
35 * The Regents of the University of California. All rights reserved.
36 *
37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions

--- 22 unchanged lines hidden (view full) ---

61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * SUCH DAMAGE.
64 *
65 * @(#)in_proto.c 8.1 (Berkeley) 6/10/93
66 */
67
68#include "opt_inet.h"
69#include "opt_inet6.h"
68#include "opt_ipsec.h"
69
70#include <sys/param.h>
71#include <sys/socket.h>
72#include <sys/socketvar.h>
73#include <sys/protosw.h>
74#include <sys/kernel.h>
75#include <sys/domain.h>
76#include <sys/mbuf.h>
77#include <sys/systm.h>
78#include <sys/sysctl.h>
79
80#include <net/if.h>
81#include <net/radix.h>
82#include <net/route.h>
83
84#include <netinet/in.h>
85#include <netinet/in_systm.h>
86#include <netinet/in_var.h>
70#include "opt_ipsec.h"
71
72#include <sys/param.h>
73#include <sys/socket.h>
74#include <sys/socketvar.h>
75#include <sys/protosw.h>
76#include <sys/kernel.h>
77#include <sys/domain.h>
78#include <sys/mbuf.h>
79#include <sys/systm.h>
80#include <sys/sysctl.h>
81
82#include <net/if.h>
83#include <net/radix.h>
84#include <net/route.h>
85
86#include <netinet/in.h>
87#include <netinet/in_systm.h>
88#include <netinet/in_var.h>
89#include <netinet/ip_encap.h>
87#include <netinet/ip.h>
88#include <netinet/ip_var.h>
90#include <netinet/ip.h>
91#include <netinet/ip_var.h>
89#include <netinet6/ip6.h>
92#include
90#include <netinet6/ip6_var.h>
93#include <netinet6/ip6_var.h>
91#include <netinet6/icmp6.h>
94#include
92
93#include <netinet/tcp.h>
94#include <netinet/tcp_timer.h>
95#include <netinet/tcp_var.h>
96#include <netinet/udp.h>
97#include <netinet/udp_var.h>
98#include <netinet6/tcp6_var.h>
95
96#include <netinet/tcp.h>
97#include <netinet/tcp_timer.h>
98#include <netinet/tcp_var.h>
99#include <netinet/udp.h>
100#include <netinet/udp_var.h>
101#include <netinet6/tcp6_var.h>
102
99#include <netinet6/udp6_var.h>
100
101#include <netinet6/pim6_var.h>
102
103#include <netinet6/nd6.h>
104#include <netinet6/in6_prefix.h>
105
106#ifdef IPSEC
107#include <netinet6/ipsec.h>
103#include <netinet6/udp6_var.h>
104
105#include <netinet6/pim6_var.h>
106
107#include <netinet6/nd6.h>
108#include <netinet6/in6_prefix.h>
109
110#ifdef IPSEC
111#include <netinet6/ipsec.h>
108#include <netinet6/ah.h>
109#include <netinet6/ipsec6.h>
112#include <netinet6/ipsec6.h>
113#include <netinet6/ah.h>
110#include <netinet6/ah6.h>
111#ifdef IPSEC_ESP
112#include <netinet6/esp.h>
113#include <netinet6/esp6.h>
114#endif
114#include <netinet6/ah6.h>
115#ifdef IPSEC_ESP
116#include <netinet6/esp.h>
117#include <netinet6/esp6.h>
118#endif
119#include <netinet6/ipcomp.h>
120#include <netinet6/ipcomp6.h>
115#endif /*IPSEC*/
116
117#include <netinet6/ip6protosw.h>
118
119#include "gif.h"
120#if NGIF > 0
121#include <netinet6/in6_gif.h>
122#endif
123
124#include <net/net_osdep.h>
125
126#define offsetof(type, member) ((size_t)(&((type *)0)->member))
127
128/*
129 * TCP/IP protocol family: IP6, ICMP6, UDP, TCP.
130 */
131
121#endif /*IPSEC*/
122
123#include <netinet6/ip6protosw.h>
124
125#include "gif.h"
126#if NGIF > 0
127#include <netinet6/in6_gif.h>
128#endif
129
130#include <net/net_osdep.h>
131
132#define offsetof(type, member) ((size_t)(&((type *)0)->member))
133
134/*
135 * TCP/IP protocol family: IP6, ICMP6, UDP, TCP.
136 */
137
132extern struct domain inet6domain;
133static struct pr_usrreqs nousrreqs;
138extern struct domain inet6domain;
139static struct pr_usrreqs nousrreqs;
134
135struct ip6protosw inet6sw[] = {
136{ 0, &inet6domain, IPPROTO_IPV6, 0,
137 0, 0, 0, 0,
138 0,
139 ip6_init, 0, frag6_slowtimo, frag6_drain,
140 &nousrreqs,
141},

--- 4 unchanged lines hidden (view full) ---

146 &udp6_usrreqs,
147},
148{ SOCK_STREAM, &inet6domain, IPPROTO_TCP, PR_CONNREQUIRED | PR_WANTRCVD,
149 tcp6_input, 0, tcp6_ctlinput, tcp_ctloutput,
150 0,
151#ifdef INET /* don't call timeout routines twice */
152 tcp_init, 0, 0, tcp_drain,
153#else
140
141struct ip6protosw inet6sw[] = {
142{ 0, &inet6domain, IPPROTO_IPV6, 0,
143 0, 0, 0, 0,
144 0,
145 ip6_init, 0, frag6_slowtimo, frag6_drain,
146 &nousrreqs,
147},

--- 4 unchanged lines hidden (view full) ---

152 &udp6_usrreqs,
153},
154{ SOCK_STREAM, &inet6domain, IPPROTO_TCP, PR_CONNREQUIRED | PR_WANTRCVD,
155 tcp6_input, 0, tcp6_ctlinput, tcp_ctloutput,
156 0,
157#ifdef INET /* don't call timeout routines twice */
158 tcp_init, 0, 0, tcp_drain,
159#else
154 tcp_init, 0, tcp_slowtimo, tcp_drain,
160 tcp_init, tcp_fasttimo, tcp_slowtimo, tcp_drain,
155#endif
156 &tcp6_usrreqs,
157},
158{ SOCK_RAW, &inet6domain, IPPROTO_RAW, PR_ATOMIC | PR_ADDR,
161#endif
162 &tcp6_usrreqs,
163},
164{ SOCK_RAW, &inet6domain, IPPROTO_RAW, PR_ATOMIC | PR_ADDR,
159 rip6_input, rip6_output, 0, rip6_ctloutput,
165 rip6_input, rip6_output, rip6_ctlinput, rip6_ctloutput,
160 0,
161 0, 0, 0, 0,
162 &rip6_usrreqs
163},
164{ SOCK_RAW, &inet6domain, IPPROTO_ICMPV6, PR_ATOMIC | PR_ADDR,
165 icmp6_input, rip6_output, 0, rip6_ctloutput,
166 0,
167 icmp6_init, icmp6_fasttimo, 0, 0,
168 &rip6_usrreqs
169},
170{ SOCK_RAW, &inet6domain, IPPROTO_DSTOPTS,PR_ATOMIC|PR_ADDR,
171 dest6_input, 0, 0, 0,
166 0,
167 0, 0, 0, 0,
168 &rip6_usrreqs
169},
170{ SOCK_RAW, &inet6domain, IPPROTO_ICMPV6, PR_ATOMIC | PR_ADDR,
171 icmp6_input, rip6_output, 0, rip6_ctloutput,
172 0,
173 icmp6_init, icmp6_fasttimo, 0, 0,
174 &rip6_usrreqs
175},
176{ SOCK_RAW, &inet6domain, IPPROTO_DSTOPTS,PR_ATOMIC|PR_ADDR,
177 dest6_input, 0, 0, 0,
172 0,
178 0,
173 0, 0, 0, 0,
174 &nousrreqs
175},
176{ SOCK_RAW, &inet6domain, IPPROTO_ROUTING,PR_ATOMIC|PR_ADDR,
177 route6_input, 0, 0, 0,
179 0, 0, 0, 0,
180 &nousrreqs
181},
182{ SOCK_RAW, &inet6domain, IPPROTO_ROUTING,PR_ATOMIC|PR_ADDR,
183 route6_input, 0, 0, 0,
178 0,
184 0,
179 0, 0, 0, 0,
180 &nousrreqs
181},
182{ SOCK_RAW, &inet6domain, IPPROTO_FRAGMENT,PR_ATOMIC|PR_ADDR,
183 frag6_input, 0, 0, 0,
185 0, 0, 0, 0,
186 &nousrreqs
187},
188{ SOCK_RAW, &inet6domain, IPPROTO_FRAGMENT,PR_ATOMIC|PR_ADDR,
189 frag6_input, 0, 0, 0,
184 0,
190 0,
185 0, 0, 0, 0,
186 &nousrreqs
187},
188#ifdef IPSEC
189{ SOCK_RAW, &inet6domain, IPPROTO_AH, PR_ATOMIC|PR_ADDR,
190 ah6_input, 0, 0, 0,
191 0, 0, 0, 0,
192 &nousrreqs
193},
194#ifdef IPSEC
195{ SOCK_RAW, &inet6domain, IPPROTO_AH, PR_ATOMIC|PR_ADDR,
196 ah6_input, 0, 0, 0,
191 0,
197 0,
192 0, 0, 0, 0,
193 &nousrreqs,
194},
195#ifdef IPSEC_ESP
196{ SOCK_RAW, &inet6domain, IPPROTO_ESP, PR_ATOMIC|PR_ADDR,
197 esp6_input, 0, 0, 0,
198 0, 0, 0, 0,
199 &nousrreqs,
200},
201#ifdef IPSEC_ESP
202{ SOCK_RAW, &inet6domain, IPPROTO_ESP, PR_ATOMIC|PR_ADDR,
203 esp6_input, 0, 0, 0,
198 0,
204 0,
199 0, 0, 0, 0,
200 &nousrreqs,
201},
202#endif
205 0, 0, 0, 0,
206 &nousrreqs,
207},
208#endif
209{ SOCK_RAW, &inet6domain, IPPROTO_IPCOMP, PR_ATOMIC|PR_ADDR,
210 ipcomp6_input, 0, 0, 0,
211 0,
212 0, 0, 0, 0,
213 &nousrreqs,
214},
203#endif /* IPSEC */
215#endif /* IPSEC */
204#if NGIF > 0
216#ifdef INET
205{ SOCK_RAW, &inet6domain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR,
217{ SOCK_RAW, &inet6domain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR,
206 in6_gif_input,0, 0, 0,
207 0,
218 encap6_input, rip6_output, 0, rip6_ctloutput,
219 0,
208 0, 0, 0, 0,
220 0, 0, 0, 0,
209 &nousrreqs
221 &rip6_usrreqs
210},
222},
223#endif /*INET*/
211{ SOCK_RAW, &inet6domain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR,
224{ SOCK_RAW, &inet6domain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR,
212 in6_gif_input,0, 0, 0,
225 encap6_input, rip6_output, 0, rip6_ctloutput,
213 0,
226 0,
227#ifndef INET
228 encap_init, 0, 0, 0,
229#else
214 0, 0, 0, 0,
230 0, 0, 0, 0,
215 &nousrreqs
231#endif
232 &rip6_usrreqs
216},
233},
217#endif /* GIF */
218{ SOCK_RAW, &inet6domain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR,
234{ SOCK_RAW, &inet6domain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR,
219 pim6_input, rip6_output, 0, rip6_ctloutput,
235 pim6_input, rip6_output, 0, rip6_ctloutput,
220 0,
236 0,
221 0, 0, 0, 0,
237 0, 0, 0, 0,
222 &rip6_usrreqs
223},
224/* raw wildcard */
225{ SOCK_RAW, &inet6domain, 0, PR_ATOMIC | PR_ADDR,
226 rip6_input, rip6_output, 0, rip6_ctloutput,
238 &rip6_usrreqs
239},
240/* raw wildcard */
241{ SOCK_RAW, &inet6domain, 0, PR_ATOMIC | PR_ADDR,
242 rip6_input, rip6_output, 0, rip6_ctloutput,
227 0,
228 0, 0, 0, 0,
243 0, 0,
244 0, 0, 0,
229 &rip6_usrreqs
230},
231};
232
245 &rip6_usrreqs
246},
247};
248
233extern int in6_inithead __P((void **, int));
249#if NGIF > 0
250struct ip6protosw in6_gif_protosw =
251{ SOCK_RAW, &inet6domain, 0/*IPPROTO_IPV[46]*/, PR_ATOMIC|PR_ADDR,
252 in6_gif_input, rip6_output, 0, rip6_ctloutput,
253 0,
254 0, 0, 0, 0,
255 &rip6_usrreqs
256};
257#endif /*NGIF*/
234
258
259extern int in6_inithead __P((void **, int));
260
235struct domain inet6domain =
236 { AF_INET6, "internet6", 0, 0, 0,
237 (struct protosw *)inet6sw,
238 (struct protosw *)&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])], 0,
239 in6_inithead,
240 offsetof(struct sockaddr_in6, sin6_addr) << 3,
241 sizeof(struct sockaddr_in6) };
242

--- 18 unchanged lines hidden (view full) ---

261int ip6_sendredirects = IPV6_SENDREDIRECTS;
262int ip6_defhlim = IPV6_DEFHLIM;
263int ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS;
264int ip6_accept_rtadv = 0; /* "IPV6FORWARDING ? 0 : 1" is dangerous */
265int ip6_maxfragpackets = 200;
266int ip6_log_interval = 5;
267int ip6_hdrnestlimit = 50; /* appropriate? */
268int ip6_dad_count = 1; /* DupAddrDetectionTransmits */
261struct domain inet6domain =
262 { AF_INET6, "internet6", 0, 0, 0,
263 (struct protosw *)inet6sw,
264 (struct protosw *)&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])], 0,
265 in6_inithead,
266 offsetof(struct sockaddr_in6, sin6_addr) << 3,
267 sizeof(struct sockaddr_in6) };
268

--- 18 unchanged lines hidden (view full) ---

287int ip6_sendredirects = IPV6_SENDREDIRECTS;
288int ip6_defhlim = IPV6_DEFHLIM;
289int ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS;
290int ip6_accept_rtadv = 0; /* "IPV6FORWARDING ? 0 : 1" is dangerous */
291int ip6_maxfragpackets = 200;
292int ip6_log_interval = 5;
293int ip6_hdrnestlimit = 50; /* appropriate? */
294int ip6_dad_count = 1; /* DupAddrDetectionTransmits */
269u_int32_t ip6_flow_seq;
295u_int32_t ip6_flow_seq;
270int ip6_auto_flowlabel = 1;
271#if NGIF > 0
272int ip6_gif_hlim = GIF_HLIM;
273#else
274int ip6_gif_hlim = 0;
275#endif
276int ip6_use_deprecated = 1; /* allow deprecated addr (RFC2462 5.5.4) */
277int ip6_rr_prune = 5; /* router renumbering prefix

--- 5 unchanged lines hidden (view full) ---

283time_t ip6_log_time = (time_t)0L;
284
285/* icmp6 */
286/*
287 * BSDI4 defines these variables in in_proto.c...
288 * XXX: what if we don't define INET? Should we define pmtu6_expire
289 * or so? (jinmei@kame.net 19990310)
290 */
296int ip6_auto_flowlabel = 1;
297#if NGIF > 0
298int ip6_gif_hlim = GIF_HLIM;
299#else
300int ip6_gif_hlim = 0;
301#endif
302int ip6_use_deprecated = 1; /* allow deprecated addr (RFC2462 5.5.4) */
303int ip6_rr_prune = 5; /* router renumbering prefix

--- 5 unchanged lines hidden (view full) ---

309time_t ip6_log_time = (time_t)0L;
310
311/* icmp6 */
312/*
313 * BSDI4 defines these variables in in_proto.c...
314 * XXX: what if we don't define INET? Should we define pmtu6_expire
315 * or so? (jinmei@kame.net 19990310)
316 */
291int pmtu_expire = 60*10;
292int pmtu_probe = 60*2;
317int pmtu_expire = 60*10;
318int pmtu_probe = 60*2;
293
294/* raw IP6 parameters */
295/*
296 * Nominal space allocated to a raw ip socket.
297 */
298#define RIPV6SNDQ 8192
299#define RIPV6RCVQ 8192
300
301u_long rip6_sendspace = RIPV6SNDQ;
302u_long rip6_recvspace = RIPV6RCVQ;
303
304/* ICMPV6 parameters */
305int icmp6_rediraccept = 1; /* accept and process redirects */
306int icmp6_redirtimeout = 10 * 60; /* 10 minutes */
319
320/* raw IP6 parameters */
321/*
322 * Nominal space allocated to a raw ip socket.
323 */
324#define RIPV6SNDQ 8192
325#define RIPV6RCVQ 8192
326
327u_long rip6_sendspace = RIPV6SNDQ;
328u_long rip6_recvspace = RIPV6RCVQ;
329
330/* ICMPV6 parameters */
331int icmp6_rediraccept = 1; /* accept and process redirects */
332int icmp6_redirtimeout = 10 * 60; /* 10 minutes */
307u_int icmp6errratelim = 1000; /* 1000usec = 1msec */
333struct timeval icmp6errratelim = { 0, 0 }; /* no ratelimit */
334int icmp6errppslim = 100; /* 100pps */
335int icmp6_nodeinfo = 1; /* enable/disable NI response */
308
336
337#ifdef TCP6
338/* TCP on IP6 parameters */
339int tcp6_sendspace = 1024 * 8;
340int tcp6_recvspace = 1024 * 8;
341int tcp6_mssdflt = TCP6_MSS;
342int tcp6_rttdflt = TCP6TV_SRTTDFLT / PR_SLOWHZ;
343int tcp6_do_rfc1323 = 1;
344int tcp6_conntimeo = TCP6TV_KEEP_INIT; /* initial connection timeout */
345int tcp6_43maxseg = 0;
346int tcp6_pmtu = 0;
347
348/*
349 * Parameters for keepalive option.
350 * Connections for which SO_KEEPALIVE is set will be probed
351 * after being idle for a time of tcp6_keepidle (in units of PR_SLOWHZ).
352 * Starting at that time, the connection is probed at intervals
353 * of tcp6_keepintvl (same units) until a response is received
354 * or until tcp6_keepcnt probes have been made, at which time
355 * the connection is dropped. Note that a tcp6_keepidle value
356 * under 2 hours is nonconformant with RFC-1122, Internet Host Requirements.
357 */
358int tcp6_keepidle = TCP6TV_KEEP_IDLE; /* time before probing idle */
359int tcp6_keepintvl = TCP6TV_KEEPINTVL; /* interval betwn idle probes */
360int tcp6_keepcnt = TCP6TV_KEEPCNT; /* max idle probes */
361int tcp6_maxpersistidle = TCP6TV_KEEP_IDLE; /* max idle time in persist */
362
363#ifndef INET_SERVER
364#define TCP6_LISTEN_HASH_SIZE 17
365#define TCP6_CONN_HASH_SIZE 97
366#define TCP6_SYN_HASH_SIZE 293
367#define TCP6_SYN_BUCKET_SIZE 35
368#else
369#define TCP6_LISTEN_HASH_SIZE 97
370#define TCP6_CONN_HASH_SIZE 9973
371#define TCP6_SYN_HASH_SIZE 997
372#define TCP6_SYN_BUCKET_SIZE 35
373#endif
374int tcp6_listen_hash_size = TCP6_LISTEN_HASH_SIZE;
375int tcp6_conn_hash_size = TCP6_CONN_HASH_SIZE;
376struct tcp6_hash_list tcp6_listen_hash[TCP6_LISTEN_HASH_SIZE],
377 tcp6_conn_hash[TCP6_CONN_HASH_SIZE];
378
379int tcp6_syn_cache_size = TCP6_SYN_HASH_SIZE;
380int tcp6_syn_cache_limit = TCP6_SYN_HASH_SIZE*TCP6_SYN_BUCKET_SIZE;
381int tcp6_syn_bucket_limit = 3*TCP6_SYN_BUCKET_SIZE;
382struct syn_cache_head6 tcp6_syn_cache[TCP6_SYN_HASH_SIZE];
383struct syn_cache_head6 *tcp6_syn_cache_first;
384int tcp6_syn_cache_interval = 8; /* runs timer every 4 seconds */
385int tcp6_syn_cache_timeo = TCP6TV_KEEP_INIT;
386
387/*
388 * Parameters for computing a desirable data segment size
389 * given an upper bound (either interface MTU, or peer's MSS option)_.
390 * As applications tend to use a buffer size that is a multiple
391 * of kilobytes, try for something that divides evenly. However,
392 * do not round down too much.
393 *
394 * Round segment size down to a multiple of TCP6_ROUNDSIZE if this
395 * does not result in lowering by more than (size/TCP6_ROUNDFRAC).
396 * For example, round 536 to 512. Older versions of the system
397 * effectively used MCLBYTES (1K or 2K) as TCP6_ROUNDSIZE, with
398 * a value of 1 for TCP6_ROUNDFRAC (eliminating its effect).
399 * We round to a multiple of 256 for SLIP.
400 */
401#ifndef TCP6_ROUNDSIZE
402#define TCP6_ROUNDSIZE 256 /* round to multiple of 256 */
403#endif
404#ifndef TCP6_ROUNDFRAC
405#define TCP6_ROUNDFRAC 10 /* round down at most N/10, or 10% */
406#endif
407
408int tcp6_roundsize = TCP6_ROUNDSIZE;
409int tcp6_roundfrac = TCP6_ROUNDFRAC;
410#endif /*TCP6*/
411
309/* UDP on IP6 parameters */
310int udp6_sendspace = 9216; /* really max datagram size */
311int udp6_recvspace = 40 * (1024 + sizeof(struct sockaddr_in6));
312 /* 40 1K datagrams */
313
314/*
315 * sysctl related items.
316 */

--- 22 unchanged lines hidden (view full) ---

339 return (error);
340 old_ip6_forwarding = ip6_forwarding;
341 error = SYSCTL_IN(req, arg1, sizeof(int));
342 if (error != 0)
343 return (error);
344 changed = (ip6_forwarding ? 1 : 0) ^ (old_ip6_forwarding ? 1 : 0);
345 if (changed == 0)
346 return (error);
412/* UDP on IP6 parameters */
413int udp6_sendspace = 9216; /* really max datagram size */
414int udp6_recvspace = 40 * (1024 + sizeof(struct sockaddr_in6));
415 /* 40 1K datagrams */
416
417/*
418 * sysctl related items.
419 */

--- 22 unchanged lines hidden (view full) ---

442 return (error);
443 old_ip6_forwarding = ip6_forwarding;
444 error = SYSCTL_IN(req, arg1, sizeof(int));
445 if (error != 0)
446 return (error);
447 changed = (ip6_forwarding ? 1 : 0) ^ (old_ip6_forwarding ? 1 : 0);
448 if (changed == 0)
449 return (error);
450 /*
451 * XXX while host->router removes prefix got from RA,
452 * router->host case nukes all the prefixes managed by in6_prefix.c
453 * (both RR and static). therefore, switching from host->router->host
454 * will remove statically configured addresses/prefixes.
455 * not sure if it is intended behavior or not.
456 */
347 if (ip6_forwarding != 0) { /* host becomes router */
348 int s = splnet();
349 struct nd_prefix *pr, *next;
350
457 if (ip6_forwarding != 0) { /* host becomes router */
458 int s = splnet();
459 struct nd_prefix *pr, *next;
460
351 for (pr = LIST_FIRST(&nd_prefix); pr; pr = next) {
352 next = LIST_NEXT(pr, ndpr_entry);
461 for (pr = nd_prefix.lh_first; pr; pr = next) {
462 next = pr->ndpr_next;
353 if (!IN6_IS_ADDR_UNSPECIFIED(&pr->ndpr_addr))
354 in6_ifdel(pr->ndpr_ifp, &pr->ndpr_addr);
355 prelist_remove(pr);
356 }
357 splx(s);
358 } else { /* router becomes host */
463 if (!IN6_IS_ADDR_UNSPECIFIED(&pr->ndpr_addr))
464 in6_ifdel(pr->ndpr_ifp, &pr->ndpr_addr);
465 prelist_remove(pr);
466 }
467 splx(s);
468 } else { /* router becomes host */
359 struct socket so;
360
361 /* XXX: init dummy so */
362 bzero(&so, sizeof(so));
363 while(!LIST_EMPTY(&rr_prefix))
469 while(!LIST_EMPTY(&rr_prefix))
364 delete_each_prefix(&so, LIST_FIRST(&rr_prefix),
470 delete_each_prefix(LIST_FIRST(&rr_prefix),
365 PR_ORIG_KERNEL);
366 }
367
368 return (error);
369}
370
471 PR_ORIG_KERNEL);
472 }
473
474 return (error);
475}
476
477static int
478sysctl_icmp6_ratelimit (SYSCTL_HANDLER_ARGS)
479{
480 int rate_usec, error, s;
481
482 /*
483 * The sysctl specifies the rate in usec-between-icmp,
484 * so we must convert from/to a timeval.
485 */
486 rate_usec = (icmp6errratelim.tv_sec * 1000000) +
487 icmp6errratelim.tv_usec;
488 error = sysctl_handle_int(oidp, &rate_usec, 0, req);
489 if (error)
490 return (error);
491 if (rate_usec < 0)
492 return (EINVAL);
493 s = splnet();
494 icmp6errratelim.tv_sec = rate_usec / 1000000;
495 icmp6errratelim.tv_usec = rate_usec % 1000000;
496 splx(s);
497
498 return (0);
499}
500
371SYSCTL_OID(_net_inet6_ip6, IPV6CTL_FORWARDING, forwarding,
372 CTLTYPE_INT|CTLFLAG_RW, &ip6_forwarding, 0, sysctl_ip6_forwarding,
373 "I", "");
374SYSCTL_INT(_net_inet6_ip6, IPV6CTL_SENDREDIRECTS,
375 redirect, CTLFLAG_RW, &ip6_sendredirects, 0, "");
376SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM,
377 hlim, CTLFLAG_RW, &ip6_defhlim, 0, "");
378SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS,

--- 25 unchanged lines hidden (view full) ---

404
405/* net.inet6.icmp6 */
406SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT,
407 rediraccept, CTLFLAG_RW, &icmp6_rediraccept, 0, "");
408SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT,
409 redirtimeout, CTLFLAG_RW, &icmp6_redirtimeout, 0, "");
410SYSCTL_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RD,
411 &icmp6stat, icmp6stat, "");
501SYSCTL_OID(_net_inet6_ip6, IPV6CTL_FORWARDING, forwarding,
502 CTLTYPE_INT|CTLFLAG_RW, &ip6_forwarding, 0, sysctl_ip6_forwarding,
503 "I", "");
504SYSCTL_INT(_net_inet6_ip6, IPV6CTL_SENDREDIRECTS,
505 redirect, CTLFLAG_RW, &ip6_sendredirects, 0, "");
506SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM,
507 hlim, CTLFLAG_RW, &ip6_defhlim, 0, "");
508SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS,

--- 25 unchanged lines hidden (view full) ---

534
535/* net.inet6.icmp6 */
536SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT,
537 rediraccept, CTLFLAG_RW, &icmp6_rediraccept, 0, "");
538SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT,
539 redirtimeout, CTLFLAG_RW, &icmp6_redirtimeout, 0, "");
540SYSCTL_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RD,
541 &icmp6stat, icmp6stat, "");
412SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ERRRATELIMIT,
413 errratelimit, CTLFLAG_RW, &icmp6errratelim, 0, "");
542SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ERRRATELIMIT,
543 errratelimit, CTLTYPE_INT|CTLFLAG_RW,
544 0, sizeof(int), sysctl_icmp6_ratelimit, "I", "");
414SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE,
415 nd6_prune, CTLFLAG_RW, &nd6_prune, 0, "");
416SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DELAY,
417 nd6_delay, CTLFLAG_RW, &nd6_delay, 0, "");
418SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_UMAXTRIES,
419 nd6_umaxtries, CTLFLAG_RW, &nd6_umaxtries, 0, "");
420SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MMAXTRIES,
421 nd6_mmaxtries, CTLFLAG_RW, &nd6_mmaxtries, 0, "");
422SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK,
423 nd6_useloopback, CTLFLAG_RW, &nd6_useloopback, 0, "");
545SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE,
546 nd6_prune, CTLFLAG_RW, &nd6_prune, 0, "");
547SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DELAY,
548 nd6_delay, CTLFLAG_RW, &nd6_delay, 0, "");
549SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_UMAXTRIES,
550 nd6_umaxtries, CTLFLAG_RW, &nd6_umaxtries, 0, "");
551SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MMAXTRIES,
552 nd6_mmaxtries, CTLFLAG_RW, &nd6_mmaxtries, 0, "");
553SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK,
554 nd6_useloopback, CTLFLAG_RW, &nd6_useloopback, 0, "");
424SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PROXYALL,
425 nd6_proxyall, CTLFLAG_RW, &nd6_proxyall, 0, "");
555SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO,
556 nodeinfo, CTLFLAG_RW, &icmp6_nodeinfo, 0, "");
557SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ERRPPSLIMIT,
558 errppslimit, CTLFLAG_RW, &icmp6errppslim, 0, "");
559SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXNUDHINT,
560 nd6_maxnudhint, CTLFLAG_RW, &nd6_maxnudhint, 0, "");