]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
39037602 | 2 | * Copyright (c) 2000-2016 Apple Inc. All rights reserved. |
5d5c5d0d | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
39236c6e | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
39236c6e | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
39236c6e | 17 | * |
2d21ac55 A |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
39236c6e | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* | |
29 | * Copyright (c) 1982, 1986, 1990, 1993 | |
30 | * The Regents of the University of California. All rights reserved. | |
31 | * | |
32 | * Redistribution and use in source and binary forms, with or without | |
33 | * modification, are permitted provided that the following conditions | |
34 | * are met: | |
35 | * 1. Redistributions of source code must retain the above copyright | |
36 | * notice, this list of conditions and the following disclaimer. | |
37 | * 2. Redistributions in binary form must reproduce the above copyright | |
38 | * notice, this list of conditions and the following disclaimer in the | |
39 | * documentation and/or other materials provided with the distribution. | |
40 | * 3. All advertising materials mentioning features or use of this software | |
41 | * must display the following acknowledgement: | |
42 | * This product includes software developed by the University of | |
43 | * California, Berkeley and its contributors. | |
44 | * 4. Neither the name of the University nor the names of its contributors | |
45 | * may be used to endorse or promote products derived from this software | |
46 | * without specific prior written permission. | |
47 | * | |
48 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
49 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
50 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
58 | * SUCH DAMAGE. | |
59 | * | |
60 | * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 | |
9bccf70c | 61 | * $FreeBSD: src/sys/netinet/in_pcb.h,v 1.32.2.4 2001/08/13 16:26:17 ume Exp $ |
1c79356b | 62 | */ |
2d21ac55 A |
63 | /* |
64 | * NOTICE: This file was modified by SPARTA, Inc. in 2007 to introduce | |
65 | * support for mandatory and extensible security protections. This notice | |
66 | * is included in support of clause 2.2 (b) of the Apple Public License, | |
67 | * Version 2.0. | |
68 | */ | |
1c79356b A |
69 | |
70 | #ifndef _NETINET_IN_PCB_H_ | |
39236c6e | 71 | #define _NETINET_IN_PCB_H_ |
9bccf70c | 72 | #include <sys/appleapiopts.h> |
1c79356b | 73 | |
91447636 | 74 | #include <sys/types.h> |
1c79356b | 75 | #include <sys/queue.h> |
316670eb | 76 | #ifdef BSD_KERNEL_PRIVATE |
39236c6e | 77 | #include <sys/bitstring.h> |
316670eb | 78 | #include <sys/tree.h> |
91447636 | 79 | #include <kern/locks.h> |
39236c6e A |
80 | #include <kern/zalloc.h> |
81 | #endif /* BSD_KERNEL_PRIVATE */ | |
9bccf70c A |
82 | |
83 | #include <netinet6/ipsec.h> /* for IPSEC */ | |
fe8ab488 A |
84 | #if NECP |
85 | #include <net/necp.h> | |
86 | #endif | |
87 | ||
88 | #if IPSEC | |
89 | #include <netinet6/ipsec.h> /* for IPSEC */ | |
90 | #endif | |
9bccf70c | 91 | |
316670eb | 92 | #ifdef BSD_KERNEL_PRIVATE |
1c79356b | 93 | /* |
39236c6e A |
94 | * struct inpcb is the common protocol control block structure used in most |
95 | * IP transport protocols. | |
96 | * | |
97 | * Pointers to local and foreign host table entries, local and foreign socket | |
98 | * numbers, and pointers up (to a socket structure) and down (to a | |
99 | * protocol-specific control block) are stored here. | |
1c79356b A |
100 | */ |
101 | LIST_HEAD(inpcbhead, inpcb); | |
102 | LIST_HEAD(inpcbporthead, inpcbport); | |
316670eb | 103 | #endif /* BSD_KERNEL_PRIVATE */ |
316670eb | 104 | typedef u_quad_t inp_gen_t; |
39236c6e | 105 | |
1c79356b A |
106 | /* |
107 | * PCB with AF_INET6 null bind'ed laddr can receive AF_INET input packet. | |
6d2010ae A |
108 | * So, AF_INET6 null laddr is also used as AF_INET null laddr, by utilizing |
109 | * the following structure. | |
1c79356b A |
110 | */ |
111 | struct in_addr_4in6 { | |
9bccf70c A |
112 | u_int32_t ia46_pad32[3]; |
113 | struct in_addr ia46_addr4; | |
1c79356b A |
114 | }; |
115 | ||
39236c6e | 116 | #ifdef BSD_KERNEL_PRIVATE |
1c79356b A |
117 | /* |
118 | * NB: the zone allocator is type-stable EXCEPT FOR THE FIRST TWO LONGS | |
119 | * of the structure. Therefore, it is important that the members in | |
120 | * that position not contain any information which is required to be | |
121 | * stable. | |
122 | */ | |
9bccf70c | 123 | struct icmp6_filter; |
2d21ac55 A |
124 | #if CONFIG_MACF_NET |
125 | struct label; | |
126 | #endif | |
316670eb A |
127 | struct ifnet; |
128 | ||
316670eb | 129 | struct inp_stat { |
6d2010ae A |
130 | u_int64_t rxpackets; |
131 | u_int64_t rxbytes; | |
132 | u_int64_t txpackets; | |
133 | u_int64_t txbytes; | |
134 | }; | |
135 | ||
39236c6e A |
136 | /* |
137 | * struct inpcb captures the network layer state for TCP, UDP and raw IPv6 | |
138 | * and IPv6 sockets. In the case of TCP, further per-connection state is | |
139 | * hung off of inp_ppcb most of the time. | |
140 | */ | |
1c79356b | 141 | struct inpcb { |
39236c6e | 142 | decl_lck_mtx_data(, inpcb_mtx); /* inpcb per-socket mutex */ |
1c79356b | 143 | LIST_ENTRY(inpcb) inp_hash; /* hash list */ |
1c79356b | 144 | LIST_ENTRY(inpcb) inp_list; /* list for all PCBs of this proto */ |
6d2010ae | 145 | void *inp_ppcb; /* pointer to per-protocol pcb */ |
39236c6e A |
146 | struct inpcbinfo *inp_pcbinfo; /* PCB list info */ |
147 | struct socket *inp_socket; /* back pointer to socket */ | |
1c79356b | 148 | LIST_ENTRY(inpcb) inp_portlist; /* list for this PCB's local port */ |
bd504ef0 | 149 | RB_ENTRY(inpcb) infc_link; /* link for flowhash RB tree */ |
39236c6e | 150 | struct inpcbport *inp_phd; /* head of this list */ |
1c79356b | 151 | inp_gen_t inp_gencnt; /* generation count of this instance */ |
39236c6e A |
152 | int inp_hash_element; /* array index of pcb's hash list */ |
153 | int inp_wantcnt; /* wanted count; atomically updated */ | |
154 | int inp_state; /* state (INUSE/CACHED/DEAD) */ | |
155 | u_short inp_fport; /* foreign port */ | |
156 | u_short inp_lport; /* local port */ | |
316670eb | 157 | u_int32_t inp_flags; /* generic IP/datagram flags */ |
bd504ef0 | 158 | u_int32_t inp_flags2; /* generic IP/datagram flags #2 */ |
39236c6e | 159 | u_int32_t inp_flow; /* IPv6 flow information */ |
1c79356b | 160 | |
316670eb A |
161 | u_char inp_sndinprog_cnt; /* outstanding send operations */ |
162 | u_char inp_vflag; /* INP_IPV4 or INP_IPV6 */ | |
1c79356b A |
163 | |
164 | u_char inp_ip_ttl; /* time to live proto */ | |
165 | u_char inp_ip_p; /* protocol proto */ | |
39236c6e A |
166 | |
167 | struct ifnet *inp_boundifp; /* interface for INP_BOUND_IF */ | |
168 | struct ifnet *inp_last_outifp; /* last known outgoing interface */ | |
169 | u_int32_t inp_flowhash; /* flow hash */ | |
170 | ||
171 | /* Protocol-dependent part */ | |
1c79356b A |
172 | union { |
173 | /* foreign host table entry */ | |
39236c6e A |
174 | struct in_addr_4in6 inp46_foreign; |
175 | struct in6_addr inp6_foreign; | |
1c79356b A |
176 | } inp_dependfaddr; |
177 | union { | |
178 | /* local host table entry */ | |
39236c6e A |
179 | struct in_addr_4in6 inp46_local; |
180 | struct in6_addr inp6_local; | |
1c79356b A |
181 | } inp_dependladdr; |
182 | union { | |
183 | /* placeholder for routing entry */ | |
39236c6e A |
184 | struct route inp4_route; |
185 | struct route_in6 inp6_route; | |
1c79356b A |
186 | } inp_dependroute; |
187 | struct { | |
188 | /* type of service proto */ | |
189 | u_char inp4_ip_tos; | |
190 | /* IP options */ | |
191 | struct mbuf *inp4_options; | |
192 | /* IP multicast options */ | |
193 | struct ip_moptions *inp4_moptions; | |
194 | } inp_depend4; | |
1c79356b A |
195 | struct { |
196 | /* IP options */ | |
197 | struct mbuf *inp6_options; | |
1c79356b | 198 | /* IP6 options for outgoing packets */ |
9bccf70c | 199 | struct ip6_pktopts *inp6_outputopts; |
1c79356b | 200 | /* IP multicast options */ |
9bccf70c | 201 | struct ip6_moptions *inp6_moptions; |
1c79356b | 202 | /* ICMPv6 code type filter */ |
9bccf70c | 203 | struct icmp6_filter *inp6_icmp6filt; |
1c79356b | 204 | /* IPV6_CHECKSUM setsockopt */ |
9bccf70c | 205 | int inp6_cksum; |
1c79356b A |
206 | short inp6_hops; |
207 | } inp_depend6; | |
9bccf70c | 208 | |
1c79356b | 209 | caddr_t inp_saved_ppcb; /* place to save pointer while cached */ |
2d21ac55 A |
210 | #if CONFIG_MACF_NET |
211 | struct label *inp_label; /* MAC label */ | |
212 | #endif | |
39236c6e A |
213 | #if IPSEC |
214 | struct inpcbpolicy *inp_sp; /* for IPSec */ | |
215 | #endif /* IPSEC */ | |
fe8ab488 A |
216 | #if NECP |
217 | struct { | |
218 | char *inp_domain; | |
219 | char *inp_account; | |
220 | } inp_necp_attributes; | |
221 | struct necp_inpcb_result inp_policyresult; | |
222 | #endif | |
3e170ce0 A |
223 | u_char *inp_keepalive_data; /* for keepalive offload */ |
224 | u_int8_t inp_keepalive_datalen; /* keepalive data length */ | |
225 | u_int8_t inp_keepalive_type; /* type of application */ | |
226 | u_int16_t inp_keepalive_interval; /* keepalive interval */ | |
227 | uint32_t inp_nstat_refcnt __attribute__((aligned(4))); | |
6d2010ae | 228 | struct inp_stat *inp_stat; |
39236c6e A |
229 | struct inp_stat *inp_cstat; /* cellular data */ |
230 | struct inp_stat *inp_wstat; /* Wi-Fi data */ | |
fe8ab488 | 231 | struct inp_stat *inp_Wstat; /* Wired data */ |
39236c6e A |
232 | u_int8_t inp_stat_store[sizeof (struct inp_stat) + sizeof (u_int64_t)]; |
233 | u_int8_t inp_cstat_store[sizeof (struct inp_stat) + sizeof (u_int64_t)]; | |
234 | u_int8_t inp_wstat_store[sizeof (struct inp_stat) + sizeof (u_int64_t)]; | |
fe8ab488 | 235 | u_int8_t inp_Wstat_store[sizeof (struct inp_stat) + sizeof (u_int64_t)]; |
1c79356b | 236 | }; |
91447636 | 237 | |
fe8ab488 A |
238 | #define INP_ADD_STAT(_inp, _cnt_cellular, _cnt_wifi, _cnt_wired, _a, _n)\ |
239 | do { \ | |
39236c6e A |
240 | locked_add_64(&((_inp)->inp_stat->_a), (_n)); \ |
241 | if (_cnt_cellular) \ | |
242 | locked_add_64(&((_inp)->inp_cstat->_a), (_n)); \ | |
243 | if (_cnt_wifi) \ | |
244 | locked_add_64(&((_inp)->inp_wstat->_a), (_n)); \ | |
fe8ab488 A |
245 | if (_cnt_wired) \ |
246 | locked_add_64(&((_inp)->inp_Wstat->_a), (_n)); \ | |
39236c6e A |
247 | } while (0); |
248 | #endif /* BSD_KERNEL_PRIVATE */ | |
1c79356b A |
249 | |
250 | /* | |
251 | * Interface exported to userland by various protocols which use | |
252 | * inpcbs. Hack alert -- only define if struct xsocket is in scope. | |
253 | */ | |
39236c6e | 254 | #pragma pack(4) |
91447636 | 255 | |
39236c6e A |
256 | #if defined(__LP64__) |
257 | struct _inpcb_list_entry { | |
258 | u_int32_t le_next; | |
259 | u_int32_t le_prev; | |
260 | }; | |
261 | #define _INPCB_PTR(x) u_int32_t | |
262 | #define _INPCB_LIST_ENTRY(x) struct _inpcb_list_entry | |
263 | #else /* !__LP64__ */ | |
264 | #define _INPCB_PTR(x) x | |
265 | #define _INPCB_LIST_ENTRY(x) LIST_ENTRY(x) | |
266 | #endif /* !__LP64__ */ | |
267 | ||
268 | #ifdef XNU_KERNEL_PRIVATE | |
91447636 A |
269 | /* |
270 | * This is a copy of the inpcb as it shipped in Panther. This structure | |
271 | * is filled out in a copy function. This allows the inpcb to change | |
272 | * without breaking userland tools. | |
39236c6e | 273 | * |
91447636 A |
274 | * CAUTION: Many fields may not be filled out. Fewer may be filled out |
275 | * in the future. Code defensively. | |
276 | */ | |
91447636 A |
277 | struct inpcb_compat { |
278 | #else | |
279 | struct inpcbinfo; | |
280 | struct inpcbport; | |
281 | struct mbuf; | |
2d21ac55 A |
282 | struct ip6_pktopts; |
283 | struct ip6_moptions; | |
284 | struct icmp6_filter; | |
91447636 A |
285 | struct inpcbpolicy; |
286 | ||
287 | struct inpcb { | |
288 | #endif /* KERNEL_PRIVATE */ | |
2d21ac55 | 289 | _INPCB_LIST_ENTRY(inpcb) inp_hash; /* hash list */ |
39236c6e A |
290 | struct in_addr reserved1; /* reserved */ |
291 | struct in_addr reserved2; /* reserved */ | |
292 | u_short inp_fport; /* foreign port */ | |
293 | u_short inp_lport; /* local port */ | |
294 | _INPCB_LIST_ENTRY(inpcb) inp_list; /* list for all peer PCBs */ | |
295 | _INPCB_PTR(caddr_t) inp_ppcb; /* per-protocol pcb */ | |
296 | _INPCB_PTR(struct inpcbinfo *) inp_pcbinfo; /* PCB list info */ | |
297 | _INPCB_PTR(void *) inp_socket; /* back pointer to socket */ | |
298 | u_char nat_owner; /* Used to NAT TCP/UDP traffic */ | |
2d21ac55 | 299 | u_int32_t nat_cookie; /* Cookie stored and returned to NAT */ |
39236c6e A |
300 | _INPCB_LIST_ENTRY(inpcb) inp_portlist; /* this PCB's local port list */ |
301 | _INPCB_PTR(struct inpcbport *) inp_phd; /* head of this list */ | |
91447636 | 302 | inp_gen_t inp_gencnt; /* generation count of this instance */ |
39236c6e | 303 | int inp_flags; /* generic IP/datagram flags */ |
91447636 A |
304 | u_int32_t inp_flow; |
305 | ||
39236c6e | 306 | u_char inp_vflag; |
91447636 A |
307 | |
308 | u_char inp_ip_ttl; /* time to live proto */ | |
309 | u_char inp_ip_p; /* protocol proto */ | |
310 | /* protocol dependent part */ | |
311 | union { | |
312 | /* foreign host table entry */ | |
39236c6e A |
313 | struct in_addr_4in6 inp46_foreign; |
314 | struct in6_addr inp6_foreign; | |
91447636 A |
315 | } inp_dependfaddr; |
316 | union { | |
317 | /* local host table entry */ | |
39236c6e A |
318 | struct in_addr_4in6 inp46_local; |
319 | struct in6_addr inp6_local; | |
91447636 A |
320 | } inp_dependladdr; |
321 | union { | |
322 | /* placeholder for routing entry */ | |
39236c6e A |
323 | u_char inp4_route[20]; |
324 | u_char inp6_route[32]; | |
91447636 A |
325 | } inp_dependroute; |
326 | struct { | |
327 | /* type of service proto */ | |
328 | u_char inp4_ip_tos; | |
329 | /* IP options */ | |
2d21ac55 | 330 | _INPCB_PTR(struct mbuf *) inp4_options; |
91447636 | 331 | /* IP multicast options */ |
2d21ac55 | 332 | _INPCB_PTR(struct ip_moptions *) inp4_moptions; |
91447636 A |
333 | } inp_depend4; |
334 | ||
335 | struct { | |
336 | /* IP options */ | |
39236c6e A |
337 | _INPCB_PTR(struct mbuf *) inp6_options; |
338 | u_int8_t inp6_hlim; | |
339 | u_int8_t unused_uint8_1; | |
340 | ushort unused_uint16_1; | |
91447636 | 341 | /* IP6 options for outgoing packets */ |
39236c6e | 342 | _INPCB_PTR(struct ip6_pktopts *) inp6_outputopts; |
91447636 | 343 | /* IP multicast options */ |
39236c6e | 344 | _INPCB_PTR(struct ip6_moptions *) inp6_moptions; |
91447636 | 345 | /* ICMPv6 code type filter */ |
39236c6e | 346 | _INPCB_PTR(struct icmp6_filter *) inp6_icmp6filt; |
91447636 A |
347 | /* IPV6_CHECKSUM setsockopt */ |
348 | int inp6_cksum; | |
349 | u_short inp6_ifindex; | |
350 | short inp6_hops; | |
351 | } inp_depend6; | |
352 | ||
39236c6e A |
353 | int hash_element; /* Array index of pcb's hash list */ |
354 | _INPCB_PTR(caddr_t) inp_saved_ppcb; /* pointer while cached */ | |
355 | _INPCB_PTR(struct inpcbpolicy *) inp_sp; | |
356 | u_int32_t reserved[3]; /* reserved */ | |
91447636 A |
357 | }; |
358 | ||
1c79356b | 359 | struct xinpcb { |
2d21ac55 | 360 | u_int32_t xi_len; /* length of this structure */ |
39236c6e | 361 | #ifdef XNU_KERNEL_PRIVATE |
91447636 A |
362 | struct inpcb_compat xi_inp; |
363 | #else | |
1c79356b | 364 | struct inpcb xi_inp; |
91447636 | 365 | #endif |
1c79356b A |
366 | struct xsocket xi_socket; |
367 | u_quad_t xi_alignment_hack; | |
368 | }; | |
369 | ||
b0d623f7 A |
370 | struct inpcb64_list_entry { |
371 | u_int64_t le_next; | |
372 | u_int64_t le_prev; | |
373 | }; | |
374 | ||
375 | struct xinpcb64 { | |
39236c6e A |
376 | u_int64_t xi_len; /* length of this structure */ |
377 | u_int64_t xi_inpp; | |
378 | u_short inp_fport; /* foreign port */ | |
379 | u_short inp_lport; /* local port */ | |
380 | struct inpcb64_list_entry inp_list; /* list for all PCBs */ | |
381 | u_int64_t inp_ppcb; /* ptr to per-protocol PCB */ | |
382 | u_int64_t inp_pcbinfo; /* PCB list info */ | |
383 | struct inpcb64_list_entry inp_portlist; /* this PCB's local port list */ | |
384 | u_int64_t inp_phd; /* head of this list */ | |
385 | inp_gen_t inp_gencnt; /* current generation count */ | |
386 | int inp_flags; /* generic IP/datagram flags */ | |
387 | u_int32_t inp_flow; | |
388 | u_char inp_vflag; | |
389 | u_char inp_ip_ttl; /* time to live */ | |
390 | u_char inp_ip_p; /* protocol */ | |
391 | union { /* foreign host table entry */ | |
392 | struct in_addr_4in6 inp46_foreign; | |
393 | struct in6_addr inp6_foreign; | |
394 | } inp_dependfaddr; | |
395 | union { /* local host table entry */ | |
396 | struct in_addr_4in6 inp46_local; | |
397 | struct in6_addr inp6_local; | |
398 | } inp_dependladdr; | |
6d2010ae | 399 | struct { |
39236c6e A |
400 | u_char inp4_ip_tos; /* type of service */ |
401 | } inp_depend4; | |
6d2010ae | 402 | struct { |
39236c6e A |
403 | u_int8_t inp6_hlim; |
404 | int inp6_cksum; | |
405 | u_short inp6_ifindex; | |
406 | short inp6_hops; | |
407 | } inp_depend6; | |
408 | struct xsocket64 xi_socket; | |
409 | u_quad_t xi_alignment_hack; | |
b0d623f7 A |
410 | }; |
411 | ||
6d2010ae | 412 | #ifdef PRIVATE |
6d2010ae A |
413 | struct xinpcb_list_entry { |
414 | u_int64_t le_next; | |
415 | u_int64_t le_prev; | |
416 | }; | |
417 | ||
418 | struct xinpcb_n { | |
39236c6e A |
419 | u_int32_t xi_len; /* length of this structure */ |
420 | u_int32_t xi_kind; /* XSO_INPCB */ | |
421 | u_int64_t xi_inpp; | |
422 | u_short inp_fport; /* foreign port */ | |
423 | u_short inp_lport; /* local port */ | |
424 | u_int64_t inp_ppcb; /* pointer to per-protocol pcb */ | |
425 | inp_gen_t inp_gencnt; /* generation count of this instance */ | |
426 | int inp_flags; /* generic IP/datagram flags */ | |
427 | u_int32_t inp_flow; | |
428 | u_char inp_vflag; | |
429 | u_char inp_ip_ttl; /* time to live */ | |
430 | u_char inp_ip_p; /* protocol */ | |
431 | union { /* foreign host table entry */ | |
432 | struct in_addr_4in6 inp46_foreign; | |
433 | struct in6_addr inp6_foreign; | |
434 | } inp_dependfaddr; | |
435 | union { /* local host table entry */ | |
436 | struct in_addr_4in6 inp46_local; | |
437 | struct in6_addr inp6_local; | |
438 | } inp_dependladdr; | |
6d2010ae | 439 | struct { |
39236c6e A |
440 | u_char inp4_ip_tos; /* type of service */ |
441 | } inp_depend4; | |
6d2010ae | 442 | struct { |
39236c6e A |
443 | u_int8_t inp6_hlim; |
444 | int inp6_cksum; | |
445 | u_short inp6_ifindex; | |
446 | short inp6_hops; | |
447 | } inp_depend6; | |
316670eb | 448 | u_int32_t inp_flowhash; |
fe8ab488 | 449 | u_int32_t inp_flags2; |
6d2010ae | 450 | }; |
6d2010ae A |
451 | #endif /* PRIVATE */ |
452 | ||
1c79356b | 453 | struct xinpgen { |
39236c6e A |
454 | u_int32_t xig_len; /* length of this structure */ |
455 | u_int xig_count; /* number of PCBs at this time */ | |
456 | inp_gen_t xig_gen; /* generation count at this time */ | |
457 | so_gen_t xig_sogen; /* current socket generation count */ | |
1c79356b | 458 | }; |
1c79356b | 459 | |
2d21ac55 A |
460 | #pragma pack() |
461 | ||
91447636 A |
462 | /* |
463 | * These defines are for use with the inpcb. | |
464 | */ | |
39236c6e A |
465 | #define INP_IPV4 0x1 |
466 | #define INP_IPV6 0x2 | |
91447636 A |
467 | #define inp_faddr inp_dependfaddr.inp46_foreign.ia46_addr4 |
468 | #define inp_laddr inp_dependladdr.inp46_local.ia46_addr4 | |
316670eb A |
469 | #define in6p_faddr inp_dependfaddr.inp6_foreign |
470 | #define in6p_laddr inp_dependladdr.inp6_local | |
471 | ||
472 | #ifdef BSD_KERNEL_PRIVATE | |
91447636 A |
473 | #define inp_route inp_dependroute.inp4_route |
474 | #define inp_ip_tos inp_depend4.inp4_ip_tos | |
475 | #define inp_options inp_depend4.inp4_options | |
476 | #define inp_moptions inp_depend4.inp4_moptions | |
91447636 A |
477 | #define in6p_route inp_dependroute.inp6_route |
478 | #define in6p_ip6_hlim inp_depend6.inp6_hlim | |
479 | #define in6p_hops inp_depend6.inp6_hops /* default hop limit */ | |
480 | #define in6p_ip6_nxt inp_ip_p | |
91447636 A |
481 | #define in6p_vflag inp_vflag |
482 | #define in6p_options inp_depend6.inp6_options | |
483 | #define in6p_outputopts inp_depend6.inp6_outputopts | |
484 | #define in6p_moptions inp_depend6.inp6_moptions | |
485 | #define in6p_icmp6filt inp_depend6.inp6_icmp6filt | |
486 | #define in6p_cksum inp_depend6.inp6_cksum | |
b0d623f7 | 487 | #define in6p_ifindex inp_depend6.inp6_ifindex |
39236c6e A |
488 | #define in6p_flags inp_flags |
489 | #define in6p_flags2 inp_flags2 | |
490 | #define in6p_socket inp_socket | |
491 | #define in6p_lport inp_lport | |
492 | #define in6p_fport inp_fport | |
493 | #define in6p_ppcb inp_ppcb | |
91447636 A |
494 | #define in6p_state inp_state |
495 | #define in6p_wantcnt inp_wantcnt | |
316670eb | 496 | #define in6p_last_outifp inp_last_outifp |
39236c6e A |
497 | #define in6pcb inpcb |
498 | #if IPSEC | |
499 | #define in6p_sp inp_sp | |
500 | #endif /* IPSEC */ | |
4bd07ac2 A |
501 | #define INP_INC_IFNET_STAT(_inp_, _stat_) { \ |
502 | if ((_inp_)->inp_last_outifp != NULL) { \ | |
503 | if ((_inp_)->inp_vflag & INP_IPV6) { \ | |
504 | (_inp_)->inp_last_outifp->if_ipv6_stat->_stat_++;\ | |
505 | } else { \ | |
506 | (_inp_)->inp_last_outifp->if_ipv4_stat->_stat_++;\ | |
507 | }\ | |
508 | }\ | |
509 | } | |
91447636 | 510 | |
1c79356b A |
511 | struct inpcbport { |
512 | LIST_ENTRY(inpcbport) phd_hash; | |
513 | struct inpcbhead phd_pcblist; | |
514 | u_short phd_port; | |
515 | }; | |
516 | ||
39236c6e A |
517 | struct intimercount { |
518 | u_int32_t intimer_lazy; /* lazy requests for timer scheduling */ | |
519 | u_int32_t intimer_fast; /* fast requests, can be coalesced */ | |
520 | u_int32_t intimer_nodelay; /* fast requests, never coalesced */ | |
1c79356b A |
521 | }; |
522 | ||
39236c6e A |
523 | typedef void (*inpcb_timer_func_t)(struct inpcbinfo *); |
524 | ||
525 | /* | |
526 | * Global data structure for each high-level protocol (UDP, TCP, ...) in both | |
527 | * IPv4 and IPv6. Holds inpcb lists and information for managing them. Each | |
528 | * pcbinfo is protected by a RW lock: ipi_lock. | |
529 | * | |
530 | * All INPCB pcbinfo entries are linked together via ipi_entry. | |
531 | */ | |
532 | struct inpcbinfo { | |
533 | /* | |
534 | * Glue to all PCB infos, as well as garbage collector and | |
535 | * timer callbacks, protected by inpcb_lock. Callout request | |
536 | * counts are atomically updated. | |
537 | */ | |
538 | TAILQ_ENTRY(inpcbinfo) ipi_entry; | |
539 | inpcb_timer_func_t ipi_gc; | |
540 | inpcb_timer_func_t ipi_timer; | |
541 | struct intimercount ipi_gc_req; | |
542 | struct intimercount ipi_timer_req; | |
543 | ||
544 | /* | |
545 | * Per-protocol lock protecting pcb list, pcb count, etc. | |
546 | */ | |
547 | lck_rw_t *ipi_lock; | |
548 | ||
549 | /* | |
550 | * List and count of pcbs on the protocol. | |
551 | */ | |
552 | struct inpcbhead *ipi_listhead; | |
553 | uint32_t ipi_count; | |
554 | ||
555 | /* | |
556 | * Count of pcbs marked with INP2_TIMEWAIT flag. | |
557 | */ | |
558 | uint32_t ipi_twcount; | |
559 | ||
560 | /* | |
561 | * Generation count -- incremented each time a connection is | |
562 | * allocated or freed. | |
563 | */ | |
564 | uint64_t ipi_gencnt; | |
565 | ||
566 | /* | |
567 | * Fields associated with port lookup and allocation. | |
568 | */ | |
569 | uint16_t ipi_lastport; | |
570 | uint16_t ipi_lastlow; | |
571 | uint16_t ipi_lasthi; | |
572 | ||
573 | /* | |
574 | * Zone from which inpcbs are allocated for this protocol. | |
575 | */ | |
576 | struct zone *ipi_zone; | |
577 | ||
578 | /* | |
579 | * Per-protocol hash of pcbs, hashed by local and foreign | |
580 | * addresses and port numbers. | |
581 | */ | |
582 | struct inpcbhead *ipi_hashbase; | |
583 | u_long ipi_hashmask; | |
584 | ||
585 | /* | |
586 | * Per-protocol hash of pcbs, hashed by only local port number. | |
587 | */ | |
588 | struct inpcbporthead *ipi_porthashbase; | |
589 | u_long ipi_porthashmask; | |
590 | ||
591 | /* | |
592 | * Misc. | |
593 | */ | |
594 | lck_attr_t *ipi_lock_attr; | |
595 | lck_grp_t *ipi_lock_grp; | |
596 | lck_grp_attr_t *ipi_lock_grp_attr; | |
39037602 A |
597 | |
598 | #define INPCBINFO_UPDATE_MSS 0x1 | |
599 | u_int32_t ipi_flags; | |
39236c6e A |
600 | }; |
601 | ||
602 | #define INP_PCBHASH(faddr, lport, fport, mask) \ | |
1c79356b | 603 | (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) |
39236c6e | 604 | #define INP_PCBPORTHASH(lport, mask) \ |
1c79356b A |
605 | (ntohs((lport)) & (mask)) |
606 | ||
39236c6e A |
607 | #define INP_IS_FLOW_CONTROLLED(_inp_) \ |
608 | ((_inp_)->inp_flags & INP_FLOW_CONTROLLED) | |
609 | #define INP_IS_FLOW_SUSPENDED(_inp_) \ | |
610 | (((_inp_)->inp_flags & INP_FLOW_SUSPENDED) || \ | |
316670eb | 611 | ((_inp_)->inp_socket->so_flags & SOF_SUSPENDED)) |
39236c6e | 612 | #define INP_WAIT_FOR_IF_FEEDBACK(_inp_) \ |
316670eb A |
613 | (((_inp_)->inp_flags & (INP_FLOW_CONTROLLED | INP_FLOW_SUSPENDED)) != 0) |
614 | ||
fe8ab488 A |
615 | #define INP_NO_CELLULAR(_inp) \ |
616 | ((_inp)->inp_flags & INP_NO_IFT_CELLULAR) | |
617 | #define INP_NO_EXPENSIVE(_inp) \ | |
618 | ((_inp)->inp_flags2 & INP2_NO_IFF_EXPENSIVE) | |
619 | #define INP_AWDL_UNRESTRICTED(_inp) \ | |
620 | ((_inp)->inp_flags2 & INP2_AWDL_UNRESTRICTED) | |
39037602 A |
621 | #define INP_INTCOPROC_ALLOWED(_inp) \ |
622 | ((_inp)->inp_flags2 & INP2_INTCOPROC_ALLOWED) | |
fe8ab488 | 623 | |
316670eb | 624 | #endif /* BSD_KERNEL_PRIVATE */ |
91447636 | 625 | |
39236c6e A |
626 | /* |
627 | * Flags for inp_flags. | |
628 | * | |
629 | * Some of these are publicly defined for legacy reasons, as they are | |
630 | * (unfortunately) used by certain applications to determine, at compile | |
631 | * time, whether or not the OS supports certain features. | |
632 | */ | |
316670eb | 633 | #ifdef BSD_KERNEL_PRIVATE |
39236c6e A |
634 | #define INP_RECVOPTS 0x00000001 /* receive incoming IP options */ |
635 | #define INP_RECVRETOPTS 0x00000002 /* receive IP options for reply */ | |
636 | #define INP_RECVDSTADDR 0x00000004 /* receive IP dst address */ | |
637 | #define INP_HDRINCL 0x00000008 /* user supplies entire IP header */ | |
638 | #define INP_HIGHPORT 0x00000010 /* user wants "high" port binding */ | |
639 | #define INP_LOWPORT 0x00000020 /* user wants "low" port binding */ | |
316670eb | 640 | #endif /* BSD_KERNEL_PRIVATE */ |
9bccf70c | 641 | |
39236c6e | 642 | #define INP_ANONPORT 0x00000040 /* port chosen for user */ |
316670eb A |
643 | |
644 | #ifdef BSD_KERNEL_PRIVATE | |
39236c6e A |
645 | #define INP_RECVIF 0x00000080 /* receive incoming interface */ |
646 | #define INP_MTUDISC 0x00000100 /* unused */ | |
647 | #define INP_STRIPHDR 0x00000200 /* strip hdrs in raw_ip (for OT) */ | |
648 | #define INP_RECV_ANYIF 0x00000400 /* don't restrict inbound iface */ | |
649 | #define INP_INADDR_ANY 0x00000800 /* local address wasn't specified */ | |
650 | #define INP_IN6ADDR_ANY INP_INADDR_ANY | |
651 | #define INP_RECVTTL 0x00001000 /* receive incoming IP TTL */ | |
652 | #define INP_UDP_NOCKSUM 0x00002000 /* turn off outbound UDP checksum */ | |
653 | #define INP_BOUND_IF 0x00004000 /* bind socket to an interface */ | |
316670eb A |
654 | #endif /* BSD_KERNEL_PRIVATE */ |
655 | ||
39236c6e | 656 | #define IN6P_IPV6_V6ONLY 0x00008000 /* restrict AF_INET6 socket for v6 */ |
316670eb A |
657 | |
658 | #ifdef BSD_KERNEL_PRIVATE | |
39236c6e A |
659 | #define IN6P_PKTINFO 0x00010000 /* receive IP6 dst and I/F */ |
660 | #define IN6P_HOPLIMIT 0x00020000 /* receive hoplimit */ | |
661 | #define IN6P_HOPOPTS 0x00040000 /* receive hop-by-hop options */ | |
662 | #define IN6P_DSTOPTS 0x00080000 /* receive dst options after rthdr */ | |
663 | #define IN6P_RTHDR 0x00100000 /* receive routing header */ | |
664 | #define IN6P_RTHDRDSTOPTS 0x00200000 /* receive dstoptions before rthdr */ | |
665 | #define IN6P_TCLASS 0x00400000 /* receive traffic class value */ | |
666 | #define IN6P_AUTOFLOWLABEL 0x00800000 /* attach flowlabel automatically */ | |
316670eb | 667 | #endif /* BSD_KERNEL_PRIVATE */ |
1c79356b | 668 | |
39236c6e | 669 | #define IN6P_BINDV6ONLY 0x01000000 /* do not grab IPv4 traffic */ |
1c79356b | 670 | |
316670eb | 671 | #ifdef BSD_KERNEL_PRIVATE |
39236c6e A |
672 | #define IN6P_RFC2292 0x02000000 /* used RFC2292 API on the socket */ |
673 | #define IN6P_MTU 0x04000000 /* receive path MTU */ | |
674 | #define INP_PKTINFO 0x08000000 /* rcv and snd PKTINFO for IPv4 */ | |
675 | #define INP_FLOW_SUSPENDED 0x10000000 /* flow suspended */ | |
676 | #define INP_NO_IFT_CELLULAR 0x20000000 /* do not use cellular interface */ | |
677 | #define INP_FLOW_CONTROLLED 0x40000000 /* flow controlled */ | |
678 | #define INP_FC_FEEDBACK 0x80000000 /* got interface flow adv feedback */ | |
679 | ||
680 | #define INP_CONTROLOPTS \ | |
681 | (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|INP_RECVIF|INP_RECVTTL| \ | |
682 | INP_PKTINFO|IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|IN6P_DSTOPTS| \ | |
683 | IN6P_RTHDR|IN6P_RTHDRDSTOPTS|IN6P_TCLASS|IN6P_RFC2292|IN6P_MTU) | |
684 | ||
685 | #define INP_UNMAPPABLEOPTS \ | |
686 | (IN6P_HOPOPTS|IN6P_DSTOPTS|IN6P_RTHDR| IN6P_TCLASS|IN6P_AUTOFLOWLABEL) | |
1c79356b | 687 | |
39236c6e A |
688 | /* |
689 | * Flags for inp_flags2. | |
690 | * | |
691 | * Overflowed INP flags; use INP2 prefix to avoid misuse. | |
692 | */ | |
693 | #define INP2_TIMEWAIT 0x00000001 /* in TIMEWAIT */ | |
694 | #define INP2_IN_FCTREE 0x00000002 /* in inp_fc_tree */ | |
fe8ab488 A |
695 | #define INP2_WANT_APP_POLICY 0x00000004 /* necp app policy check is desired */ |
696 | #define INP2_NO_IFF_EXPENSIVE 0x00000008 /* do not use expensive interface */ | |
697 | #define INP2_INHASHLIST 0x00000010 /* pcb is in inp_hash list */ | |
698 | #define INP2_AWDL_UNRESTRICTED 0x00000020 /* AWDL restricted mode allowed */ | |
39037602 A |
699 | #define INP2_KEEPALIVE_OFFLOAD 0x00000040 /* Enable UDP or TCP keepalive offload */ |
700 | #define INP2_INTCOPROC_ALLOWED 0x00000080 /* Allow communication via internal co-processor interfaces */ | |
1c79356b | 701 | |
39236c6e A |
702 | /* |
703 | * Flags passed to in_pcblookup*() functions. | |
704 | */ | |
705 | #define INPLOOKUP_WILDCARD 1 | |
316670eb | 706 | |
39236c6e A |
707 | #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) |
708 | #define sotoin6pcb(so) sotoinpcb(so) | |
9bccf70c | 709 | |
6d2010ae A |
710 | struct sysctl_req; |
711 | ||
39236c6e A |
712 | extern int ipport_lowfirstauto; |
713 | extern int ipport_lowlastauto; | |
714 | extern int ipport_firstauto; | |
715 | extern int ipport_lastauto; | |
716 | extern int ipport_hifirstauto; | |
717 | extern int ipport_hilastauto; | |
718 | ||
719 | /* freshly allocated PCB, it's in use */ | |
720 | #define INPCB_STATE_INUSE 0x1 | |
721 | /* this pcb is sitting in a a cache */ | |
722 | #define INPCB_STATE_CACHED 0x2 | |
723 | /* should treat as gone, will be garbage collected and freed */ | |
724 | #define INPCB_STATE_DEAD 0x3 | |
725 | ||
726 | /* marked as ready to be garbaged collected, should be treated as not found */ | |
727 | #define WNT_STOPUSING 0xffff | |
728 | /* that pcb is being acquired, do not recycle this time */ | |
729 | #define WNT_ACQUIRE 0x1 | |
730 | /* release acquired mode, can be garbage collected when wantcnt is null */ | |
731 | #define WNT_RELEASE 0x2 | |
732 | ||
733 | extern void in_pcbinit(void); | |
734 | extern void in_pcbinfo_attach(struct inpcbinfo *); | |
735 | extern int in_pcbinfo_detach(struct inpcbinfo *); | |
736 | ||
737 | /* type of timer to be scheduled by inpcb_gc_sched and inpcb_timer_sched */ | |
738 | enum { | |
739 | INPCB_TIMER_LAZY = 0x1, | |
740 | INPCB_TIMER_FAST, | |
741 | INPCB_TIMER_NODELAY | |
742 | }; | |
743 | extern void inpcb_gc_sched(struct inpcbinfo *, u_int32_t type); | |
744 | extern void inpcb_timer_sched(struct inpcbinfo *, u_int32_t type); | |
745 | ||
746 | extern void in_losing(struct inpcb *); | |
747 | extern void in_rtchange(struct inpcb *, int); | |
748 | extern int in_pcballoc(struct socket *, struct inpcbinfo *, struct proc *); | |
749 | extern int in_pcbbind(struct inpcb *, struct sockaddr *, struct proc *); | |
750 | extern int in_pcbconnect(struct inpcb *, struct sockaddr *, struct proc *, | |
751 | unsigned int, struct ifnet **); | |
752 | extern void in_pcbdetach(struct inpcb *); | |
753 | extern void in_pcbdispose(struct inpcb *); | |
754 | extern void in_pcbdisconnect(struct inpcb *); | |
755 | extern int in_pcbinshash(struct inpcb *, int); | |
756 | extern int in_pcbladdr(struct inpcb *, struct sockaddr *, struct in_addr *, | |
39037602 | 757 | unsigned int, struct ifnet **, int); |
b0d623f7 | 758 | extern struct inpcb *in_pcblookup_local(struct inpcbinfo *, struct in_addr, |
39236c6e | 759 | u_int, int); |
b0d623f7 | 760 | extern struct inpcb *in_pcblookup_local_and_cleanup(struct inpcbinfo *, |
39236c6e | 761 | struct in_addr, u_int, int); |
b0d623f7 | 762 | extern struct inpcb *in_pcblookup_hash(struct inpcbinfo *, struct in_addr, |
39236c6e A |
763 | u_int, struct in_addr, u_int, int, struct ifnet *); |
764 | extern int in_pcblookup_hash_exists(struct inpcbinfo *, struct in_addr, | |
765 | u_int, struct in_addr, u_int, int, uid_t *, gid_t *, struct ifnet *); | |
766 | extern void in_pcbnotifyall(struct inpcbinfo *, struct in_addr, int, | |
767 | void (*)(struct inpcb *, int)); | |
768 | extern void in_pcbrehash(struct inpcb *); | |
769 | extern int in_getpeeraddr(struct socket *, struct sockaddr **); | |
770 | extern int in_getpeeraddr_s(struct socket *, struct sockaddr_storage *); | |
771 | extern int in_getsockaddr(struct socket *, struct sockaddr **); | |
772 | extern int in_getsockaddr_s(struct socket *, struct sockaddr_storage *); | |
773 | extern int in_pcb_checkstate(struct inpcb *, int, int); | |
774 | extern void in_pcbremlists(struct inpcb *); | |
775 | extern void inpcb_to_compat(struct inpcb *, struct inpcb_compat *); | |
776 | extern void inpcb_to_xinpcb64(struct inpcb *, struct xinpcb64 *); | |
3e170ce0 | 777 | |
39236c6e | 778 | extern int get_pcblist_n(short, struct sysctl_req *, struct inpcbinfo *); |
3e170ce0 A |
779 | #define INPCB_GET_PORTS_USED_WILDCARDOK 0x01 |
780 | #define INPCB_GET_PORTS_USED_NOWAKEUPOK 0x02 | |
781 | #define INPCB_GET_PORTS_USED_RECVANYIFONLY 0x04 | |
782 | #define INPCB_GET_PORTS_USED_EXTBGIDLEONLY 0x08 | |
783 | #define INPCB_GET_PORTS_USED_ACTIVEONLY 0x10 | |
784 | ||
39236c6e A |
785 | extern void inpcb_get_ports_used(u_int32_t, int, u_int32_t, bitstr_t *, |
786 | struct inpcbinfo *); | |
787 | #define INPCB_OPPORTUNISTIC_THROTTLEON 0x0001 | |
788 | #define INPCB_OPPORTUNISTIC_SETCMD 0x0002 | |
789 | extern uint32_t inpcb_count_opportunistic(unsigned int, struct inpcbinfo *, | |
790 | u_int32_t); | |
791 | extern uint32_t inpcb_find_anypcb_byaddr(struct ifaddr *, struct inpcbinfo *); | |
792 | extern void inp_route_copyout(struct inpcb *, struct route *); | |
793 | extern void inp_route_copyin(struct inpcb *, struct route *); | |
794 | extern int inp_bindif(struct inpcb *, unsigned int, struct ifnet **); | |
795 | extern void inp_set_nocellular(struct inpcb *); | |
796 | extern void inp_clear_nocellular(struct inpcb *); | |
fe8ab488 A |
797 | extern void inp_set_noexpensive(struct inpcb *); |
798 | extern void inp_set_awdl_unrestricted(struct inpcb *); | |
799 | extern boolean_t inp_get_awdl_unrestricted(struct inpcb *); | |
800 | extern void inp_clear_awdl_unrestricted(struct inpcb *); | |
39037602 A |
801 | extern void inp_set_intcoproc_allowed(struct inpcb *); |
802 | extern boolean_t inp_get_intcoproc_allowed(struct inpcb *); | |
803 | extern void inp_clear_intcoproc_allowed(struct inpcb *); | |
fe8ab488 A |
804 | #if NECP |
805 | extern void inp_update_necp_policy(struct inpcb *, struct sockaddr *, struct sockaddr *, u_int); | |
806 | extern void inp_set_want_app_policy(struct inpcb *); | |
807 | extern void inp_clear_want_app_policy(struct inpcb *); | |
808 | #endif /* NECP */ | |
316670eb | 809 | extern u_int32_t inp_calc_flowhash(struct inpcb *); |
39236c6e A |
810 | extern void inp_reset_fc_state(struct inpcb *); |
811 | extern int inp_set_fc_state(struct inpcb *, int advcode); | |
812 | extern void inp_fc_unthrottle_tcp(struct inpcb *); | |
813 | extern void inp_flowadv(uint32_t); | |
814 | extern int inp_flush(struct inpcb *, int); | |
815 | extern int inp_findinpcb_procinfo(struct inpcbinfo *, uint32_t, struct so_procinfo *); | |
816 | extern void inp_get_soprocinfo(struct inpcb *, struct so_procinfo *); | |
817 | extern int inp_update_policy(struct inpcb *); | |
fe8ab488 A |
818 | extern boolean_t inp_restricted_recv(struct inpcb *, struct ifnet *); |
819 | extern boolean_t inp_restricted_send(struct inpcb *, struct ifnet *); | |
39037602 A |
820 | extern void inp_incr_sndbytes_total(struct socket *, int); |
821 | extern void inp_decr_sndbytes_total(struct socket *, int); | |
822 | extern void inp_count_sndbytes(struct inpcb *, u_int32_t); | |
823 | extern void inp_incr_sndbytes_unsent(struct socket *, int32_t); | |
824 | extern void inp_decr_sndbytes_unsent(struct socket *, int32_t); | |
825 | extern int32_t inp_get_sndbytes_allunsent(struct socket *, u_int32_t); | |
826 | extern void inp_decr_sndbytes_allunsent(struct socket *, u_int32_t); | |
316670eb | 827 | #endif /* BSD_KERNEL_PRIVATE */ |
316670eb | 828 | #ifdef KERNEL_PRIVATE |
39236c6e A |
829 | /* exported for PPP */ |
830 | extern void inp_clear_INP_INADDR_ANY(struct socket *); | |
91447636 | 831 | #endif /* KERNEL_PRIVATE */ |
1c79356b | 832 | #endif /* !_NETINET_IN_PCB_H_ */ |