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