xref: /dragonfly/sys/netinet/raw_ip.c (revision f0e61bb7)
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. Neither the name of the University nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS 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.
28  *
29  *	@(#)raw_ip.c	8.7 (Berkeley) 5/15/95
30  * $FreeBSD: src/sys/netinet/raw_ip.c,v 1.64.2.16 2003/08/24 08:24:38 hsu Exp $
31  */
32 
33 #include "opt_inet6.h"
34 #include "opt_carp.h"
35 
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/kernel.h>
39 #include <sys/jail.h>
40 #include <sys/malloc.h>
41 #include <sys/mbuf.h>
42 #include <sys/proc.h>
43 #include <sys/priv.h>
44 #include <sys/protosw.h>
45 #include <sys/socket.h>
46 #include <sys/socketvar.h>
47 #include <sys/sysctl.h>
48 
49 #include <sys/socketvar2.h>
50 #include <sys/msgport2.h>
51 
52 #include <machine/stdarg.h>
53 
54 #include <net/if.h>
55 #ifdef CARP
56 #include <net/if_types.h>
57 #endif
58 #include <net/route.h>
59 
60 #define _IP_VHL
61 #include <netinet/in.h>
62 #include <netinet/in_systm.h>
63 #include <netinet/ip.h>
64 #include <netinet/in_pcb.h>
65 #include <netinet/in_var.h>
66 #include <netinet/ip_var.h>
67 
68 #include <net/ip_mroute/ip_mroute.h>
69 #include <net/ipfw/ip_fw.h>
70 #include <net/ipfw3/ip_fw.h>
71 #include <net/dummynet/ip_dummynet.h>
72 #include <net/dummynet3/ip_dummynet3.h>
73 
74 struct	inpcbinfo ripcbinfo;
75 struct	inpcbportinfo ripcbportinfo;
76 
77 /*
78  * hooks for multicast routing. They all default to NULL,
79  * so leave them not initialized and rely on BSS being set to 0.
80  */
81 
82 /* The socket used to communicate with the multicast routing daemon.  */
83 struct socket  *ip_mrouter;
84 
85 /* The various mrouter and rsvp functions */
86 int (*ip_mrouter_set)(struct socket *, struct sockopt *);
87 int (*ip_mrouter_get)(struct socket *, struct sockopt *);
88 int (*ip_mrouter_done)(void);
89 int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
90 		struct ip_moptions *);
91 int (*mrt_ioctl)(u_long, caddr_t);
92 int (*legal_vif_num)(int);
93 u_long (*ip_mcast_src)(int);
94 
95 int (*rsvp_input_p)(struct mbuf **, int *, int);
96 int (*ip_rsvp_vif)(struct socket *, struct sockopt *);
97 void (*ip_rsvp_force_done)(struct socket *);
98 
99 /*
100  * Nominal space allocated to a raw ip socket.
101  */
102 #define	RIPSNDQ		8192
103 #define	RIPRCVQ		8192
104 
105 /*
106  * Raw interface to IP protocol.
107  */
108 
109 /*
110  * Initialize raw connection block queue.
111  */
112 void
113 rip_init(void)
114 {
115 	in_pcbinfo_init(&ripcbinfo, 0, FALSE);
116 	in_pcbportinfo_init(&ripcbportinfo, 1, 0);
117 	/*
118 	 * XXX We don't use the hash list for raw IP, but it's easier
119 	 * to allocate a one entry hash list than it is to check all
120 	 * over the place for hashbase == NULL.
121 	 */
122 	ripcbinfo.hashbase = hashinit(1, M_PCB, &ripcbinfo.hashmask);
123 	in_pcbportinfo_set(&ripcbinfo, &ripcbportinfo, 1);
124 	ripcbinfo.wildcardhashbase = hashinit(1, M_PCB,
125 					      &ripcbinfo.wildcardhashmask);
126 	ripcbinfo.ipi_size = sizeof(struct inpcb);
127 }
128 
129 /*
130  * Setup generic address and protocol structures
131  * for raw_input routine, then pass them along with
132  * mbuf chain.
133  */
134 int
135 rip_input(struct mbuf **mp, int *offp, int proto)
136 {
137 	struct sockaddr_in ripsrc = { sizeof ripsrc, AF_INET };
138 	struct mbuf *m = *mp;
139 	struct ip *ip = mtod(m, struct ip *);
140 	struct inpcb *inp;
141 	struct inpcb *last = NULL;
142 	struct mbuf *opts = NULL;
143 
144 	ASSERT_NETISR0;
145 
146 	*mp = NULL;
147 
148 	ripsrc.sin_addr = ip->ip_src;
149 	LIST_FOREACH(inp, &ripcbinfo.pcblisthead, inp_list) {
150 		if (inp->inp_flags & INP_PLACEMARKER)
151 			continue;
152 #ifdef INET6
153 		if (!INP_ISIPV4(inp))
154 			continue;
155 #endif
156 		if (inp->inp_ip_p && inp->inp_ip_p != proto)
157 			continue;
158 		if (inp->inp_laddr.s_addr != INADDR_ANY &&
159 		    inp->inp_laddr.s_addr != ip->ip_dst.s_addr)
160 			continue;
161 		if (inp->inp_faddr.s_addr != INADDR_ANY &&
162 		    inp->inp_faddr.s_addr != ip->ip_src.s_addr)
163 			continue;
164 		if (last) {
165 			struct mbuf *n = m_copypacket(m, M_NOWAIT);
166 
167 			if (n) {
168 				lwkt_gettoken(&last->inp_socket->so_rcv.ssb_token);
169 				if (last->inp_flags & INP_CONTROLOPTS ||
170 				    last->inp_socket->so_options & SO_TIMESTAMP)
171 				    ip_savecontrol(last, &opts, ip, n);
172 				if (ssb_appendaddr(&last->inp_socket->so_rcv,
173 					    (struct sockaddr *)&ripsrc, n,
174 					    opts) == 0) {
175 					m_freem(n);
176 					if (opts)
177 					    m_freem(opts);
178 					soroverflow(last->inp_socket);
179 				} else {
180 					sorwakeup(last->inp_socket);
181 				}
182 				lwkt_reltoken(&last->inp_socket->so_rcv.ssb_token);
183 				opts = NULL;
184 			}
185 		}
186 		last = inp;
187 	}
188 	/* Check the minimum TTL for socket. */
189 	if (last && ip->ip_ttl < last->inp_ip_minttl) {
190 		m_freem(opts);
191 		ipstat.ips_delivered--;
192 	} else if (last) {
193 		if (last->inp_flags & INP_CONTROLOPTS ||
194 		    last->inp_socket->so_options & SO_TIMESTAMP)
195 			ip_savecontrol(last, &opts, ip, m);
196 		lwkt_gettoken(&last->inp_socket->so_rcv.ssb_token);
197 		if (ssb_appendaddr(&last->inp_socket->so_rcv,
198 		    (struct sockaddr *)&ripsrc, m, opts) == 0) {
199 			m_freem(m);
200 			if (opts)
201 			    m_freem(opts);
202 			soroverflow(last->inp_socket);
203 		} else {
204 			sorwakeup(last->inp_socket);
205 		}
206 		lwkt_reltoken(&last->inp_socket->so_rcv.ssb_token);
207 	} else {
208 		m_freem(m);
209 		ipstat.ips_noproto++;
210 		ipstat.ips_delivered--;
211 	}
212 	return(IPPROTO_DONE);
213 }
214 
215 /*
216  * Generate IP header and pass packet to ip_output.
217  * Tack on options user may have setup with control call.
218  */
219 int
220 rip_output(struct mbuf *m, struct socket *so, ...)
221 {
222 	struct ip *ip;
223 	struct inpcb *inp = so->so_pcb;
224 	__va_list ap;
225 	int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
226 	u_long dst;
227 
228 	ASSERT_NETISR0;
229 
230 	__va_start(ap, so);
231 	dst = __va_arg(ap, u_long);
232 	__va_end(ap);
233 
234 	/*
235 	 * If the user handed us a complete IP packet, use it.
236 	 * Otherwise, allocate an mbuf for a header and fill it in.
237 	 */
238 	if ((inp->inp_flags & INP_HDRINCL) == 0) {
239 		if (m->m_pkthdr.len + sizeof(struct ip) > IP_MAXPACKET) {
240 			m_freem(m);
241 			return(EMSGSIZE);
242 		}
243 		M_PREPEND(m, sizeof(struct ip), M_WAITOK);
244 		if (m == NULL)
245 			return(ENOBUFS);
246 		ip = mtod(m, struct ip *);
247 		ip->ip_tos = inp->inp_ip_tos;
248 		ip->ip_off = 0;
249 		ip->ip_p = inp->inp_ip_p;
250 		ip->ip_len = htons(m->m_pkthdr.len); /* incls header now */
251 		ip->ip_src = inp->inp_laddr;
252 		ip->ip_dst.s_addr = dst;
253 		ip->ip_ttl = inp->inp_ip_ttl;
254 	} else {
255 		int hlen;
256 		int ip_len;
257 
258 		if (m->m_pkthdr.len > IP_MAXPACKET) {
259 			m_freem(m);
260 			return(EMSGSIZE);
261 		}
262 		if (m->m_len < sizeof(struct ip)) {
263 			m = m_pullup(m, sizeof(struct ip));
264 			if (m == NULL)
265 				return ENOBUFS;
266 		}
267 		ip = mtod(m, struct ip *);
268 		hlen = IP_VHL_HL(ip->ip_vhl) << 2;
269 		ip_len = ntohs(ip->ip_len);	/* includes header */
270 
271 		/*
272 		 * Don't allow both user specified and setsockopt options.
273 		 * Don't allow packet length sizes that will crash.
274 		 */
275 		if (hlen < sizeof(struct ip) ||
276 		    (hlen != sizeof(struct ip) && inp->inp_options) ||
277 		    ip_len > m->m_pkthdr.len ||
278 		    ip_len < hlen)
279 		{
280 			m_freem(m);
281 			return EINVAL;
282 		}
283 
284 		/*
285 		 * System supplies ip_id if passed as 0.
286 		 */
287 		if (ip->ip_id == 0)
288 			ip->ip_id = ip_newid();
289 
290 		/* Prevent ip_output from overwriting header fields */
291 		flags |= IP_RAWOUTPUT;
292 		ipstat.ips_rawout++;
293 	}
294 
295 	return ip_output(m, inp->inp_options, &inp->inp_route, flags,
296 			 inp->inp_moptions, inp);
297 }
298 
299 /*
300  * Raw IP socket option processing.
301  */
302 void
303 rip_ctloutput(netmsg_t msg)
304 {
305 	struct socket *so = msg->base.nm_so;
306 	struct sockopt *sopt = msg->ctloutput.nm_sopt;
307 	struct	inpcb *inp = so->so_pcb;
308 	int	error, optval;
309 
310 	ASSERT_NETISR0;
311 
312 	error = 0;
313 
314 	/* Get socket's owner cpuid hint */
315 	if (sopt->sopt_level == SOL_SOCKET &&
316 	    sopt->sopt_dir == SOPT_GET &&
317 	    sopt->sopt_name == SO_CPUHINT) {
318 		optval = mycpuid;
319 		soopt_from_kbuf(sopt, &optval, sizeof(optval));
320 		goto done;
321 	}
322 
323 	if (sopt->sopt_level != IPPROTO_IP) {
324 		error = EINVAL;
325 		goto done;
326 	}
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 			soopt_from_kbuf(sopt, &optval, sizeof optval);
334 			break;
335 
336 		case IP_FW_X:
337 			error = ip_fw3_sockopt(sopt);
338 			break;
339 
340 		case IP_FW_ADD: /* ADD actually returns the body... */
341 		case IP_FW_GET:
342 		case IP_FW_TBL_GET:
343 		case IP_FW_TBL_EXPIRE: /* returns # of expired addresses */
344 			error = ip_fw_sockopt(sopt);
345 			break;
346 
347 		case IP_DUMMYNET_GET:
348 			error = ip_dn_sockopt(sopt);
349 			break ;
350 
351 		case MRT_INIT:
352 		case MRT_DONE:
353 		case MRT_ADD_VIF:
354 		case MRT_DEL_VIF:
355 		case MRT_ADD_MFC:
356 		case MRT_DEL_MFC:
357 		case MRT_VERSION:
358 		case MRT_ASSERT:
359 		case MRT_API_SUPPORT:
360 		case MRT_API_CONFIG:
361 		case MRT_ADD_BW_UPCALL:
362 		case MRT_DEL_BW_UPCALL:
363 			error = ip_mrouter_get ? ip_mrouter_get(so, sopt) :
364 				EOPNOTSUPP;
365 			break;
366 
367 		default:
368 			ip_ctloutput(msg);
369 			/* msg invalid now */
370 			return;
371 		}
372 		break;
373 
374 	case SOPT_SET:
375 		switch (sopt->sopt_name) {
376 		case IP_HDRINCL:
377 			error = soopt_to_kbuf(sopt, &optval, sizeof optval,
378 					      sizeof optval);
379 			if (error)
380 				break;
381 			if (optval)
382 				inp->inp_flags |= INP_HDRINCL;
383 			else
384 				inp->inp_flags &= ~INP_HDRINCL;
385 			break;
386 
387 		case IP_FW_X:
388 			error = ip_fw3_sockopt(sopt);
389 			break;
390 
391 		case IP_FW_ADD:
392 		case IP_FW_DEL:
393 		case IP_FW_FLUSH:
394 		case IP_FW_ZERO:
395 		case IP_FW_RESETLOG:
396 		case IP_FW_TBL_CREATE:
397 		case IP_FW_TBL_DESTROY:
398 		case IP_FW_TBL_ADD:
399 		case IP_FW_TBL_DEL:
400 		case IP_FW_TBL_FLUSH:
401 		case IP_FW_TBL_ZERO:
402 		case IP_FW_TBL_EXPIRE:
403 			error = ip_fw_sockopt(sopt);
404 			break;
405 
406 		case IP_DUMMYNET_CONFIGURE:
407 		case IP_DUMMYNET_DEL:
408 		case IP_DUMMYNET_FLUSH:
409 			error = ip_dn_sockopt(sopt);
410 			break;
411 
412 		case IP_RSVP_ON:
413 			error = ip_rsvp_init(so);
414 			break;
415 
416 		case IP_RSVP_OFF:
417 			error = ip_rsvp_done();
418 			break;
419 
420 		case IP_RSVP_VIF_ON:
421 		case IP_RSVP_VIF_OFF:
422 			error = ip_rsvp_vif ?
423 				ip_rsvp_vif(so, sopt) : EINVAL;
424 			break;
425 
426 		case MRT_INIT:
427 		case MRT_DONE:
428 		case MRT_ADD_VIF:
429 		case MRT_DEL_VIF:
430 		case MRT_ADD_MFC:
431 		case MRT_DEL_MFC:
432 		case MRT_VERSION:
433 		case MRT_ASSERT:
434 		case MRT_API_SUPPORT:
435 		case MRT_API_CONFIG:
436 		case MRT_ADD_BW_UPCALL:
437 		case MRT_DEL_BW_UPCALL:
438 			error = ip_mrouter_set ? ip_mrouter_set(so, sopt) :
439 					EOPNOTSUPP;
440 			break;
441 
442 		default:
443 			ip_ctloutput(msg);
444 			/* msg invalid now */
445 			return;
446 		}
447 		break;
448 	}
449 done:
450 	lwkt_replymsg(&msg->lmsg, error);
451 }
452 
453 u_long	rip_sendspace = RIPSNDQ;
454 u_long	rip_recvspace = RIPRCVQ;
455 
456 SYSCTL_INT(_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW,
457     &rip_sendspace, 0, "Maximum outgoing raw IP datagram size");
458 SYSCTL_INT(_net_inet_raw, OID_AUTO, recvspace, CTLFLAG_RW,
459     &rip_recvspace, 0, "Maximum incoming raw IP datagram size");
460 
461 static void
462 rip_attach(netmsg_t msg)
463 {
464 	struct socket *so = msg->base.nm_so;
465 	int proto = msg->attach.nm_proto;
466 	struct pru_attach_info *ai = msg->attach.nm_ai;
467 	struct inpcb *inp;
468 	int error;
469 
470 	ASSERT_NETISR0;
471 
472 	inp = so->so_pcb;
473 	if (inp)
474 		panic("rip_attach");
475 	error = priv_check_cred(ai->p_ucred, PRIV_NETINET_RAW, NULL_CRED_OKAY);
476 	if (error)
477 		goto done;
478 
479 	error = soreserve(so, rip_sendspace, rip_recvspace, ai->sb_rlimit);
480 	if (error)
481 		goto done;
482 
483 	error = in_pcballoc(so, &ripcbinfo);
484 	if (error == 0) {
485 		inp = (struct inpcb *)so->so_pcb;
486 		inp->inp_ip_p = proto;
487 		inp->inp_ip_ttl = ip_defttl;
488 	}
489 done:
490 	lwkt_replymsg(&msg->lmsg, error);
491 }
492 
493 static void
494 rip_detach(netmsg_t msg)
495 {
496 	struct socket *so = msg->base.nm_so;
497 	struct inpcb *inp;
498 
499 	ASSERT_NETISR0;
500 
501 	inp = so->so_pcb;
502 	if (inp == NULL)
503 		panic("rip_detach");
504 	if (so == ip_mrouter && ip_mrouter_done)
505 		ip_mrouter_done();
506 	if (ip_rsvp_force_done)
507 		ip_rsvp_force_done(so);
508 	if (so == ip_rsvpd)
509 		ip_rsvp_done();
510 	in_pcbdetach(inp);
511 	lwkt_replymsg(&msg->lmsg, 0);
512 }
513 
514 static void
515 rip_abort(netmsg_t msg)
516 {
517 	/*
518 	 * Raw socket does not support listen(2),
519 	 * so this should never be called.
520 	 */
521 	panic("rip_abort is called");
522 }
523 
524 static void
525 rip_disconnect(netmsg_t msg)
526 {
527 	struct socket *so = msg->base.nm_so;
528 	int error;
529 
530 	ASSERT_NETISR0;
531 
532 	if (so->so_state & SS_ISCONNECTED) {
533 		soisdisconnected(so);
534 		error = 0;
535 	} else {
536 		error = ENOTCONN;
537 	}
538 	lwkt_replymsg(&msg->lmsg, error);
539 }
540 
541 static void
542 rip_bind(netmsg_t msg)
543 {
544 	struct socket *so = msg->base.nm_so;
545 	struct sockaddr *nam = msg->bind.nm_nam;
546 	struct inpcb *inp = so->so_pcb;
547 	struct sockaddr_in *addr = (struct sockaddr_in *)nam;
548 	int error;
549 
550 	ASSERT_NETISR0;
551 
552 	if (nam->sa_len == sizeof(*addr)) {
553 		if (ifnet_array_isempty() ||
554 		    ((addr->sin_family != AF_INET) &&
555 		     (addr->sin_family != AF_IMPLINK)) ||
556 		    (addr->sin_addr.s_addr != INADDR_ANY &&
557 		     ifa_ifwithaddr((struct sockaddr *)addr) == 0)) {
558 			error = EADDRNOTAVAIL;
559 		} else {
560 			inp->inp_laddr = addr->sin_addr;
561 			error = 0;
562 		}
563 	} else {
564 		error = EINVAL;
565 	}
566 	lwkt_replymsg(&msg->lmsg, error);
567 }
568 
569 static void
570 rip_connect(netmsg_t msg)
571 {
572 	struct socket *so = msg->base.nm_so;
573 	struct sockaddr *nam = msg->connect.nm_nam;
574 	struct inpcb *inp = so->so_pcb;
575 	struct sockaddr_in *addr = (struct sockaddr_in *)nam;
576 	int error;
577 
578 	ASSERT_NETISR0;
579 
580 	if (nam->sa_len != sizeof(*addr)) {
581 		error = EINVAL;
582 	} else if (ifnet_array_isempty()) {
583 		error = EADDRNOTAVAIL;
584 	} else {
585 		if ((addr->sin_family != AF_INET) &&
586 		    (addr->sin_family != AF_IMPLINK)) {
587 			error = EAFNOSUPPORT;
588 		} else {
589 			inp->inp_faddr = addr->sin_addr;
590 			soisconnected(so);
591 			error = 0;
592 		}
593 	}
594 	lwkt_replymsg(&msg->lmsg, error);
595 }
596 
597 static void
598 rip_shutdown(netmsg_t msg)
599 {
600 	ASSERT_NETISR0;
601 
602 	socantsendmore(msg->base.nm_so);
603 	lwkt_replymsg(&msg->lmsg, 0);
604 }
605 
606 static void
607 rip_send(netmsg_t msg)
608 {
609 	struct socket *so = msg->base.nm_so;
610 	struct mbuf *m = msg->send.nm_m;
611 	/*struct mbuf *control = msg->send.nm_control;*/
612 	struct sockaddr *nam = msg->send.nm_addr;
613 	/*int flags = msg->send.nm_flags;*/
614 	struct inpcb *inp = so->so_pcb;
615 	u_long dst;
616 	int error;
617 
618 	ASSERT_NETISR0;
619 
620 	if (so->so_state & SS_ISCONNECTED) {
621 		if (nam) {
622 			m_freem(m);
623 			error = EISCONN;
624 		} else {
625 			dst = inp->inp_faddr.s_addr;
626 			error = rip_output(m, so, dst);
627 		}
628 	} else {
629 		if (nam == NULL) {
630 			m_freem(m);
631 			error = ENOTCONN;
632 		} else {
633 			dst = ((struct sockaddr_in *)nam)->sin_addr.s_addr;
634 			error = rip_output(m, so, dst);
635 		}
636 	}
637 	lwkt_replymsg(&msg->lmsg, error);
638 }
639 
640 SYSCTL_PROC(_net_inet_raw, OID_AUTO/*XXX*/, pcblist, CTLFLAG_RD, &ripcbinfo, 1,
641 	    in_pcblist_range, "S,xinpcb", "List of active raw IP sockets");
642 
643 struct pr_usrreqs rip_usrreqs = {
644 	.pru_abort = rip_abort,
645 	.pru_accept = pr_generic_notsupp,
646 	.pru_attach = rip_attach,
647 	.pru_bind = rip_bind,
648 	.pru_connect = rip_connect,
649 	.pru_connect2 = pr_generic_notsupp,
650 	.pru_control = in_control_dispatch,
651 	.pru_detach = rip_detach,
652 	.pru_disconnect = rip_disconnect,
653 	.pru_listen = pr_generic_notsupp,
654 	.pru_peeraddr = in_setpeeraddr_dispatch,
655 	.pru_rcvd = pr_generic_notsupp,
656 	.pru_rcvoob = pr_generic_notsupp,
657 	.pru_send = rip_send,
658 	.pru_sense = pru_sense_null,
659 	.pru_shutdown = rip_shutdown,
660 	.pru_sockaddr = in_setsockaddr_dispatch,
661 	.pru_sosend = sosend,
662 	.pru_soreceive = soreceive
663 };
664