1 /* 2 * Copyright (c) 2004 Jeffrey M. Hsu. All rights reserved. 3 * Copyright (c) 2004 The DragonFly Project. All rights reserved. 4 * 5 * This code is derived from software contributed to The DragonFly Project 6 * by Jeffrey M. Hsu. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the name of The DragonFly Project nor the names of its 17 * contributors may be used to endorse or promote products derived 18 * from this software without specific, prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 30 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34 /* 35 * Copyright (c) 1982, 1986, 1990, 1993 36 * The Regents of the University of California. All rights reserved. 37 * 38 * Redistribution and use in source and binary forms, with or without 39 * modification, are permitted provided that the following conditions 40 * are met: 41 * 1. Redistributions of source code must retain the above copyright 42 * notice, this list of conditions and the following disclaimer. 43 * 2. Redistributions in binary form must reproduce the above copyright 44 * notice, this list of conditions and the following disclaimer in the 45 * documentation and/or other materials provided with the distribution. 46 * 3. Neither the name of the University nor the names of its contributors 47 * may be used to endorse or promote products derived from this software 48 * without specific prior written permission. 49 * 50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 60 * SUCH DAMAGE. 61 * 62 * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 63 * $FreeBSD: src/sys/netinet/in_pcb.h,v 1.32.2.7 2003/01/24 05:11:34 sam Exp $ 64 */ 65 66 #ifndef _NETINET_IN_PCB_H_ 67 #define _NETINET_IN_PCB_H_ 68 69 #ifndef _SYS_QUEUE_H_ 70 #include <sys/queue.h> 71 #endif 72 #ifndef _SYS_SYSCTL_H_ 73 #include <sys/sysctl.h> 74 #endif 75 #ifndef _NETINET_IN_H_ 76 #include <netinet/in.h> 77 #endif 78 #ifndef _NET_ROUTE_H_ 79 #include <net/route.h> 80 #endif 81 82 #define in6pcb inpcb /* for KAME src sync over BSD*'s */ 83 #define in6p_sp inp_sp /* for KAME src sync over BSD*'s */ 84 struct inpcbpolicy; 85 86 /* 87 * Common structure pcb for internet protocol implementation. 88 * Here are stored pointers to local and foreign host table 89 * entries, local and foreign socket numbers, and pointers 90 * up (to a socket structure) and down (to a protocol-specific) 91 * control block. 92 */ 93 LIST_HEAD(inpcbhead, inpcb); 94 LIST_HEAD(inpcbporthead, inpcbport); 95 typedef u_quad_t inp_gen_t; 96 97 struct inpcontainer { 98 struct inpcb *ic_inp; 99 LIST_ENTRY(inpcontainer) ic_list; 100 }; 101 LIST_HEAD(inpcontainerhead, inpcontainer); 102 103 /* 104 * PCB with AF_INET6 null bind'ed laddr can receive AF_INET input packet. 105 * So, AF_INET6 null laddr is also used as AF_INET null laddr, 106 * by utilize following structure. (At last, same as INRIA) 107 */ 108 struct in_addr_4in6 { 109 u_int32_t ia46_pad32[3]; 110 struct in_addr ia46_addr4; 111 }; 112 113 union in_dependaddr { 114 struct in_addr_4in6 id46_addr; 115 struct in6_addr id6_addr; 116 }; 117 118 /* 119 * NOTE: ipv6 addrs should be 64-bit aligned, per RFC 2553. 120 * in_conninfo has some extra padding to accomplish this. 121 */ 122 struct in_endpoints { 123 u_int16_t ie_fport; /* foreign port */ 124 u_int16_t ie_lport; /* local port */ 125 /* protocol dependent part, local and foreign addr */ 126 union in_dependaddr ie_dependfaddr; /* foreign host table entry */ 127 union in_dependaddr ie_dependladdr; /* local host table entry */ 128 #define ie_faddr ie_dependfaddr.id46_addr.ia46_addr4 129 #define ie_laddr ie_dependladdr.id46_addr.ia46_addr4 130 #define ie6_faddr ie_dependfaddr.id6_addr 131 #define ie6_laddr ie_dependladdr.id6_addr 132 }; 133 134 struct inp_localgroup { 135 LIST_ENTRY(inp_localgroup) il_list; 136 uint16_t il_lport; 137 u_char il_af; /* AF_INET or AF_INET6 */ 138 u_char il_pad; 139 uint32_t il_pad2; 140 union in_dependaddr il_dependladdr; 141 #define il_laddr il_dependladdr.id46_addr.ia46_addr4 142 #define il6_laddr il_dependladdr.id6_addr 143 int il_inpsiz; /* size of il_inp[] */ 144 int il_inpcnt; /* # of elem in il_inp[] */ 145 struct inpcb *il_inp[]; 146 }; 147 LIST_HEAD(inp_localgrphead, inp_localgroup); 148 149 /* 150 * XXX 151 * At some point struct route should possibly change to: 152 * struct rtentry *rt 153 * struct in_endpoints *ie; 154 */ 155 struct in_conninfo { 156 u_int8_t inc_flags; 157 u_int8_t inc_len; 158 u_int16_t inc_pad; /* XXX alignment for in_endpoints */ 159 /* protocol dependent part; cached route */ 160 struct in_endpoints inc_ie; 161 union { 162 /* placeholder for routing entry */ 163 struct route inc4_route; 164 struct route_in6 inc6_route; 165 } inc_dependroute; 166 }; 167 #define inc_isipv6 inc_flags /* temp compatibility */ 168 #define inc_fport inc_ie.ie_fport 169 #define inc_lport inc_ie.ie_lport 170 #define inc_faddr inc_ie.ie_faddr 171 #define inc_laddr inc_ie.ie_laddr 172 #define inc_route inc_dependroute.inc4_route 173 #define inc6_faddr inc_ie.ie6_faddr 174 #define inc6_laddr inc_ie.ie6_laddr 175 #define inc6_route inc_dependroute.inc6_route 176 177 /* 178 * NB: the zone allocator is type-stable EXCEPT FOR THE FIRST TWO LONGS 179 * of the structure. Therefore, it is important that the members in 180 * that position not contain any information which is required to be 181 * stable. 182 */ 183 struct icmp6_filter; 184 struct inpcbportinfo; 185 186 struct inpcb { 187 LIST_ENTRY(inpcb) inp_hash; /* hash list */ 188 LIST_ENTRY(inpcb) inp_list; /* list for all PCBs of this proto */ 189 u_int32_t inp_flow; 190 int inp_lgrpindex; /* local group index */ 191 192 /* local and foreign ports, local and foreign addr */ 193 struct in_conninfo inp_inc; 194 195 void *inp_ppcb; /* pointer to per-protocol pcb */ 196 struct inpcbinfo *inp_pcbinfo; /* PCB list info */ 197 struct socket *inp_socket; /* back pointer to socket */ 198 /* list for this PCB's local port */ 199 int inp_flags; /* generic IP/datagram flags */ 200 uint16_t inp_hashval; /* valid iff INP_HASH */ 201 uint16_t inp_pad; /* explicit padding */ 202 203 struct inpcbpolicy *inp_sp; /* for IPSEC */ 204 u_char inp_af; /* AF_INET or AF_INET6 */ 205 u_char inp_ip_ttl; /* time to live proto */ 206 u_char inp_ip_p; /* protocol proto */ 207 u_char inp_ip_minttl; /* minimum TTL or drop */ 208 209 /* protocol dependent part; options */ 210 struct { 211 u_char inp4_ip_tos; /* type of service proto */ 212 struct mbuf *inp4_options; /* IP options */ 213 struct ip_moptions *inp4_moptions; /* IP multicast options */ 214 } inp_depend4; 215 #define inp_fport inp_inc.inc_fport 216 #define inp_lport inp_inc.inc_lport 217 #define inp_faddr inp_inc.inc_faddr 218 #define inp_laddr inp_inc.inc_laddr 219 #define inp_route inp_inc.inc_route 220 #define inp_ip_tos inp_depend4.inp4_ip_tos 221 #define inp_options inp_depend4.inp4_options 222 #define inp_moptions inp_depend4.inp4_moptions 223 struct { 224 /* IP options */ 225 struct mbuf *inp6_options; 226 /* IP6 options for outgoing packets */ 227 struct ip6_pktopts *inp6_outputopts; 228 /* IP multicast options */ 229 struct ip6_moptions *inp6_moptions; 230 /* ICMPv6 code type filter */ 231 struct icmp6_filter *inp6_icmp6filt; 232 /* IPV6_CHECKSUM setsockopt */ 233 int inp6_cksum; 234 u_short inp6_ifindex; 235 short inp6_hops; 236 u_int8_t inp6_hlim; 237 } inp_depend6; 238 LIST_ENTRY(inpcb) inp_portlist; 239 struct inpcbporthead *inp_porthash; 240 struct inpcbport *inp_phd; /* head of this list */ 241 inp_gen_t inp_gencnt; /* generation count of this instance */ 242 #define in6p_faddr inp_inc.inc6_faddr 243 #define in6p_laddr inp_inc.inc6_laddr 244 #define in6p_route inp_inc.inc6_route 245 #define in6p_ip6_hlim inp_depend6.inp6_hlim 246 #define in6p_hops inp_depend6.inp6_hops /* default hop limit */ 247 #define in6p_ip6_nxt inp_ip_p 248 #define in6p_flowinfo inp_flow 249 #define in6p_af inp_af 250 #define in6p_options inp_depend6.inp6_options 251 #define in6p_outputopts inp_depend6.inp6_outputopts 252 #define in6p_moptions inp_depend6.inp6_moptions 253 #define in6p_icmp6filt inp_depend6.inp6_icmp6filt 254 #define in6p_cksum inp_depend6.inp6_cksum 255 #define inp6_ifindex inp_depend6.inp6_ifindex 256 #define in6p_flags inp_flags /* for KAME src sync over BSD*'s */ 257 #define in6p_socket inp_socket /* for KAME src sync over BSD*'s */ 258 #define in6p_lport inp_lport /* for KAME src sync over BSD*'s */ 259 #define in6p_fport inp_fport /* for KAME src sync over BSD*'s */ 260 #define in6p_ppcb inp_ppcb /* for KAME src sync over BSD*'s */ 261 262 void *inp_pf_sk; 263 }; 264 /* 265 * The range of the generation count, as used in this implementation, 266 * is 9e19. We would have to create 300 billion connections per 267 * second for this number to roll over in a year. This seems sufficiently 268 * unlikely that we simply don't concern ourselves with that possibility. 269 */ 270 271 /* 272 * Interface exported to userland by various protocols which use 273 * inpcbs. Hack alert -- only define if struct xsocket is in scope. 274 */ 275 #ifdef _SYS_SOCKETVAR_H_ 276 struct xinpcb { 277 size_t xi_len; /* length of this structure */ 278 struct inpcb xi_inp; 279 struct xsocket xi_socket; 280 u_quad_t xi_alignment_hack; 281 }; 282 #endif /* _SYS_SOCKETVAR_H_ */ 283 284 struct inpcbport { 285 LIST_ENTRY(inpcbport) phd_hash; 286 struct inpcbhead phd_pcblist; 287 u_short phd_port; 288 }; 289 290 struct lwkt_token; 291 292 struct inpcbportinfo { 293 struct inpcbporthead *porthashbase; 294 u_long porthashcnt; 295 u_short offset; 296 } __cachealign; 297 298 struct inpcbinfo { /* XXX documentation, prefixes */ 299 struct lwkt_token *infotoken; /* if this inpcbinfo is shared */ 300 struct inpcbhead *hashbase; 301 u_long hashmask; 302 int portinfo_cnt; 303 struct inpcbportinfo *portinfo; 304 struct inpcbport *portsave; /* port allocation cache */ 305 struct inpcontainerhead *wildcardhashbase; 306 u_long wildcardhashmask; 307 struct inp_localgrphead *localgrphashbase; 308 u_long localgrphashmask; 309 struct inpcbhead pcblisthead; /* head of queue of active pcb's */ 310 size_t ipi_size; /* allocation size for pcbs */ 311 u_int ipi_count; /* number of pcbs in this list */ 312 int cpu; /* related protocol thread cpu */ 313 u_quad_t ipi_gencnt; /* current generation count */ 314 } __cachealign; 315 316 317 #define INP_PCBCONNHASH(faddr, fport, laddr, lport, mask) \ 318 (((faddr) ^ ((faddr) >> 16) ^ (laddr) ^ ntohs((lport) ^ (fport))) & (mask)) 319 320 #define INP_PCBPORTHASH(lport, cnt) (ntohs(lport) % (cnt)) 321 322 #define INP_PCBWILDCARDHASH(lport, mask) (ntohs(lport) & (mask)) 323 324 #define INP_PCBLOCALGRPHASH(lport, mask) (ntohs(lport) & (mask)) 325 326 /* flags in inp_flags: */ 327 #define INP_RECVOPTS 0x01 /* receive incoming IP options */ 328 #define INP_RECVRETOPTS 0x02 /* receive IP options for reply */ 329 #define INP_RECVDSTADDR 0x04 /* receive IP dst address */ 330 #define INP_HDRINCL 0x08 /* user supplies entire IP header */ 331 #define INP_HIGHPORT 0x10 /* user wants "high" port binding */ 332 #define INP_LOWPORT 0x20 /* user wants "low" port binding */ 333 #define INP_ANONPORT 0x40 /* port chosen for user */ 334 #define INP_RECVIF 0x80 /* receive incoming interface */ 335 #define INP_MTUDISC 0x100 /* user can do MTU discovery */ 336 #define INP_WILDCARD 0x400 /* wildcard match */ 337 #define INP_FLAG_PROTO2 0x800 /* protocol specific */ 338 #define INP_CONNECTED 0x1000 /* exact match */ 339 #define INP_FLAG_PROTO1 0x2000 /* protocol specific */ 340 #define INP_PLACEMARKER 0x4000 /* skip this pcb, its a placemarker */ 341 #define INP_HASH 0x8000 /* inp_hashval is valid */ 342 343 #define IN6P_PKTINFO 0x010000 /* receive IP6 dst and I/F */ 344 #define IN6P_HOPLIMIT 0x020000 /* receive hoplimit */ 345 #define IN6P_HOPOPTS 0x040000 /* receive hop-by-hop options */ 346 #define IN6P_DSTOPTS 0x080000 /* receive dst options after rthdr */ 347 #define IN6P_RTHDR 0x100000 /* receive routing header */ 348 #define IN6P_RTHDRDSTOPTS 0x200000 /* receive dstoptions before rthdr */ 349 #define IN6P_AUTOFLOWLABEL 0x800000 /* attach flowlabel automatically */ 350 /* 351 * RFC3542 Definition 352 */ 353 #define IN6P_TCLASS 0x400000 /* receive traffic class value */ 354 #define IN6P_RFC2292 0x40000000 /* used RFC2292 API on the socket */ 355 #define IN6P_MTU 0x80000000 /* receive path MTU */ 356 357 /* 0x10000000 unused */ 358 #define INP_ONLIST 0x20000000 /* on pcblist */ 359 #define INP_RECVTTL 0x80000000 /* receive incoming IP TTL */ 360 361 #define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\ 362 INP_RECVIF|INP_RECVTTL|\ 363 IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\ 364 IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\ 365 IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\ 366 IN6P_MTU) 367 368 #define INP_UNMAPPABLEOPTS (IN6P_HOPOPTS|IN6P_DSTOPTS|IN6P_RTHDR|\ 369 IN6P_TCLASS|IN6P_AUTOFLOWLABEL) 370 371 /* for KAME src sync over BSD*'s */ 372 #define IN6P_HIGHPORT INP_HIGHPORT 373 #define IN6P_LOWPORT INP_LOWPORT 374 #define IN6P_ANONPORT INP_ANONPORT 375 #define IN6P_RECVIF INP_RECVIF 376 #define IN6P_MTUDISC INP_MTUDISC 377 #define IN6P_CONTROLOPTS INP_CONTROLOPTS 378 /* 379 * socket AF version is {newer than,or include} 380 * actual datagram AF version 381 */ 382 383 #define INPLOOKUP_WILDCARD 1 384 #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) 385 #define sotoin6pcb(so) sotoinpcb(so) /* for KAME src sync over BSD*'s */ 386 387 /* macros for handling bitmap of ports not to allocate dynamically */ 388 #define DP_MAPBITS (sizeof(u_int32_t) * NBBY) 389 #define DP_MAPSIZE (howmany(65536, DP_MAPBITS)) 390 #define DP_SET(m, p) ((m)[(p) / DP_MAPBITS] |= (1 << ((p) % DP_MAPBITS))) 391 #define DP_CLR(m, p) ((m)[(p) / DP_MAPBITS] &= ~(1 << ((p) % DP_MAPBITS))) 392 #define DP_ISSET(m, p) ((m)[(p) / DP_MAPBITS] & (1 << ((p) % DP_MAPBITS))) 393 394 /* default values for baddynamicports [see ip_init()] */ 395 #define DEFBADDYNAMICPORTS_TCP { \ 396 587, 749, 750, 751, 871, 2049, \ 397 6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, 6010, \ 398 0 } 399 #define DEFBADDYNAMICPORTS_UDP { 623, 664, 749, 750, 751, 2049, 0 } 400 401 struct baddynamicports { 402 u_int32_t tcp[DP_MAPSIZE]; 403 u_int32_t udp[DP_MAPSIZE]; 404 }; 405 406 407 #define INP_SOCKAF(so) so->so_proto->pr_domain->dom_family 408 #define INP_CHECK_SOCKAF(so, af) (INP_SOCKAF(so) == af) 409 410 #define INP_ISIPV6(inp) ((inp)->inp_af == AF_INET6) 411 #define INP_ISIPV4(inp) ((inp)->inp_af == AF_INET) 412 413 #ifdef _KERNEL 414 415 static __inline struct inpcbporthead * 416 in_pcbporthash_head(struct inpcbportinfo *portinfo, u_short lport) 417 { 418 return &portinfo->porthashbase[ 419 INP_PCBPORTHASH(lport, portinfo->porthashcnt)]; 420 } 421 422 #define GET_PORTHASH_TOKEN(porthashhead) \ 423 do { \ 424 lwkt_getpooltoken((porthashhead)); \ 425 } while (0) 426 427 #define REL_PORTHASH_TOKEN(porthashhead) \ 428 do { \ 429 lwkt_relpooltoken((porthashhead)); \ 430 } while (0) 431 432 #ifdef INVARIANTS 433 #define ASSERT_PORTHASH_TOKEN_HELD(pcbhashhead) \ 434 ASSERT_LWKT_TOKEN_HELD(lwkt_token_pool_lookup((pcbhashhead))) 435 #else 436 #define ASSERT_PORTHASH_TOKEN_HELD(pcbhashhead) 437 #endif 438 439 #define GET_PCBINFO_TOKEN(pcbinfo) \ 440 do { \ 441 if ((pcbinfo)->infotoken) \ 442 lwkt_gettoken((pcbinfo)->infotoken); \ 443 } while (0) 444 445 #define REL_PCBINFO_TOKEN(pcbinfo) \ 446 do { \ 447 if ((pcbinfo)->infotoken) \ 448 lwkt_reltoken((pcbinfo)->infotoken); \ 449 } while (0) 450 451 #ifdef INVARIANTS 452 #define ASSERT_PCBINFO_TOKEN_HELD(pcbinfo) \ 453 do { \ 454 if ((pcbinfo)->infotoken) \ 455 ASSERT_LWKT_TOKEN_HELD((pcbinfo)->infotoken); \ 456 } while (0) 457 #else /* !INVARIANTS */ 458 #define ASSERT_PCBINFO_TOKEN_HELD(pcbinfo) 459 #endif /* INVARIANTS */ 460 461 #ifdef INVARIANTS 462 #define ASSERT_INP_NOTINHASH(inp) \ 463 do { \ 464 KASSERT(!((inp)->inp_flags & INP_CONNECTED), \ 465 ("already on connhash")); \ 466 KASSERT(!((inp)->inp_flags & INP_WILDCARD), \ 467 ("already on wildcardhash")); \ 468 } while (0) 469 #else /* !INVARIANTS */ 470 #define ASSERT_INP_NOTINHASH(inp) 471 #endif /* INVARIANTS */ 472 473 extern int ipport_lowfirstauto; 474 extern int ipport_lowlastauto; 475 extern int ipport_firstauto; 476 extern int ipport_lastauto; 477 extern int ipport_hifirstauto; 478 extern int ipport_hilastauto; 479 480 union netmsg; 481 struct xinpcb; 482 483 typedef void (*inp_notify_t)(struct inpcb *, int); 484 485 void in_pcbportrange(u_short *, u_short *, u_short, u_short); 486 void in_pcbpurgeif0 (struct inpcbinfo *, struct ifnet *); 487 void in_losing (struct inpcb *); 488 void in_rtchange (struct inpcb *, int); 489 void in_pcbinfo_init (struct inpcbinfo *, int, boolean_t); 490 void in_pcbportinfo_init (struct inpcbportinfo *, int, u_short); 491 void in_pcbportinfo_set(struct inpcbinfo *, struct inpcbportinfo *, int); 492 int in_pcballoc (struct socket *, struct inpcbinfo *); 493 void in_pcbunlink (struct inpcb *, struct inpcbinfo *); 494 void in_pcbunlink_flags (struct inpcb *, struct inpcbinfo *, int); 495 void in_pcblink (struct inpcb *, struct inpcbinfo *); 496 void in_pcblink_flags (struct inpcb *, struct inpcbinfo *, int); 497 void in_pcbonlist (struct inpcb *); 498 void in_pcbofflist (struct inpcb *); 499 int in_pcbbind (struct inpcb *, struct sockaddr *, struct thread *); 500 int in_pcbbind_remote(struct inpcb *, const struct sockaddr *, 501 struct thread *); 502 int in_pcbconnect (struct inpcb *, struct sockaddr *, struct thread *); 503 void in_pcbdetach (struct inpcb *); 504 void in_pcbdisconnect (struct inpcb *); 505 void in_pcbinswildcardhash(struct inpcb *inp); 506 void in_pcbinswildcardhash_oncpu(struct inpcb *, struct inpcbinfo *); 507 void in_pcbinsconnhash(struct inpcb *inp); 508 void in_pcbinsporthash(struct inpcbporthead *, struct inpcb *); 509 void in_pcbinsporthash_lport (struct inpcb *); 510 void in_pcbremporthash (struct inpcb *); 511 int in_pcbladdr (struct inpcb *, struct sockaddr *, 512 struct sockaddr_in **, struct thread *); 513 int in_pcbladdr_find (struct inpcb *, struct sockaddr *, 514 struct sockaddr_in **, struct thread *, int); 515 struct inpcb * 516 in_pcblookup_hash (struct inpcbinfo *, 517 struct in_addr, u_int, struct in_addr, u_int, 518 boolean_t, struct ifnet *); 519 struct inpcb * 520 in_pcblookup_pkthash (struct inpcbinfo *, 521 struct in_addr, u_int, struct in_addr, u_int, 522 boolean_t, struct ifnet *, const struct mbuf *); 523 void in_pcbnotifyall (struct inpcbinfo *, struct in_addr, 524 int, inp_notify_t); 525 int in_setpeeraddr (struct socket *so, struct sockaddr **nam); 526 void in_setpeeraddr_dispatch(union netmsg *); 527 void in_setsockaddr_dispatch(netmsg_t msg); 528 int in_baddynamic(u_int16_t, u_int16_t); 529 void in_pcbremwildcardhash(struct inpcb *inp); 530 void in_pcbremwildcardhash_oncpu(struct inpcb *, struct inpcbinfo *); 531 void in_pcbremconnhash(struct inpcb *inp); 532 void in_pcbremlists (struct inpcb *inp); 533 int prison_xinpcb (struct thread *p, struct inpcb *inp); 534 void in_savefaddr (struct socket *so, const struct sockaddr *faddr); 535 struct inpcb * 536 in_pcblocalgroup_last(const struct inpcbinfo *, const struct inpcb *); 537 void in_pcbglobalinit(void); 538 void in_pcbresetroute(struct inpcb *); 539 540 int in_pcblist_range(SYSCTL_HANDLER_ARGS); 541 int in_pcblist_ncpus(SYSCTL_HANDLER_ARGS); 542 543 struct inpcb * 544 in_pcbmarker(void); 545 struct inpcontainer * 546 in_pcbcontainer_marker(void); 547 548 #endif /* _KERNEL */ 549 550 #endif /* !_NETINET_IN_PCB_H_ */ 551