Add a sysctl jail.allow_raw_sockets (default to diabled) which allows
[dragonfly.git] / sys / netinet / raw_ip.c
CommitLineData
984263bc
MD
1/*
2 * Copyright (c) 1982, 1986, 1988, 1993
3 * The Regents of the University of California. 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
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
f1f552f6 34 * $FreeBSD: src/sys/netinet/raw_ip.c,v 1.64.2.16 2003/08/24 08:24:38 hsu Exp $
7b09fb68 35 * $DragonFly: src/sys/netinet/raw_ip.c,v 1.28 2008/05/17 18:20:32 dillon Exp $
984263bc
MD
36 */
37
38#include "opt_inet6.h"
39#include "opt_ipsec.h"
984263bc
MD
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/kernel.h>
7b09fb68 44#include <sys/jail.h>
984263bc
MD
45#include <sys/malloc.h>
46#include <sys/mbuf.h>
47#include <sys/proc.h>
48#include <sys/protosw.h>
49#include <sys/socket.h>
50#include <sys/socketvar.h>
51#include <sys/sysctl.h>
1cae611f 52#include <sys/thread2.h>
984263bc 53
deffea2e
JS
54#include <machine/stdarg.h>
55
984263bc
MD
56#include <vm/vm_zone.h>
57
58#include <net/if.h>
59#include <net/route.h>
60
61#define _IP_VHL
62#include <netinet/in.h>
63#include <netinet/in_systm.h>
64#include <netinet/ip.h>
65#include <netinet/in_pcb.h>
66#include <netinet/in_var.h>
67#include <netinet/ip_var.h>
984263bc 68
1f2de5d4
MD
69#include <net/ip_mroute/ip_mroute.h>
70#include <net/ipfw/ip_fw.h>
71#include <net/dummynet/ip_dummynet.h>
984263bc
MD
72
73#ifdef FAST_IPSEC
bf844ffa 74#include <netproto/ipsec/ipsec.h>
984263bc
MD
75#endif /*FAST_IPSEC*/
76
77#ifdef IPSEC
78#include <netinet6/ipsec.h>
79#endif /*IPSEC*/
80
984263bc
MD
81struct inpcbinfo ripcbinfo;
82
83/* control hooks for ipfw and dummynet */
84ip_fw_ctl_t *ip_fw_ctl_ptr;
85ip_dn_ctl_t *ip_dn_ctl_ptr;
86
87/*
88 * hooks for multicast routing. They all default to NULL,
89 * so leave them not initialized and rely on BSS being set to 0.
90 */
91
92/* The socket used to communicate with the multicast routing daemon. */
93struct socket *ip_mrouter;
94
95/* The various mrouter and rsvp functions */
96int (*ip_mrouter_set)(struct socket *, struct sockopt *);
97int (*ip_mrouter_get)(struct socket *, struct sockopt *);
98int (*ip_mrouter_done)(void);
99int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
100 struct ip_moptions *);
101int (*mrt_ioctl)(int, caddr_t);
102int (*legal_vif_num)(int);
103u_long (*ip_mcast_src)(int);
104
a00138cb 105void (*rsvp_input_p)(struct mbuf *m, ...);
984263bc
MD
106int (*ip_rsvp_vif)(struct socket *, struct sockopt *);
107void (*ip_rsvp_force_done)(struct socket *);
108
109/*
110 * Nominal space allocated to a raw ip socket.
111 */
112#define RIPSNDQ 8192
113#define RIPRCVQ 8192
114
115/*
116 * Raw interface to IP protocol.
117 */
118
119/*
120 * Initialize raw connection block queue.
121 */
122void
123rip_init(void)
124{
d2e9e54c 125 in_pcbinfo_init(&ripcbinfo);
984263bc
MD
126 /*
127 * XXX We don't use the hash list for raw IP, but it's easier
128 * to allocate a one entry hash list than it is to check all
129 * over the place for hashbase == NULL.
130 */
131 ripcbinfo.hashbase = hashinit(1, M_PCB, &ripcbinfo.hashmask);
132 ripcbinfo.porthashbase = hashinit(1, M_PCB, &ripcbinfo.porthashmask);
2322f6ca
JH
133 ripcbinfo.wildcardhashbase = hashinit(1, M_PCB,
134 &ripcbinfo.wildcardhashmask);
984263bc
MD
135 ripcbinfo.ipi_zone = zinit("ripcb", sizeof(struct inpcb),
136 maxsockets, ZONE_INTERRUPT, 0);
137}
138
984263bc
MD
139/*
140 * Setup generic address and protocol structures
141 * for raw_input routine, then pass them along with
142 * mbuf chain.
143 */
144void
a00138cb 145rip_input(struct mbuf *m, ...)
984263bc 146{
668488bd 147 struct sockaddr_in ripsrc = { sizeof ripsrc, AF_INET };
984263bc
MD
148 struct ip *ip = mtod(m, struct ip *);
149 struct inpcb *inp;
150 struct inpcb *last = NULL;
151 struct mbuf *opts = NULL;
a00138cb
JS
152 int off, proto;
153 __va_list ap;
154
155 __va_start(ap, m);
156 off = __va_arg(ap, int);
157 proto = __va_arg(ap, int);
158 __va_end(ap);
984263bc
MD
159
160 ripsrc.sin_addr = ip->ip_src;
d2e9e54c
MD
161 LIST_FOREACH(inp, &ripcbinfo.pcblisthead, inp_list) {
162 if (inp->inp_flags & INP_PLACEMARKER)
163 continue;
984263bc
MD
164#ifdef INET6
165 if ((inp->inp_vflag & INP_IPV4) == 0)
166 continue;
167#endif
168 if (inp->inp_ip_p && inp->inp_ip_p != proto)
169 continue;
170 if (inp->inp_laddr.s_addr != INADDR_ANY &&
171 inp->inp_laddr.s_addr != ip->ip_dst.s_addr)
172 continue;
173 if (inp->inp_faddr.s_addr != INADDR_ANY &&
174 inp->inp_faddr.s_addr != ip->ip_src.s_addr)
175 continue;
176 if (last) {
74f1caca 177 struct mbuf *n = m_copypacket(m, MB_DONTWAIT);
984263bc
MD
178
179#ifdef IPSEC
180 /* check AH/ESP integrity. */
181 if (n && ipsec4_in_reject_so(n, last->inp_socket)) {
182 m_freem(n);
183 ipsecstat.in_polvio++;
184 /* do not inject data to pcb */
185 } else
186#endif /*IPSEC*/
187#ifdef FAST_IPSEC
188 /* check AH/ESP integrity. */
189 if (ipsec4_in_reject(n, last)) {
190 m_freem(n);
191 /* do not inject data to pcb */
192 } else
193#endif /*FAST_IPSEC*/
194 if (n) {
195 if (last->inp_flags & INP_CONTROLOPTS ||
196 last->inp_socket->so_options & SO_TIMESTAMP)
197 ip_savecontrol(last, &opts, ip, n);
6d49aa6f 198 if (ssb_appendaddr(&last->inp_socket->so_rcv,
984263bc
MD
199 (struct sockaddr *)&ripsrc, n,
200 opts) == 0) {
201 /* should notify about lost packet */
202 m_freem(n);
203 if (opts)
204 m_freem(opts);
205 } else
206 sorwakeup(last->inp_socket);
207 opts = 0;
208 }
209 }
210 last = inp;
211 }
212#ifdef IPSEC
213 /* check AH/ESP integrity. */
214 if (last && ipsec4_in_reject_so(m, last->inp_socket)) {
215 m_freem(m);
216 ipsecstat.in_polvio++;
217 ipstat.ips_delivered--;
218 /* do not inject data to pcb */
219 } else
220#endif /*IPSEC*/
221#ifdef FAST_IPSEC
222 /* check AH/ESP integrity. */
223 if (last && ipsec4_in_reject(m, last)) {
224 m_freem(m);
225 ipstat.ips_delivered--;
226 /* do not inject data to pcb */
227 } else
228#endif /*FAST_IPSEC*/
95926362
MD
229 /* Check the minimum TTL for socket. */
230 if (last && ip->ip_ttl < last->inp_ip_minttl) {
231 m_freem(opts);
232 ipstat.ips_delivered--;
233 } else if (last) {
984263bc
MD
234 if (last->inp_flags & INP_CONTROLOPTS ||
235 last->inp_socket->so_options & SO_TIMESTAMP)
236 ip_savecontrol(last, &opts, ip, m);
6d49aa6f 237 if (ssb_appendaddr(&last->inp_socket->so_rcv,
984263bc
MD
238 (struct sockaddr *)&ripsrc, m, opts) == 0) {
239 m_freem(m);
240 if (opts)
241 m_freem(opts);
242 } else
243 sorwakeup(last->inp_socket);
244 } else {
245 m_freem(m);
246 ipstat.ips_noproto++;
247 ipstat.ips_delivered--;
248 }
249}
250
251/*
252 * Generate IP header and pass packet to ip_output.
253 * Tack on options user may have setup with control call.
254 */
255int
deffea2e 256rip_output(struct mbuf *m, struct socket *so, ...)
984263bc
MD
257{
258 struct ip *ip;
ed894f8c 259 struct inpcb *inp = so->so_pcb;
deffea2e 260 __va_list ap;
984263bc 261 int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
deffea2e
JS
262 u_long dst;
263
264 __va_start(ap, so);
265 dst = __va_arg(ap, u_long);
266 __va_end(ap);
984263bc
MD
267
268 /*
269 * If the user handed us a complete IP packet, use it.
270 * Otherwise, allocate an mbuf for a header and fill it in.
271 */
272 if ((inp->inp_flags & INP_HDRINCL) == 0) {
273 if (m->m_pkthdr.len + sizeof(struct ip) > IP_MAXPACKET) {
274 m_freem(m);
275 return(EMSGSIZE);
276 }
74f1caca 277 M_PREPEND(m, sizeof(struct ip), MB_WAIT);
0cc6c79e
HP
278 if (m == NULL)
279 return(ENOBUFS);
984263bc
MD
280 ip = mtod(m, struct ip *);
281 ip->ip_tos = inp->inp_ip_tos;
282 ip->ip_off = 0;
283 ip->ip_p = inp->inp_ip_p;
284 ip->ip_len = m->m_pkthdr.len;
285 ip->ip_src = inp->inp_laddr;
286 ip->ip_dst.s_addr = dst;
287 ip->ip_ttl = inp->inp_ip_ttl;
288 } else {
289 if (m->m_pkthdr.len > IP_MAXPACKET) {
290 m_freem(m);
291 return(EMSGSIZE);
292 }
293 ip = mtod(m, struct ip *);
294 /* don't allow both user specified and setsockopt options,
295 and don't allow packet length sizes that will crash */
be23faf1
JH
296 if (((IP_VHL_HL(ip->ip_vhl) != (sizeof (*ip) >> 2)) &&
297 inp->inp_options) ||
298 (ip->ip_len > m->m_pkthdr.len) ||
299 (ip->ip_len < (IP_VHL_HL(ip->ip_vhl) << 2))) {
984263bc
MD
300 m_freem(m);
301 return EINVAL;
302 }
303 if (ip->ip_id == 0)
6277137d 304 ip->ip_id = ip_newid();
984263bc
MD
305 /* XXX prevent ip_output from overwriting header fields */
306 flags |= IP_RAWOUTPUT;
307 ipstat.ips_rawout++;
308 }
309
310 return (ip_output(m, inp->inp_options, &inp->inp_route, flags,
311 inp->inp_moptions, inp));
312}
313
314/*
315 * Raw IP socket option processing.
316 */
317int
318rip_ctloutput(struct socket *so, struct sockopt *sopt)
319{
ed894f8c 320 struct inpcb *inp = so->so_pcb;
984263bc
MD
321 int error, optval;
322
323 if (sopt->sopt_level != IPPROTO_IP)
324 return (EINVAL);
325
326 error = 0;
327
328 switch (sopt->sopt_dir) {
329 case SOPT_GET:
330 switch (sopt->sopt_name) {
331 case IP_HDRINCL:
332 optval = inp->inp_flags & INP_HDRINCL;
333 error = sooptcopyout(sopt, &optval, sizeof optval);
334 break;
335
336 case IP_FW_ADD: /* ADD actually returns the body... */
337 case IP_FW_GET:
338 if (IPFW_LOADED)
339 error = ip_fw_ctl_ptr(sopt);
340 else
341 error = ENOPROTOOPT;
342 break;
343
344 case IP_DUMMYNET_GET:
879652a3 345 error = ip_dn_sockopt(sopt);
984263bc
MD
346 break ;
347
348 case MRT_INIT:
349 case MRT_DONE:
350 case MRT_ADD_VIF:
351 case MRT_DEL_VIF:
352 case MRT_ADD_MFC:
353 case MRT_DEL_MFC:
354 case MRT_VERSION:
355 case MRT_ASSERT:
f1f552f6
JH
356 case MRT_API_SUPPORT:
357 case MRT_API_CONFIG:
358 case MRT_ADD_BW_UPCALL:
359 case MRT_DEL_BW_UPCALL:
984263bc
MD
360 error = ip_mrouter_get ? ip_mrouter_get(so, sopt) :
361 EOPNOTSUPP;
362 break;
363
364 default:
365 error = ip_ctloutput(so, sopt);
366 break;
367 }
368 break;
369
370 case SOPT_SET:
371 switch (sopt->sopt_name) {
372 case IP_HDRINCL:
373 error = sooptcopyin(sopt, &optval, sizeof optval,
374 sizeof optval);
375 if (error)
376 break;
377 if (optval)
378 inp->inp_flags |= INP_HDRINCL;
379 else
380 inp->inp_flags &= ~INP_HDRINCL;
381 break;
382
383 case IP_FW_ADD:
384 case IP_FW_DEL:
385 case IP_FW_FLUSH:
386 case IP_FW_ZERO:
387 case IP_FW_RESETLOG:
388 if (IPFW_LOADED)
389 error = ip_fw_ctl_ptr(sopt);
390 else
391 error = ENOPROTOOPT;
392 break;
393
394 case IP_DUMMYNET_CONFIGURE:
395 case IP_DUMMYNET_DEL:
396 case IP_DUMMYNET_FLUSH:
879652a3 397 error = ip_dn_sockopt(sopt);
984263bc
MD
398 break ;
399
400 case IP_RSVP_ON:
401 error = ip_rsvp_init(so);
402 break;
403
404 case IP_RSVP_OFF:
405 error = ip_rsvp_done();
406 break;
407
408 case IP_RSVP_VIF_ON:
409 case IP_RSVP_VIF_OFF:
410 error = ip_rsvp_vif ?
411 ip_rsvp_vif(so, sopt) : EINVAL;
412 break;
413
414 case MRT_INIT:
415 case MRT_DONE:
416 case MRT_ADD_VIF:
417 case MRT_DEL_VIF:
418 case MRT_ADD_MFC:
419 case MRT_DEL_MFC:
420 case MRT_VERSION:
421 case MRT_ASSERT:
f1f552f6
JH
422 case MRT_API_SUPPORT:
423 case MRT_API_CONFIG:
424 case MRT_ADD_BW_UPCALL:
425 case MRT_DEL_BW_UPCALL:
984263bc
MD
426 error = ip_mrouter_set ? ip_mrouter_set(so, sopt) :
427 EOPNOTSUPP;
428 break;
429
430 default:
431 error = ip_ctloutput(so, sopt);
432 break;
433 }
434 break;
435 }
436
437 return (error);
438}
439
440/*
441 * This function exists solely to receive the PRC_IFDOWN messages which
442 * are sent by if_down(). It looks for an ifaddr whose ifa_addr is sa,
443 * and calls in_ifadown() to remove all routes corresponding to that address.
444 * It also receives the PRC_IFUP messages from if_up() and reinstalls the
445 * interface routes.
446 */
447void
448rip_ctlinput(int cmd, struct sockaddr *sa, void *vip)
449{
450 struct in_ifaddr *ia;
451 struct ifnet *ifp;
452 int err;
453 int flags;
454
455 switch (cmd) {
456 case PRC_IFDOWN:
457 TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) {
be23faf1
JH
458 if (ia->ia_ifa.ifa_addr == sa &&
459 (ia->ia_flags & IFA_ROUTE)) {
984263bc
MD
460 /*
461 * in_ifscrub kills the interface route.
462 */
463 in_ifscrub(ia->ia_ifp, ia);
464 /*
465 * in_ifadown gets rid of all the rest of
466 * the routes. This is not quite the right
467 * thing to do, but at least if we are running
468 * a routing process they will come back.
469 */
470 in_ifadown(&ia->ia_ifa, 0);
471 break;
472 }
473 }
474 break;
475
476 case PRC_IFUP:
477 TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) {
478 if (ia->ia_ifa.ifa_addr == sa)
479 break;
480 }
481 if (ia == 0 || (ia->ia_flags & IFA_ROUTE))
482 return;
483 flags = RTF_UP;
484 ifp = ia->ia_ifa.ifa_ifp;
485
be23faf1
JH
486 if ((ifp->if_flags & IFF_LOOPBACK) ||
487 (ifp->if_flags & IFF_POINTOPOINT))
984263bc
MD
488 flags |= RTF_HOST;
489
490 err = rtinit(&ia->ia_ifa, RTM_ADD, flags);
491 if (err == 0)
492 ia->ia_flags |= IFA_ROUTE;
493 break;
494 }
495}
496
497u_long rip_sendspace = RIPSNDQ;
498u_long rip_recvspace = RIPRCVQ;
499
500SYSCTL_INT(_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW,
501 &rip_sendspace, 0, "Maximum outgoing raw IP datagram size");
502SYSCTL_INT(_net_inet_raw, OID_AUTO, recvspace, CTLFLAG_RW,
503 &rip_recvspace, 0, "Maximum incoming raw IP datagram size");
504
505static int
e4700d00 506rip_attach(struct socket *so, int proto, struct pru_attach_info *ai)
984263bc
MD
507{
508 struct inpcb *inp;
1cae611f 509 int error;
7b09fb68
MD
510 int flag;
511
512 flag = NULL_CRED_OKAY;
513
514 if( jailed(ai->p_ucred) && jail_allow_raw_sockets )
515 flag = flag | PRISON_ROOT;
984263bc 516
ed894f8c 517 inp = so->so_pcb;
984263bc
MD
518 if (inp)
519 panic("rip_attach");
7b09fb68 520 if ((error = suser_cred(ai->p_ucred, flag)) != 0)
984263bc
MD
521 return error;
522
e4700d00 523 error = soreserve(so, rip_sendspace, rip_recvspace, ai->sb_rlimit);
984263bc
MD
524 if (error)
525 return error;
1cae611f 526 crit_enter();
e4700d00 527 error = in_pcballoc(so, &ripcbinfo);
1cae611f 528 crit_exit();
984263bc
MD
529 if (error)
530 return error;
531 inp = (struct inpcb *)so->so_pcb;
532 inp->inp_vflag |= INP_IPV4;
533 inp->inp_ip_p = proto;
534 inp->inp_ip_ttl = ip_defttl;
535 return 0;
536}
537
538static int
539rip_detach(struct socket *so)
540{
541 struct inpcb *inp;
542
ed894f8c 543 inp = so->so_pcb;
984263bc
MD
544 if (inp == 0)
545 panic("rip_detach");
546 if (so == ip_mrouter && ip_mrouter_done)
547 ip_mrouter_done();
548 if (ip_rsvp_force_done)
549 ip_rsvp_force_done(so);
550 if (so == ip_rsvpd)
551 ip_rsvp_done();
552 in_pcbdetach(inp);
553 return 0;
554}
555
556static int
557rip_abort(struct socket *so)
558{
559 soisdisconnected(so);
560 if (so->so_state & SS_NOFDREF)
561 return rip_detach(so);
562 return 0;
563}
564
565static int
566rip_disconnect(struct socket *so)
567{
568 if ((so->so_state & SS_ISCONNECTED) == 0)
569 return ENOTCONN;
570 return rip_abort(so);
571}
572
573static int
dadab5e9 574rip_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
984263bc 575{
ed894f8c 576 struct inpcb *inp = so->so_pcb;
984263bc
MD
577 struct sockaddr_in *addr = (struct sockaddr_in *)nam;
578
579 if (nam->sa_len != sizeof(*addr))
580 return EINVAL;
581
582 if (TAILQ_EMPTY(&ifnet) || ((addr->sin_family != AF_INET) &&
583 (addr->sin_family != AF_IMPLINK)) ||
584 (addr->sin_addr.s_addr != INADDR_ANY &&
585 ifa_ifwithaddr((struct sockaddr *)addr) == 0))
586 return EADDRNOTAVAIL;
587 inp->inp_laddr = addr->sin_addr;
588 return 0;
589}
590
591static int
dadab5e9 592rip_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
984263bc 593{
ed894f8c 594 struct inpcb *inp = so->so_pcb;
984263bc
MD
595 struct sockaddr_in *addr = (struct sockaddr_in *)nam;
596
597 if (nam->sa_len != sizeof(*addr))
598 return EINVAL;
599 if (TAILQ_EMPTY(&ifnet))
600 return EADDRNOTAVAIL;
601 if ((addr->sin_family != AF_INET) &&
602 (addr->sin_family != AF_IMPLINK))
603 return EAFNOSUPPORT;
604 inp->inp_faddr = addr->sin_addr;
605 soisconnected(so);
606 return 0;
607}
608
609static int
610rip_shutdown(struct socket *so)
611{
612 socantsendmore(so);
613 return 0;
614}
615
616static int
617rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
dadab5e9 618 struct mbuf *control, struct thread *td)
984263bc 619{
ed894f8c 620 struct inpcb *inp = so->so_pcb;
984263bc
MD
621 u_long dst;
622
623 if (so->so_state & SS_ISCONNECTED) {
624 if (nam) {
625 m_freem(m);
626 return EISCONN;
627 }
628 dst = inp->inp_faddr.s_addr;
629 } else {
630 if (nam == NULL) {
631 m_freem(m);
632 return ENOTCONN;
633 }
634 dst = ((struct sockaddr_in *)nam)->sin_addr.s_addr;
635 }
636 return rip_output(m, so, dst);
637}
638
48a2763f
JS
639SYSCTL_PROC(_net_inet_raw, OID_AUTO/*XXX*/, pcblist, CTLFLAG_RD, &ripcbinfo, 0,
640 in_pcblist_global, "S,xinpcb", "List of active raw IP sockets");
984263bc
MD
641
642struct pr_usrreqs rip_usrreqs = {
fa5e758c
MD
643 .pru_abort = rip_abort,
644 .pru_accept = pru_accept_notsupp,
645 .pru_attach = rip_attach,
646 .pru_bind = rip_bind,
647 .pru_connect = rip_connect,
648 .pru_connect2 = pru_connect2_notsupp,
649 .pru_control = in_control,
650 .pru_detach = rip_detach,
651 .pru_disconnect = rip_disconnect,
652 .pru_listen = pru_listen_notsupp,
653 .pru_peeraddr = in_setpeeraddr,
654 .pru_rcvd = pru_rcvd_notsupp,
655 .pru_rcvoob = pru_rcvoob_notsupp,
656 .pru_send = rip_send,
657 .pru_sense = pru_sense_null,
658 .pru_shutdown = rip_shutdown,
659 .pru_sockaddr = in_setsockaddr,
660 .pru_sosend = sosend,
661 .pru_soreceive = soreceive,
662 .pru_sopoll = sopoll
984263bc 663};