Add a sysctl jail.allow_raw_sockets (default to diabled) which allows
[dragonfly.git] / sys / netinet / raw_ip.c
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
34  * $FreeBSD: src/sys/netinet/raw_ip.c,v 1.64.2.16 2003/08/24 08:24:38 hsu Exp $
35  * $DragonFly: src/sys/netinet/raw_ip.c,v 1.28 2008/05/17 18:20:32 dillon Exp $
36  */
37
38 #include "opt_inet6.h"
39 #include "opt_ipsec.h"
40
41 #include <sys/param.h>
42 #include <sys/systm.h>
43 #include <sys/kernel.h>
44 #include <sys/jail.h>
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>
52 #include <sys/thread2.h>
53
54 #include <machine/stdarg.h>
55
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>
68
69 #include <net/ip_mroute/ip_mroute.h>
70 #include <net/ipfw/ip_fw.h>
71 #include <net/dummynet/ip_dummynet.h>
72
73 #ifdef FAST_IPSEC
74 #include <netproto/ipsec/ipsec.h>
75 #endif /*FAST_IPSEC*/
76
77 #ifdef IPSEC
78 #include <netinet6/ipsec.h>
79 #endif /*IPSEC*/
80
81 struct  inpcbinfo ripcbinfo;
82
83 /* control hooks for ipfw and dummynet */
84 ip_fw_ctl_t *ip_fw_ctl_ptr;
85 ip_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.  */
93 struct socket  *ip_mrouter;
94
95 /* The various mrouter and rsvp functions */
96 int (*ip_mrouter_set)(struct socket *, struct sockopt *);
97 int (*ip_mrouter_get)(struct socket *, struct sockopt *);
98 int (*ip_mrouter_done)(void);
99 int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
100                 struct ip_moptions *);
101 int (*mrt_ioctl)(int, caddr_t);
102 int (*legal_vif_num)(int);
103 u_long (*ip_mcast_src)(int);
104
105 void (*rsvp_input_p)(struct mbuf *m, ...);
106 int (*ip_rsvp_vif)(struct socket *, struct sockopt *);
107 void (*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  */
122 void
123 rip_init(void)
124 {
125         in_pcbinfo_init(&ripcbinfo);
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);
133         ripcbinfo.wildcardhashbase = hashinit(1, M_PCB,
134                                               &ripcbinfo.wildcardhashmask);
135         ripcbinfo.ipi_zone = zinit("ripcb", sizeof(struct inpcb),
136                                    maxsockets, ZONE_INTERRUPT, 0);
137 }
138
139 /*
140  * Setup generic address and protocol structures
141  * for raw_input routine, then pass them along with
142  * mbuf chain.
143  */
144 void
145 rip_input(struct mbuf *m, ...)
146 {
147         struct sockaddr_in ripsrc = { sizeof ripsrc, AF_INET };
148         struct ip *ip = mtod(m, struct ip *);
149         struct inpcb *inp;
150         struct inpcb *last = NULL;
151         struct mbuf *opts = NULL;
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);
159
160         ripsrc.sin_addr = ip->ip_src;
161         LIST_FOREACH(inp, &ripcbinfo.pcblisthead, inp_list) {
162                 if (inp->inp_flags & INP_PLACEMARKER)
163                         continue;
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) {
177                         struct mbuf *n = m_copypacket(m, MB_DONTWAIT);
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);
198                                 if (ssb_appendaddr(&last->inp_socket->so_rcv,
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*/
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) {
234                 if (last->inp_flags & INP_CONTROLOPTS ||
235                     last->inp_socket->so_options & SO_TIMESTAMP)
236                         ip_savecontrol(last, &opts, ip, m);
237                 if (ssb_appendaddr(&last->inp_socket->so_rcv,
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  */
255 int
256 rip_output(struct mbuf *m, struct socket *so, ...)
257 {
258         struct ip *ip;
259         struct inpcb *inp = so->so_pcb;
260         __va_list ap;
261         int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
262         u_long dst;
263
264         __va_start(ap, so);
265         dst = __va_arg(ap, u_long);
266         __va_end(ap);
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                 }
277                 M_PREPEND(m, sizeof(struct ip), MB_WAIT);
278                 if (m == NULL)
279                         return(ENOBUFS);
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 */
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))) {
300                         m_freem(m);
301                         return EINVAL;
302                 }
303                 if (ip->ip_id == 0)
304                         ip->ip_id = ip_newid();
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  */
317 int
318 rip_ctloutput(struct socket *so, struct sockopt *sopt)
319 {
320         struct  inpcb *inp = so->so_pcb;
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:
345                         error = ip_dn_sockopt(sopt);
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:
356                 case MRT_API_SUPPORT:
357                 case MRT_API_CONFIG:
358                 case MRT_ADD_BW_UPCALL:
359                 case MRT_DEL_BW_UPCALL:
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:
397                         error = ip_dn_sockopt(sopt);
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:
422                 case MRT_API_SUPPORT:
423                 case MRT_API_CONFIG:
424                 case MRT_ADD_BW_UPCALL:
425                 case MRT_DEL_BW_UPCALL:
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  */
447 void
448 rip_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) {
458                         if (ia->ia_ifa.ifa_addr == sa &&
459                             (ia->ia_flags & IFA_ROUTE)) {
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
486                 if ((ifp->if_flags & IFF_LOOPBACK) ||
487                     (ifp->if_flags & IFF_POINTOPOINT))
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
497 u_long  rip_sendspace = RIPSNDQ;
498 u_long  rip_recvspace = RIPRCVQ;
499
500 SYSCTL_INT(_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW,
501     &rip_sendspace, 0, "Maximum outgoing raw IP datagram size");
502 SYSCTL_INT(_net_inet_raw, OID_AUTO, recvspace, CTLFLAG_RW,
503     &rip_recvspace, 0, "Maximum incoming raw IP datagram size");
504
505 static int
506 rip_attach(struct socket *so, int proto, struct pru_attach_info *ai)
507 {
508         struct inpcb *inp;
509         int error;
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;
516
517         inp = so->so_pcb;
518         if (inp)
519                 panic("rip_attach");
520         if ((error = suser_cred(ai->p_ucred, flag)) != 0)
521                 return error;
522
523         error = soreserve(so, rip_sendspace, rip_recvspace, ai->sb_rlimit);
524         if (error)
525                 return error;
526         crit_enter();
527         error = in_pcballoc(so, &ripcbinfo);
528         crit_exit();
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
538 static int
539 rip_detach(struct socket *so)
540 {
541         struct inpcb *inp;
542
543         inp = so->so_pcb;
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
556 static int
557 rip_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
565 static int
566 rip_disconnect(struct socket *so)
567 {
568         if ((so->so_state & SS_ISCONNECTED) == 0)
569                 return ENOTCONN;
570         return rip_abort(so);
571 }
572
573 static int
574 rip_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
575 {
576         struct inpcb *inp = so->so_pcb;
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
591 static int
592 rip_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
593 {
594         struct inpcb *inp = so->so_pcb;
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
609 static int
610 rip_shutdown(struct socket *so)
611 {
612         socantsendmore(so);
613         return 0;
614 }
615
616 static int
617 rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
618          struct mbuf *control, struct thread *td)
619 {
620         struct inpcb *inp = so->so_pcb;
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
639 SYSCTL_PROC(_net_inet_raw, OID_AUTO/*XXX*/, pcblist, CTLFLAG_RD, &ripcbinfo, 0,
640             in_pcblist_global, "S,xinpcb", "List of active raw IP sockets");
641
642 struct pr_usrreqs rip_usrreqs = {
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
663 };