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.15 2003/01/24 10:52:50 hsu Exp $ 35 */ 36 37 #include "opt_inet6.h" 38 #include "opt_ipsec.h" 39 #include "opt_random_ip_id.h" 40 41 #include <sys/param.h> 42 #include <sys/systm.h> 43 #include <sys/kernel.h> 44 #include <sys/malloc.h> 45 #include <sys/mbuf.h> 46 #include <sys/proc.h> 47 #include <sys/protosw.h> 48 #include <sys/socket.h> 49 #include <sys/socketvar.h> 50 #include <sys/sysctl.h> 51 52 #include <vm/vm_zone.h> 53 54 #include <net/if.h> 55 #include <net/route.h> 56 57 #define _IP_VHL 58 #include <netinet/in.h> 59 #include <netinet/in_systm.h> 60 #include <netinet/ip.h> 61 #include <netinet/in_pcb.h> 62 #include <netinet/in_var.h> 63 #include <netinet/ip_var.h> 64 #include <netinet/ip_mroute.h> 65 66 #include <netinet/ip_fw.h> 67 #include <netinet/ip_dummynet.h> 68 69 #ifdef FAST_IPSEC 70 #include <netipsec/ipsec.h> 71 #endif /*FAST_IPSEC*/ 72 73 #ifdef IPSEC 74 #include <netinet6/ipsec.h> 75 #endif /*IPSEC*/ 76 77 struct inpcbhead ripcb; 78 struct inpcbinfo ripcbinfo; 79 80 /* control hooks for ipfw and dummynet */ 81 ip_fw_ctl_t *ip_fw_ctl_ptr; 82 ip_dn_ctl_t *ip_dn_ctl_ptr; 83 84 /* 85 * hooks for multicast routing. They all default to NULL, 86 * so leave them not initialized and rely on BSS being set to 0. 87 */ 88 89 /* The socket used to communicate with the multicast routing daemon. */ 90 struct socket *ip_mrouter; 91 92 /* The various mrouter and rsvp functions */ 93 int (*ip_mrouter_set)(struct socket *, struct sockopt *); 94 int (*ip_mrouter_get)(struct socket *, struct sockopt *); 95 int (*ip_mrouter_done)(void); 96 int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *, 97 struct ip_moptions *); 98 int (*mrt_ioctl)(int, caddr_t); 99 int (*legal_vif_num)(int); 100 u_long (*ip_mcast_src)(int); 101 102 void (*rsvp_input_p)(struct mbuf *m, int off, int proto); 103 int (*ip_rsvp_vif)(struct socket *, struct sockopt *); 104 void (*ip_rsvp_force_done)(struct socket *); 105 106 /* 107 * Nominal space allocated to a raw ip socket. 108 */ 109 #define RIPSNDQ 8192 110 #define RIPRCVQ 8192 111 112 /* 113 * Raw interface to IP protocol. 114 */ 115 116 /* 117 * Initialize raw connection block queue. 118 */ 119 void 120 rip_init(void) 121 { 122 LIST_INIT(&ripcb); 123 ripcbinfo.listhead = &ripcb; 124 /* 125 * XXX We don't use the hash list for raw IP, but it's easier 126 * to allocate a one entry hash list than it is to check all 127 * over the place for hashbase == NULL. 128 */ 129 ripcbinfo.hashbase = hashinit(1, M_PCB, &ripcbinfo.hashmask); 130 ripcbinfo.porthashbase = hashinit(1, M_PCB, &ripcbinfo.porthashmask); 131 ripcbinfo.ipi_zone = zinit("ripcb", sizeof(struct inpcb), 132 maxsockets, ZONE_INTERRUPT, 0); 133 } 134 135 /* 136 * XXX ripsrc is modified in rip_input, so we must be fix this 137 * when we want to make this code smp-friendly. 138 */ 139 static struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; 140 141 /* 142 * Setup generic address and protocol structures 143 * for raw_input routine, then pass them along with 144 * mbuf chain. 145 */ 146 void 147 rip_input(struct mbuf *m, int off, int proto) 148 { 149 struct ip *ip = mtod(m, struct ip *); 150 struct inpcb *inp; 151 struct inpcb *last = NULL; 152 struct mbuf *opts = NULL; 153 154 ripsrc.sin_addr = ip->ip_src; 155 LIST_FOREACH(inp, &ripcb, inp_list) { 156 #ifdef INET6 157 if ((inp->inp_vflag & INP_IPV4) == 0) 158 continue; 159 #endif 160 if (inp->inp_ip_p && inp->inp_ip_p != proto) 161 continue; 162 if (inp->inp_laddr.s_addr != INADDR_ANY && 163 inp->inp_laddr.s_addr != ip->ip_dst.s_addr) 164 continue; 165 if (inp->inp_faddr.s_addr != INADDR_ANY && 166 inp->inp_faddr.s_addr != ip->ip_src.s_addr) 167 continue; 168 if (last) { 169 struct mbuf *n = m_copypacket(m, M_DONTWAIT); 170 171 #ifdef IPSEC 172 /* check AH/ESP integrity. */ 173 if (n && ipsec4_in_reject_so(n, last->inp_socket)) { 174 m_freem(n); 175 ipsecstat.in_polvio++; 176 /* do not inject data to pcb */ 177 } else 178 #endif /*IPSEC*/ 179 #ifdef FAST_IPSEC 180 /* check AH/ESP integrity. */ 181 if (ipsec4_in_reject(n, last)) { 182 m_freem(n); 183 /* do not inject data to pcb */ 184 } else 185 #endif /*FAST_IPSEC*/ 186 if (n) { 187 if (last->inp_flags & INP_CONTROLOPTS || 188 last->inp_socket->so_options & SO_TIMESTAMP) 189 ip_savecontrol(last, &opts, ip, n); 190 if (sbappendaddr(&last->inp_socket->so_rcv, 191 (struct sockaddr *)&ripsrc, n, 192 opts) == 0) { 193 /* should notify about lost packet */ 194 m_freem(n); 195 if (opts) 196 m_freem(opts); 197 } else 198 sorwakeup(last->inp_socket); 199 opts = 0; 200 } 201 } 202 last = inp; 203 } 204 #ifdef IPSEC 205 /* check AH/ESP integrity. */ 206 if (last && ipsec4_in_reject_so(m, last->inp_socket)) { 207 m_freem(m); 208 ipsecstat.in_polvio++; 209 ipstat.ips_delivered--; 210 /* do not inject data to pcb */ 211 } else 212 #endif /*IPSEC*/ 213 #ifdef FAST_IPSEC 214 /* check AH/ESP integrity. */ 215 if (last && ipsec4_in_reject(m, last)) { 216 m_freem(m); 217 ipstat.ips_delivered--; 218 /* do not inject data to pcb */ 219 } else 220 #endif /*FAST_IPSEC*/ 221 if (last) { 222 if (last->inp_flags & INP_CONTROLOPTS || 223 last->inp_socket->so_options & SO_TIMESTAMP) 224 ip_savecontrol(last, &opts, ip, m); 225 if (sbappendaddr(&last->inp_socket->so_rcv, 226 (struct sockaddr *)&ripsrc, m, opts) == 0) { 227 m_freem(m); 228 if (opts) 229 m_freem(opts); 230 } else 231 sorwakeup(last->inp_socket); 232 } else { 233 m_freem(m); 234 ipstat.ips_noproto++; 235 ipstat.ips_delivered--; 236 } 237 } 238 239 /* 240 * Generate IP header and pass packet to ip_output. 241 * Tack on options user may have setup with control call. 242 */ 243 int 244 rip_output(struct mbuf *m, struct socket *so, u_long dst) 245 { 246 struct ip *ip; 247 struct inpcb *inp = sotoinpcb(so); 248 int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST; 249 250 /* 251 * If the user handed us a complete IP packet, use it. 252 * Otherwise, allocate an mbuf for a header and fill it in. 253 */ 254 if ((inp->inp_flags & INP_HDRINCL) == 0) { 255 if (m->m_pkthdr.len + sizeof(struct ip) > IP_MAXPACKET) { 256 m_freem(m); 257 return(EMSGSIZE); 258 } 259 M_PREPEND(m, sizeof(struct ip), M_WAIT); 260 ip = mtod(m, struct ip *); 261 ip->ip_tos = inp->inp_ip_tos; 262 ip->ip_off = 0; 263 ip->ip_p = inp->inp_ip_p; 264 ip->ip_len = m->m_pkthdr.len; 265 ip->ip_src = inp->inp_laddr; 266 ip->ip_dst.s_addr = dst; 267 ip->ip_ttl = inp->inp_ip_ttl; 268 } else { 269 if (m->m_pkthdr.len > IP_MAXPACKET) { 270 m_freem(m); 271 return(EMSGSIZE); 272 } 273 ip = mtod(m, struct ip *); 274 /* don't allow both user specified and setsockopt options, 275 and don't allow packet length sizes that will crash */ 276 if (((IP_VHL_HL(ip->ip_vhl) != (sizeof (*ip) >> 2)) 277 && inp->inp_options) 278 || (ip->ip_len > m->m_pkthdr.len) 279 || (ip->ip_len < (IP_VHL_HL(ip->ip_vhl) << 2))) { 280 m_freem(m); 281 return EINVAL; 282 } 283 if (ip->ip_id == 0) 284 #ifdef RANDOM_IP_ID 285 ip->ip_id = ip_randomid(); 286 #else 287 ip->ip_id = htons(ip_id++); 288 #endif 289 /* XXX prevent ip_output from overwriting header fields */ 290 flags |= IP_RAWOUTPUT; 291 ipstat.ips_rawout++; 292 } 293 294 return (ip_output(m, inp->inp_options, &inp->inp_route, flags, 295 inp->inp_moptions, inp)); 296 } 297 298 /* 299 * Raw IP socket option processing. 300 */ 301 int 302 rip_ctloutput(struct socket *so, struct sockopt *sopt) 303 { 304 struct inpcb *inp = sotoinpcb(so); 305 int error, optval; 306 307 if (sopt->sopt_level != IPPROTO_IP) 308 return (EINVAL); 309 310 error = 0; 311 312 switch (sopt->sopt_dir) { 313 case SOPT_GET: 314 switch (sopt->sopt_name) { 315 case IP_HDRINCL: 316 optval = inp->inp_flags & INP_HDRINCL; 317 error = sooptcopyout(sopt, &optval, sizeof optval); 318 break; 319 320 case IP_FW_ADD: /* ADD actually returns the body... */ 321 case IP_FW_GET: 322 if (IPFW_LOADED) 323 error = ip_fw_ctl_ptr(sopt); 324 else 325 error = ENOPROTOOPT; 326 break; 327 328 case IP_DUMMYNET_GET: 329 if (DUMMYNET_LOADED) 330 error = ip_dn_ctl_ptr(sopt); 331 else 332 error = ENOPROTOOPT; 333 break ; 334 335 case MRT_INIT: 336 case MRT_DONE: 337 case MRT_ADD_VIF: 338 case MRT_DEL_VIF: 339 case MRT_ADD_MFC: 340 case MRT_DEL_MFC: 341 case MRT_VERSION: 342 case MRT_ASSERT: 343 error = ip_mrouter_get ? ip_mrouter_get(so, sopt) : 344 EOPNOTSUPP; 345 break; 346 347 default: 348 error = ip_ctloutput(so, sopt); 349 break; 350 } 351 break; 352 353 case SOPT_SET: 354 switch (sopt->sopt_name) { 355 case IP_HDRINCL: 356 error = sooptcopyin(sopt, &optval, sizeof optval, 357 sizeof optval); 358 if (error) 359 break; 360 if (optval) 361 inp->inp_flags |= INP_HDRINCL; 362 else 363 inp->inp_flags &= ~INP_HDRINCL; 364 break; 365 366 case IP_FW_ADD: 367 case IP_FW_DEL: 368 case IP_FW_FLUSH: 369 case IP_FW_ZERO: 370 case IP_FW_RESETLOG: 371 if (IPFW_LOADED) 372 error = ip_fw_ctl_ptr(sopt); 373 else 374 error = ENOPROTOOPT; 375 break; 376 377 case IP_DUMMYNET_CONFIGURE: 378 case IP_DUMMYNET_DEL: 379 case IP_DUMMYNET_FLUSH: 380 if (DUMMYNET_LOADED) 381 error = ip_dn_ctl_ptr(sopt); 382 else 383 error = ENOPROTOOPT ; 384 break ; 385 386 case IP_RSVP_ON: 387 error = ip_rsvp_init(so); 388 break; 389 390 case IP_RSVP_OFF: 391 error = ip_rsvp_done(); 392 break; 393 394 case IP_RSVP_VIF_ON: 395 case IP_RSVP_VIF_OFF: 396 error = ip_rsvp_vif ? 397 ip_rsvp_vif(so, sopt) : EINVAL; 398 break; 399 400 case MRT_INIT: 401 case MRT_DONE: 402 case MRT_ADD_VIF: 403 case MRT_DEL_VIF: 404 case MRT_ADD_MFC: 405 case MRT_DEL_MFC: 406 case MRT_VERSION: 407 case MRT_ASSERT: 408 error = ip_mrouter_set ? ip_mrouter_set(so, sopt) : 409 EOPNOTSUPP; 410 break; 411 412 default: 413 error = ip_ctloutput(so, sopt); 414 break; 415 } 416 break; 417 } 418 419 return (error); 420 } 421 422 /* 423 * This function exists solely to receive the PRC_IFDOWN messages which 424 * are sent by if_down(). It looks for an ifaddr whose ifa_addr is sa, 425 * and calls in_ifadown() to remove all routes corresponding to that address. 426 * It also receives the PRC_IFUP messages from if_up() and reinstalls the 427 * interface routes. 428 */ 429 void 430 rip_ctlinput(int cmd, struct sockaddr *sa, void *vip) 431 { 432 struct in_ifaddr *ia; 433 struct ifnet *ifp; 434 int err; 435 int flags; 436 437 switch (cmd) { 438 case PRC_IFDOWN: 439 TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) { 440 if (ia->ia_ifa.ifa_addr == sa 441 && (ia->ia_flags & IFA_ROUTE)) { 442 /* 443 * in_ifscrub kills the interface route. 444 */ 445 in_ifscrub(ia->ia_ifp, ia); 446 /* 447 * in_ifadown gets rid of all the rest of 448 * the routes. This is not quite the right 449 * thing to do, but at least if we are running 450 * a routing process they will come back. 451 */ 452 in_ifadown(&ia->ia_ifa, 0); 453 break; 454 } 455 } 456 break; 457 458 case PRC_IFUP: 459 TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) { 460 if (ia->ia_ifa.ifa_addr == sa) 461 break; 462 } 463 if (ia == 0 || (ia->ia_flags & IFA_ROUTE)) 464 return; 465 flags = RTF_UP; 466 ifp = ia->ia_ifa.ifa_ifp; 467 468 if ((ifp->if_flags & IFF_LOOPBACK) 469 || (ifp->if_flags & IFF_POINTOPOINT)) 470 flags |= RTF_HOST; 471 472 err = rtinit(&ia->ia_ifa, RTM_ADD, flags); 473 if (err == 0) 474 ia->ia_flags |= IFA_ROUTE; 475 break; 476 } 477 } 478 479 u_long rip_sendspace = RIPSNDQ; 480 u_long rip_recvspace = RIPRCVQ; 481 482 SYSCTL_INT(_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW, 483 &rip_sendspace, 0, "Maximum outgoing raw IP datagram size"); 484 SYSCTL_INT(_net_inet_raw, OID_AUTO, recvspace, CTLFLAG_RW, 485 &rip_recvspace, 0, "Maximum incoming raw IP datagram size"); 486 487 static int 488 rip_attach(struct socket *so, int proto, struct proc *p) 489 { 490 struct inpcb *inp; 491 int error, s; 492 493 inp = sotoinpcb(so); 494 if (inp) 495 panic("rip_attach"); 496 if (p && (error = suser(p)) != 0) 497 return error; 498 499 error = soreserve(so, rip_sendspace, rip_recvspace); 500 if (error) 501 return error; 502 s = splnet(); 503 error = in_pcballoc(so, &ripcbinfo, p); 504 splx(s); 505 if (error) 506 return error; 507 inp = (struct inpcb *)so->so_pcb; 508 inp->inp_vflag |= INP_IPV4; 509 inp->inp_ip_p = proto; 510 inp->inp_ip_ttl = ip_defttl; 511 return 0; 512 } 513 514 static int 515 rip_detach(struct socket *so) 516 { 517 struct inpcb *inp; 518 519 inp = sotoinpcb(so); 520 if (inp == 0) 521 panic("rip_detach"); 522 if (so == ip_mrouter && ip_mrouter_done) 523 ip_mrouter_done(); 524 if (ip_rsvp_force_done) 525 ip_rsvp_force_done(so); 526 if (so == ip_rsvpd) 527 ip_rsvp_done(); 528 in_pcbdetach(inp); 529 return 0; 530 } 531 532 static int 533 rip_abort(struct socket *so) 534 { 535 soisdisconnected(so); 536 if (so->so_state & SS_NOFDREF) 537 return rip_detach(so); 538 return 0; 539 } 540 541 static int 542 rip_disconnect(struct socket *so) 543 { 544 if ((so->so_state & SS_ISCONNECTED) == 0) 545 return ENOTCONN; 546 return rip_abort(so); 547 } 548 549 static int 550 rip_bind(struct socket *so, struct sockaddr *nam, struct proc *p) 551 { 552 struct inpcb *inp = sotoinpcb(so); 553 struct sockaddr_in *addr = (struct sockaddr_in *)nam; 554 555 if (nam->sa_len != sizeof(*addr)) 556 return EINVAL; 557 558 if (TAILQ_EMPTY(&ifnet) || ((addr->sin_family != AF_INET) && 559 (addr->sin_family != AF_IMPLINK)) || 560 (addr->sin_addr.s_addr != INADDR_ANY && 561 ifa_ifwithaddr((struct sockaddr *)addr) == 0)) 562 return EADDRNOTAVAIL; 563 inp->inp_laddr = addr->sin_addr; 564 return 0; 565 } 566 567 static int 568 rip_connect(struct socket *so, struct sockaddr *nam, struct proc *p) 569 { 570 struct inpcb *inp = sotoinpcb(so); 571 struct sockaddr_in *addr = (struct sockaddr_in *)nam; 572 573 if (nam->sa_len != sizeof(*addr)) 574 return EINVAL; 575 if (TAILQ_EMPTY(&ifnet)) 576 return EADDRNOTAVAIL; 577 if ((addr->sin_family != AF_INET) && 578 (addr->sin_family != AF_IMPLINK)) 579 return EAFNOSUPPORT; 580 inp->inp_faddr = addr->sin_addr; 581 soisconnected(so); 582 return 0; 583 } 584 585 static int 586 rip_shutdown(struct socket *so) 587 { 588 socantsendmore(so); 589 return 0; 590 } 591 592 static int 593 rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, 594 struct mbuf *control, struct proc *p) 595 { 596 struct inpcb *inp = sotoinpcb(so); 597 u_long dst; 598 599 if (so->so_state & SS_ISCONNECTED) { 600 if (nam) { 601 m_freem(m); 602 return EISCONN; 603 } 604 dst = inp->inp_faddr.s_addr; 605 } else { 606 if (nam == NULL) { 607 m_freem(m); 608 return ENOTCONN; 609 } 610 dst = ((struct sockaddr_in *)nam)->sin_addr.s_addr; 611 } 612 return rip_output(m, so, dst); 613 } 614 615 static int 616 rip_pcblist(SYSCTL_HANDLER_ARGS) 617 { 618 int error, i, n, s; 619 struct inpcb *inp, **inp_list; 620 inp_gen_t gencnt; 621 struct xinpgen xig; 622 623 /* 624 * The process of preparing the TCB list is too time-consuming and 625 * resource-intensive to repeat twice on every request. 626 */ 627 if (req->oldptr == 0) { 628 n = ripcbinfo.ipi_count; 629 req->oldidx = 2 * (sizeof xig) 630 + (n + n/8) * sizeof(struct xinpcb); 631 return 0; 632 } 633 634 if (req->newptr != 0) 635 return EPERM; 636 637 /* 638 * OK, now we're committed to doing something. 639 */ 640 s = splnet(); 641 gencnt = ripcbinfo.ipi_gencnt; 642 n = ripcbinfo.ipi_count; 643 splx(s); 644 645 xig.xig_len = sizeof xig; 646 xig.xig_count = n; 647 xig.xig_gen = gencnt; 648 xig.xig_sogen = so_gencnt; 649 error = SYSCTL_OUT(req, &xig, sizeof xig); 650 if (error) 651 return error; 652 653 inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); 654 if (inp_list == 0) 655 return ENOMEM; 656 657 s = splnet(); 658 for (inp = LIST_FIRST(ripcbinfo.listhead), i = 0; inp && i < n; 659 inp = LIST_NEXT(inp, inp_list)) { 660 if (inp->inp_gencnt <= gencnt) 661 inp_list[i++] = inp; 662 } 663 splx(s); 664 n = i; 665 666 error = 0; 667 for (i = 0; i < n; i++) { 668 inp = inp_list[i]; 669 if (inp->inp_gencnt <= gencnt) { 670 struct xinpcb xi; 671 xi.xi_len = sizeof xi; 672 /* XXX should avoid extra copy */ 673 bcopy(inp, &xi.xi_inp, sizeof *inp); 674 if (inp->inp_socket) 675 sotoxsocket(inp->inp_socket, &xi.xi_socket); 676 error = SYSCTL_OUT(req, &xi, sizeof xi); 677 } 678 } 679 if (!error) { 680 /* 681 * Give the user an updated idea of our state. 682 * If the generation differs from what we told 683 * her before, she knows that something happened 684 * while we were processing this request, and it 685 * might be necessary to retry. 686 */ 687 s = splnet(); 688 xig.xig_gen = ripcbinfo.ipi_gencnt; 689 xig.xig_sogen = so_gencnt; 690 xig.xig_count = ripcbinfo.ipi_count; 691 splx(s); 692 error = SYSCTL_OUT(req, &xig, sizeof xig); 693 } 694 free(inp_list, M_TEMP); 695 return error; 696 } 697 698 SYSCTL_PROC(_net_inet_raw, OID_AUTO/*XXX*/, pcblist, CTLFLAG_RD, 0, 0, 699 rip_pcblist, "S,xinpcb", "List of active raw IP sockets"); 700 701 struct pr_usrreqs rip_usrreqs = { 702 rip_abort, pru_accept_notsupp, rip_attach, rip_bind, rip_connect, 703 pru_connect2_notsupp, in_control, rip_detach, rip_disconnect, 704 pru_listen_notsupp, in_setpeeraddr, pru_rcvd_notsupp, 705 pru_rcvoob_notsupp, rip_send, pru_sense_null, rip_shutdown, 706 in_setsockaddr, sosend, soreceive, sopoll 707 }; 708