in_proto.c revision 1.83 1 1.83 liamjfoy /* $NetBSD: in_proto.c,v 1.83 2007/03/05 00:50:53 liamjfoy Exp $ */
2 1.32 itojun
3 1.32 itojun /*
4 1.32 itojun * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5 1.32 itojun * All rights reserved.
6 1.56 itojun *
7 1.32 itojun * Redistribution and use in source and binary forms, with or without
8 1.32 itojun * modification, are permitted provided that the following conditions
9 1.32 itojun * are met:
10 1.32 itojun * 1. Redistributions of source code must retain the above copyright
11 1.32 itojun * notice, this list of conditions and the following disclaimer.
12 1.32 itojun * 2. Redistributions in binary form must reproduce the above copyright
13 1.32 itojun * notice, this list of conditions and the following disclaimer in the
14 1.32 itojun * documentation and/or other materials provided with the distribution.
15 1.32 itojun * 3. Neither the name of the project nor the names of its contributors
16 1.32 itojun * may be used to endorse or promote products derived from this software
17 1.32 itojun * without specific prior written permission.
18 1.56 itojun *
19 1.32 itojun * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20 1.32 itojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.32 itojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.32 itojun * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23 1.32 itojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.32 itojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.32 itojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.32 itojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.32 itojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.32 itojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.32 itojun * SUCH DAMAGE.
30 1.32 itojun */
31 1.9 cgd
32 1.1 cgd /*
33 1.8 mycroft * Copyright (c) 1982, 1986, 1993
34 1.8 mycroft * The Regents of the University of California. All rights reserved.
35 1.1 cgd *
36 1.1 cgd * Redistribution and use in source and binary forms, with or without
37 1.1 cgd * modification, are permitted provided that the following conditions
38 1.1 cgd * are met:
39 1.1 cgd * 1. Redistributions of source code must retain the above copyright
40 1.1 cgd * notice, this list of conditions and the following disclaimer.
41 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
42 1.1 cgd * notice, this list of conditions and the following disclaimer in the
43 1.1 cgd * documentation and/or other materials provided with the distribution.
44 1.59 agc * 3. Neither the name of the University nor the names of its contributors
45 1.1 cgd * may be used to endorse or promote products derived from this software
46 1.1 cgd * without specific prior written permission.
47 1.1 cgd *
48 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 1.1 cgd * SUCH DAMAGE.
59 1.1 cgd *
60 1.18 thorpej * @(#)in_proto.c 8.2 (Berkeley) 2/9/95
61 1.1 cgd */
62 1.51 lukem
63 1.51 lukem #include <sys/cdefs.h>
64 1.83 liamjfoy __KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.83 2007/03/05 00:50:53 liamjfoy Exp $");
65 1.19 scottr
66 1.19 scottr #include "opt_mrouting.h"
67 1.22 jonathan #include "opt_eon.h" /* ISO CLNL over IP */
68 1.22 jonathan #include "opt_iso.h" /* ISO TP tunneled over IP */
69 1.32 itojun #include "opt_inet.h"
70 1.33 thorpej #include "opt_ipsec.h"
71 1.65 manu #include "opt_pim.h"
72 1.1 cgd
73 1.5 mycroft #include <sys/param.h>
74 1.5 mycroft #include <sys/socket.h>
75 1.5 mycroft #include <sys/protosw.h>
76 1.5 mycroft #include <sys/domain.h>
77 1.5 mycroft #include <sys/mbuf.h>
78 1.1 cgd
79 1.8 mycroft #include <net/if.h>
80 1.8 mycroft #include <net/radix.h>
81 1.8 mycroft #include <net/route.h>
82 1.8 mycroft
83 1.5 mycroft #include <netinet/in.h>
84 1.5 mycroft #include <netinet/in_systm.h>
85 1.8 mycroft #include <netinet/ip.h>
86 1.8 mycroft #include <netinet/ip_var.h>
87 1.8 mycroft #include <netinet/ip_icmp.h>
88 1.78 dyoung #include <netinet/in_ifattach.h>
89 1.8 mycroft #include <netinet/in_pcb.h>
90 1.69 yamt #include <netinet/in_proto.h>
91 1.80 dyoung #include <netinet/in_route.h>
92 1.32 itojun
93 1.32 itojun #ifdef INET6
94 1.32 itojun #ifndef INET
95 1.32 itojun #include <netinet/in.h>
96 1.32 itojun #endif
97 1.32 itojun #include <netinet/ip6.h>
98 1.32 itojun #endif
99 1.32 itojun
100 1.8 mycroft #include <netinet/igmp_var.h>
101 1.65 manu #ifdef PIM
102 1.65 manu #include <netinet/pim_var.h>
103 1.65 manu #endif
104 1.8 mycroft #include <netinet/tcp.h>
105 1.8 mycroft #include <netinet/tcp_fsm.h>
106 1.8 mycroft #include <netinet/tcp_seq.h>
107 1.8 mycroft #include <netinet/tcp_timer.h>
108 1.8 mycroft #include <netinet/tcp_var.h>
109 1.8 mycroft #include <netinet/tcpip.h>
110 1.8 mycroft #include <netinet/tcp_debug.h>
111 1.8 mycroft #include <netinet/udp.h>
112 1.8 mycroft #include <netinet/udp_var.h>
113 1.39 itojun #include <netinet/ip_encap.h>
114 1.79 rpaulo
115 1.1 cgd /*
116 1.1 cgd * TCP/IP protocol family: IP, ICMP, UDP, TCP.
117 1.1 cgd */
118 1.1 cgd
119 1.32 itojun #ifdef IPSEC
120 1.58 itojun #include <netinet6/ipsec.h>
121 1.32 itojun #include <netinet6/ah.h>
122 1.32 itojun #ifdef IPSEC_ESP
123 1.32 itojun #include <netinet6/esp.h>
124 1.32 itojun #endif
125 1.32 itojun #include <netinet6/ipcomp.h>
126 1.32 itojun #endif /* IPSEC */
127 1.32 itojun
128 1.61 jonathan #ifdef FAST_IPSEC
129 1.61 jonathan #include <netipsec/ipsec.h>
130 1.61 jonathan #include <netipsec/key.h>
131 1.61 jonathan #endif /* FAST_IPSEC */
132 1.61 jonathan
133 1.1 cgd #ifdef TPIP
134 1.13 christos #include <netiso/tp_param.h>
135 1.13 christos #include <netiso/tp_var.h>
136 1.11 mycroft #endif /* TPIP */
137 1.1 cgd
138 1.1 cgd #ifdef EON
139 1.13 christos #include <netiso/eonvar.h>
140 1.8 mycroft #endif /* EON */
141 1.1 cgd
142 1.25 hwr #include "gre.h"
143 1.28 thorpej #if NGRE > 0
144 1.28 thorpej #include <netinet/ip_gre.h>
145 1.25 hwr #endif
146 1.25 hwr
147 1.72 liamjfoy #include "carp.h"
148 1.72 liamjfoy #if NCARP > 0
149 1.72 liamjfoy #include <netinet/ip_carp.h>
150 1.72 liamjfoy #endif
151 1.72 liamjfoy
152 1.79 rpaulo #include "etherip.h"
153 1.79 rpaulo #if NETHERIP > 0
154 1.79 rpaulo #include <netinet/ip_etherip.h>
155 1.79 rpaulo #endif
156 1.67 kim
157 1.66 matt DOMAIN_DEFINE(inetdomain); /* forward declare and add to link set */
158 1.66 matt
159 1.63 matt const struct protosw inetsw[] = {
160 1.81 liamjfoy { .pr_domain = &inetdomain,
161 1.81 liamjfoy .pr_init = ip_init,
162 1.81 liamjfoy .pr_output = ip_output,
163 1.81 liamjfoy .pr_slowtimo = ip_slowtimo,
164 1.81 liamjfoy .pr_drain = ip_drain,
165 1.81 liamjfoy },
166 1.81 liamjfoy { .pr_type = SOCK_DGRAM,
167 1.81 liamjfoy .pr_domain = &inetdomain,
168 1.81 liamjfoy .pr_protocol = IPPROTO_UDP,
169 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF,
170 1.81 liamjfoy .pr_input = udp_input,
171 1.81 liamjfoy .pr_ctlinput = udp_ctlinput,
172 1.81 liamjfoy .pr_ctloutput = udp_ctloutput,
173 1.81 liamjfoy .pr_usrreq = udp_usrreq,
174 1.81 liamjfoy .pr_init = udp_init,
175 1.81 liamjfoy },
176 1.81 liamjfoy { .pr_type = SOCK_STREAM,
177 1.81 liamjfoy .pr_domain = &inetdomain,
178 1.81 liamjfoy .pr_protocol = IPPROTO_TCP,
179 1.81 liamjfoy .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_ABRTACPTDIS|PR_PURGEIF,
180 1.81 liamjfoy .pr_input = tcp_input,
181 1.81 liamjfoy .pr_ctlinput = tcp_ctlinput,
182 1.81 liamjfoy .pr_ctloutput = tcp_ctloutput,
183 1.81 liamjfoy .pr_usrreq = tcp_usrreq,
184 1.81 liamjfoy .pr_init = tcp_init,
185 1.81 liamjfoy .pr_slowtimo = tcp_slowtimo,
186 1.81 liamjfoy .pr_drain = tcp_drain,
187 1.81 liamjfoy },
188 1.81 liamjfoy { .pr_type = SOCK_RAW,
189 1.81 liamjfoy .pr_domain = &inetdomain,
190 1.81 liamjfoy .pr_protocol = IPPROTO_RAW,
191 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF,
192 1.81 liamjfoy .pr_input = rip_input,
193 1.81 liamjfoy .pr_output = rip_output,
194 1.81 liamjfoy .pr_ctlinput = rip_ctlinput,
195 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
196 1.81 liamjfoy .pr_usrreq = rip_usrreq,
197 1.81 liamjfoy },
198 1.81 liamjfoy { .pr_type = SOCK_RAW,
199 1.81 liamjfoy .pr_domain = &inetdomain,
200 1.81 liamjfoy .pr_protocol = IPPROTO_ICMP,
201 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
202 1.81 liamjfoy .pr_input = icmp_input,
203 1.81 liamjfoy .pr_output = rip_output,
204 1.81 liamjfoy .pr_ctlinput = rip_ctlinput,
205 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
206 1.81 liamjfoy .pr_usrreq = rip_usrreq,
207 1.81 liamjfoy .pr_init = icmp_init,
208 1.8 mycroft },
209 1.83 liamjfoy #ifdef GATEWAY
210 1.83 liamjfoy { .pr_domain = &inetdomain,
211 1.83 liamjfoy .pr_protocol = IPPROTO_IP,
212 1.83 liamjfoy .pr_slowtimo = ipflow_slowtimo,
213 1.83 liamjfoy },
214 1.83 liamjfoy #endif /* GATEWAY */
215 1.32 itojun #ifdef IPSEC
216 1.81 liamjfoy { .pr_type = SOCK_RAW,
217 1.81 liamjfoy .pr_domain = &inetdomain,
218 1.81 liamjfoy .pr_protocol = IPPROTO_AH,
219 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR,
220 1.81 liamjfoy .pr_input = ah4_input,
221 1.81 liamjfoy .pr_ctlinput = ah4_ctlinput,
222 1.32 itojun },
223 1.32 itojun #ifdef IPSEC_ESP
224 1.81 liamjfoy { .pr_type = SOCK_RAW,
225 1.81 liamjfoy .pr_domain = &inetdomain,
226 1.81 liamjfoy .pr_protocol = IPPROTO_ESP,
227 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR,
228 1.81 liamjfoy .pr_input = esp4_input,
229 1.81 liamjfoy .pr_ctlinput = esp4_ctlinput,
230 1.81 liamjfoy },
231 1.81 liamjfoy #endif /* IPSEC_ESP */
232 1.81 liamjfoy { .pr_type = SOCK_RAW,
233 1.82 liamjfoy .pr_domain = &inetdomain,
234 1.81 liamjfoy .pr_protocol = IPPROTO_IPCOMP,
235 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR,
236 1.81 liamjfoy .pr_input = ipcomp4_input,
237 1.32 itojun },
238 1.32 itojun #endif /* IPSEC */
239 1.61 jonathan #ifdef FAST_IPSEC
240 1.81 liamjfoy { .pr_type = SOCK_RAW,
241 1.81 liamjfoy .pr_domain = &inetdomain,
242 1.81 liamjfoy .pr_protocol = IPPROTO_AH,
243 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR,
244 1.81 liamjfoy .pr_input = ipsec4_common_input,
245 1.81 liamjfoy .pr_ctlinput = ah4_ctlinput,
246 1.81 liamjfoy },
247 1.81 liamjfoy { .pr_type = SOCK_RAW,
248 1.81 liamjfoy .pr_domain = &inetdomain,
249 1.81 liamjfoy .pr_protocol = IPPROTO_ESP,
250 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR,
251 1.81 liamjfoy .pr_input = ipsec4_common_input,
252 1.81 liamjfoy .pr_ctlinput = esp4_ctlinput,
253 1.81 liamjfoy },
254 1.81 liamjfoy { .pr_type = SOCK_RAW,
255 1.81 liamjfoy .pr_domain = &inetdomain,
256 1.81 liamjfoy .pr_protocol = IPPROTO_IPCOMP,
257 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR,
258 1.81 liamjfoy .pr_input = ipsec4_common_input,
259 1.61 jonathan },
260 1.61 jonathan #endif /* FAST_IPSEC */
261 1.81 liamjfoy { .pr_type = SOCK_RAW,
262 1.81 liamjfoy .pr_domain = &inetdomain,
263 1.81 liamjfoy .pr_protocol = IPPROTO_IPV4,
264 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
265 1.81 liamjfoy .pr_input = encap4_input,
266 1.81 liamjfoy .pr_output = rip_output,
267 1.81 liamjfoy .pr_ctlinput = rip_ctlinput,
268 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
269 1.81 liamjfoy .pr_usrreq = rip_usrreq,
270 1.81 liamjfoy .pr_init = encap_init,
271 1.32 itojun },
272 1.32 itojun #ifdef INET6
273 1.81 liamjfoy { .pr_type = SOCK_RAW,
274 1.81 liamjfoy .pr_domain = &inetdomain,
275 1.81 liamjfoy .pr_protocol = IPPROTO_IPV6,
276 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
277 1.81 liamjfoy .pr_input = encap4_input,
278 1.81 liamjfoy .pr_output = rip_output,
279 1.81 liamjfoy .pr_ctlinput = rip_ctlinput,
280 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
281 1.81 liamjfoy .pr_usrreq = rip_usrreq,
282 1.81 liamjfoy .pr_init = encap_init,
283 1.32 itojun },
284 1.32 itojun #endif /* INET6 */
285 1.79 rpaulo #if NETHERIP > 0
286 1.81 liamjfoy { .pr_type = SOCK_RAW,
287 1.81 liamjfoy .pr_domain = &inetdomain,
288 1.81 liamjfoy .pr_protocol = IPPROTO_ETHERIP,
289 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
290 1.81 liamjfoy .pr_input = ip_etherip_input,
291 1.81 liamjfoy .pr_output = rip_output,
292 1.81 liamjfoy .pr_ctlinput = rip_ctlinput,
293 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
294 1.81 liamjfoy .pr_usrreq = rip_usrreq,
295 1.67 kim },
296 1.81 liamjfoy #endif /* NETHERIP > 0 */
297 1.72 liamjfoy #if NCARP > 0
298 1.81 liamjfoy { .pr_type = SOCK_RAW,
299 1.81 liamjfoy .pr_domain = &inetdomain,
300 1.81 liamjfoy .pr_protocol = IPPROTO_CARP,
301 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR,
302 1.81 liamjfoy .pr_input = carp_proto_input,
303 1.81 liamjfoy .pr_output = rip_output,
304 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
305 1.81 liamjfoy .pr_usrreq = rip_usrreq,
306 1.72 liamjfoy },
307 1.81 liamjfoy #endif /* NCARP > 0 */
308 1.25 hwr #if NGRE > 0
309 1.81 liamjfoy { .pr_type = SOCK_RAW,
310 1.81 liamjfoy .pr_domain = &inetdomain,
311 1.81 liamjfoy .pr_protocol = IPPROTO_GRE,
312 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
313 1.81 liamjfoy .pr_input = gre_input,
314 1.81 liamjfoy .pr_output = rip_output,
315 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
316 1.81 liamjfoy .pr_ctlinput = rip_ctlinput,
317 1.81 liamjfoy .pr_usrreq = rip_usrreq,
318 1.81 liamjfoy },
319 1.81 liamjfoy { .pr_type = SOCK_RAW,
320 1.81 liamjfoy .pr_domain = &inetdomain,
321 1.81 liamjfoy .pr_protocol = IPPROTO_MOBILE,
322 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
323 1.81 liamjfoy .pr_input = gre_mobile_input,
324 1.81 liamjfoy .pr_output = rip_output,
325 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
326 1.81 liamjfoy .pr_ctlinput = rip_ctlinput,
327 1.81 liamjfoy .pr_usrreq = rip_usrreq,
328 1.25 hwr },
329 1.28 thorpej #endif /* NGRE > 0 */
330 1.81 liamjfoy { .pr_type = SOCK_RAW,
331 1.81 liamjfoy .pr_domain = &inetdomain,
332 1.81 liamjfoy .pr_protocol = IPPROTO_IGMP,
333 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
334 1.81 liamjfoy .pr_input = igmp_input,
335 1.81 liamjfoy .pr_output = rip_output,
336 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
337 1.81 liamjfoy .pr_ctlinput = rip_ctlinput,
338 1.81 liamjfoy .pr_usrreq = rip_usrreq,
339 1.81 liamjfoy .pr_fasttimo = igmp_fasttimo,
340 1.81 liamjfoy .pr_slowtimo = igmp_slowtimo,
341 1.1 cgd },
342 1.65 manu #ifdef PIM
343 1.81 liamjfoy { .pr_type = SOCK_RAW,
344 1.81 liamjfoy .pr_domain = &inetdomain,
345 1.81 liamjfoy .pr_protocol = IPPROTO_PIM,
346 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
347 1.81 liamjfoy .pr_input = pim_input,
348 1.81 liamjfoy .pr_output = rip_output,
349 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
350 1.81 liamjfoy .pr_ctlinput = rip_ctlinput,
351 1.81 liamjfoy .pr_usrreq = rip_usrreq,
352 1.65 manu },
353 1.65 manu #endif /* PIM */
354 1.1 cgd #ifdef TPIP
355 1.81 liamjfoy { .pr_type = SOCK_SEQPACKET,
356 1.81 liamjfoy .pr_domain = &inetdomain,
357 1.81 liamjfoy .pr_protocol = IPPROTO_TP,
358 1.81 liamjfoy .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_LASTHDR|PR_ABRTACPTDIS,
359 1.81 liamjfoy .pr_input = tpip_input,
360 1.81 liamjfoy .pr_ctloutput = tp_ctloutput,
361 1.81 liamjfoy .pr_ctlinput = tpip_ctlinput,
362 1.81 liamjfoy .pr_usrreq = tp_usrreq,
363 1.81 liamjfoy .pr_init = tp_init,
364 1.81 liamjfoy .pr_slowtimo = tp_slowtimo,
365 1.81 liamjfoy .pr_drain = tp_drain,
366 1.1 cgd },
367 1.11 mycroft #endif /* TPIP */
368 1.45 itojun #ifdef ISO
369 1.1 cgd /* EON (ISO CLNL over IP) */
370 1.1 cgd #ifdef EON
371 1.81 liamjfoy { .pr_type = SOCK_RAW,
372 1.81 liamjfoy .pr_domain = &inetdomain,
373 1.81 liamjfoy .pr_protocol = IPPROTO_EON,
374 1.81 liamjfoy .pr_flags = PR_LASTHDR,
375 1.81 liamjfoy .pr_input = eoninput,
376 1.81 liamjfoy .pr_ctlinput = eonctlinput,
377 1.81 liamjfoy .pr_init = eonprotoinit,
378 1.4 hpeyerl },
379 1.45 itojun #else
380 1.81 liamjfoy { .pr_type = SOCK_RAW,
381 1.81 liamjfoy .pr_domain = &inetdomain,
382 1.81 liamjfoy .pr_protocol = IPPROTO_EON,
383 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
384 1.81 liamjfoy .pr_input = encap4_input,
385 1.81 liamjfoy .pr_output = rip_output,
386 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
387 1.81 liamjfoy .pr_ctlinput = rip_ctlinput,
388 1.81 liamjfoy .pr_usrreq = rip_usrreq,
389 1.81 liamjfoy .pr_init = encap_init,
390 1.45 itojun },
391 1.11 mycroft #endif /* EON */
392 1.45 itojun #endif /* ISO */
393 1.11 mycroft /* raw wildcard */
394 1.81 liamjfoy { .pr_type = SOCK_RAW,
395 1.81 liamjfoy .pr_domain = &inetdomain,
396 1.81 liamjfoy .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
397 1.81 liamjfoy .pr_input = rip_input,
398 1.81 liamjfoy .pr_output = rip_output,
399 1.81 liamjfoy .pr_ctloutput = rip_ctloutput,
400 1.81 liamjfoy .pr_ctlinput = rip_ctlinput,
401 1.81 liamjfoy .pr_usrreq = rip_usrreq,
402 1.81 liamjfoy .pr_init = rip_init,
403 1.1 cgd },
404 1.1 cgd };
405 1.1 cgd
406 1.73 matt extern struct ifqueue ipintrq;
407 1.73 matt
408 1.73 matt struct domain inetdomain = {
409 1.80 dyoung .dom_family = PF_INET, .dom_name = "internet", .dom_init = NULL,
410 1.80 dyoung .dom_externalize = NULL, .dom_dispose = NULL,
411 1.80 dyoung .dom_protosw = inetsw,
412 1.80 dyoung .dom_protoswNPROTOSW = &inetsw[sizeof(inetsw)/sizeof(inetsw[0])],
413 1.80 dyoung .dom_rtattach = rn_inithead,
414 1.80 dyoung .dom_rtoffset = 32, .dom_maxrtkey = sizeof(struct sockaddr_in),
415 1.78 dyoung #ifdef IPSELSRC
416 1.80 dyoung .dom_ifattach = in_domifattach,
417 1.80 dyoung .dom_ifdetach = in_domifdetach,
418 1.78 dyoung #else
419 1.80 dyoung .dom_ifattach = NULL,
420 1.80 dyoung .dom_ifdetach = NULL,
421 1.78 dyoung #endif
422 1.80 dyoung .dom_ifqueues = { &ipintrq, NULL },
423 1.80 dyoung .dom_link = { NULL },
424 1.80 dyoung .dom_mowner = MOWNER_INIT("",""),
425 1.80 dyoung .dom_rtcache = in_rtcache,
426 1.80 dyoung .dom_rtflush = in_rtflush,
427 1.80 dyoung .dom_rtflushall = in_rtflushall
428 1.73 matt };
429 1.38 darrenr
430 1.38 darrenr u_char ip_protox[IPPROTO_MAX];
431 1.36 thorpej
432 1.40 itojun int icmperrppslim = 100; /* 100pps */
433