in_pcb.h revision 1.76 1 1.76 ozaki /* $NetBSD: in_pcb.h,v 1.76 2022/11/04 09:03:20 ozaki-r Exp $ */
2 1.27 itojun
3 1.27 itojun /*
4 1.27 itojun * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5 1.27 itojun * All rights reserved.
6 1.31 itojun *
7 1.27 itojun * Redistribution and use in source and binary forms, with or without
8 1.27 itojun * modification, are permitted provided that the following conditions
9 1.27 itojun * are met:
10 1.27 itojun * 1. Redistributions of source code must retain the above copyright
11 1.27 itojun * notice, this list of conditions and the following disclaimer.
12 1.27 itojun * 2. Redistributions in binary form must reproduce the above copyright
13 1.27 itojun * notice, this list of conditions and the following disclaimer in the
14 1.27 itojun * documentation and/or other materials provided with the distribution.
15 1.27 itojun * 3. Neither the name of the project nor the names of its contributors
16 1.27 itojun * may be used to endorse or promote products derived from this software
17 1.27 itojun * without specific prior written permission.
18 1.31 itojun *
19 1.27 itojun * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20 1.27 itojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.27 itojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.27 itojun * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23 1.27 itojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.27 itojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.27 itojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.27 itojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.27 itojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.27 itojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.27 itojun * SUCH DAMAGE.
30 1.27 itojun */
31 1.7 cgd
32 1.1 cgd /*
33 1.6 mycroft * Copyright (c) 1982, 1986, 1990, 1993
34 1.6 mycroft * The Regents of the University of California. All rights reserved.
35 1.1 cgd *
36 1.1 cgd * Redistribution and use in source and binary forms, with or without
37 1.1 cgd * modification, are permitted provided that the following conditions
38 1.1 cgd * are met:
39 1.1 cgd * 1. Redistributions of source code must retain the above copyright
40 1.1 cgd * notice, this list of conditions and the following disclaimer.
41 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
42 1.1 cgd * notice, this list of conditions and the following disclaimer in the
43 1.1 cgd * documentation and/or other materials provided with the distribution.
44 1.34 agc * 3. Neither the name of the University nor the names of its contributors
45 1.1 cgd * may be used to endorse or promote products derived from this software
46 1.1 cgd * without specific prior written permission.
47 1.1 cgd *
48 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 1.1 cgd * SUCH DAMAGE.
59 1.1 cgd *
60 1.7 cgd * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93
61 1.1 cgd */
62 1.1 cgd
63 1.24 perry #ifndef _NETINET_IN_PCB_H_
64 1.24 perry #define _NETINET_IN_PCB_H_
65 1.24 perry
66 1.68 riastrad #include <sys/types.h>
67 1.68 riastrad
68 1.60 ozaki #include <net/route.h>
69 1.68 riastrad
70 1.68 riastrad #include <netinet/in.h>
71 1.68 riastrad #include <netinet/ip.h>
72 1.71 ozaki #include <netinet/ip6.h>
73 1.71 ozaki
74 1.71 ozaki typedef int (*pcb_overudp_cb_t)(struct mbuf **, int, struct socket *,
75 1.71 ozaki struct sockaddr *, void *);
76 1.68 riastrad
77 1.68 riastrad struct ip_moptions;
78 1.68 riastrad struct mbuf;
79 1.71 ozaki struct icmp6_filter;
80 1.10 mycroft
81 1.1 cgd /*
82 1.1 cgd * Common structure pcb for internet protocol implementation.
83 1.1 cgd * Here are stored pointers to local and foreign host table
84 1.1 cgd * entries, local and foreign socket numbers, and pointers
85 1.1 cgd * up (to a socket structure) and down (to a protocol-specific)
86 1.1 cgd * control block.
87 1.1 cgd */
88 1.71 ozaki
89 1.1 cgd struct inpcb {
90 1.71 ozaki LIST_ENTRY(inpcb) inp_hash;
91 1.71 ozaki LIST_ENTRY(inpcb) inp_lhash;
92 1.71 ozaki TAILQ_ENTRY(inpcb) inp_queue;
93 1.71 ozaki int inp_af; /* address family - AF_INET or AF_INET6 */
94 1.71 ozaki void * inp_ppcb; /* pointer to per-protocol pcb */
95 1.71 ozaki int inp_state; /* bind/connect state */
96 1.71 ozaki #define INP_ATTACHED 0
97 1.71 ozaki #define INP_BOUND 1
98 1.71 ozaki #define INP_CONNECTED 2
99 1.71 ozaki int inp_portalgo;
100 1.71 ozaki struct socket *inp_socket; /* back pointer to socket */
101 1.71 ozaki struct inpcbtable *inp_table;
102 1.71 ozaki struct inpcbpolicy *inp_sp; /* security policy */
103 1.71 ozaki struct route inp_route; /* placeholder for routing entry */
104 1.76 ozaki in_port_t inp_fport; /* foreign port */
105 1.76 ozaki in_port_t inp_lport; /* local port */
106 1.71 ozaki int inp_flags; /* generic IP/datagram flags */
107 1.71 ozaki struct mbuf *inp_options; /* IP options */
108 1.71 ozaki bool inp_bindportonsend;
109 1.71 ozaki
110 1.73 ozaki /* We still need it for IPv6 due to v4-mapped addresses */
111 1.71 ozaki struct ip_moptions *inp_moptions; /* IPv4 multicast options */
112 1.71 ozaki
113 1.71 ozaki pcb_overudp_cb_t inp_overudp_cb;
114 1.71 ozaki void *inp_overudp_arg;
115 1.1 cgd };
116 1.35 itojun
117 1.73 ozaki struct in4pcb {
118 1.73 ozaki struct inpcb in4p_pcb;
119 1.73 ozaki struct ip in4p_ip;
120 1.73 ozaki int in4p_errormtu; /* MTU of last xmit status = EMSGSIZE */
121 1.73 ozaki uint8_t in4p_ip_minttl;
122 1.73 ozaki struct in_addr in4p_prefsrcip; /* preferred src IP when wild */
123 1.73 ozaki };
124 1.73 ozaki
125 1.73 ozaki #define in4p_faddr(inpcb) (((struct in4pcb *)(inpcb))->in4p_ip.ip_dst)
126 1.73 ozaki #define in4p_laddr(inpcb) (((struct in4pcb *)(inpcb))->in4p_ip.ip_src)
127 1.73 ozaki #define const_in4p_faddr(inpcb) (((const struct in4pcb *)(inpcb))->in4p_ip.ip_dst)
128 1.73 ozaki #define const_in4p_laddr(inpcb) (((const struct in4pcb *)(inpcb))->in4p_ip.ip_src)
129 1.73 ozaki #define in4p_ip(inpcb) (((struct in4pcb *)(inpcb))->in4p_ip)
130 1.73 ozaki #define in4p_errormtu(inpcb) (((struct in4pcb *)(inpcb))->in4p_errormtu)
131 1.73 ozaki #define in4p_ip_minttl(inpcb) (((struct in4pcb *)(inpcb))->in4p_ip_minttl)
132 1.73 ozaki #define in4p_prefsrcip(inpcb) (((struct in4pcb *)(inpcb))->in4p_prefsrcip)
133 1.73 ozaki
134 1.73 ozaki struct in6pcb {
135 1.73 ozaki struct inpcb in6p_pcb;
136 1.73 ozaki struct ip6_hdr in6p_ip6;
137 1.73 ozaki int in6p_hops; /* default IPv6 hop limit */
138 1.73 ozaki int in6p_cksum; /* IPV6_CHECKSUM setsockopt */
139 1.73 ozaki struct icmp6_filter *in6p_icmp6filt;
140 1.73 ozaki struct ip6_pktopts *in6p_outputopts; /* IP6 options for outgoing packets */
141 1.73 ozaki struct ip6_moptions *in6p_moptions; /* IPv6 multicast options */
142 1.73 ozaki };
143 1.73 ozaki
144 1.73 ozaki #define in6p_faddr(inpcb) (((struct in6pcb *)(inpcb))->in6p_ip6.ip6_dst)
145 1.73 ozaki #define in6p_laddr(inpcb) (((struct in6pcb *)(inpcb))->in6p_ip6.ip6_src)
146 1.73 ozaki #define const_in6p_faddr(inpcb) (((const struct in6pcb *)(inpcb))->in6p_ip6.ip6_dst)
147 1.73 ozaki #define const_in6p_laddr(inpcb) (((const struct in6pcb *)(inpcb))->in6p_ip6.ip6_src)
148 1.73 ozaki #define in6p_ip6(inpcb) (((struct in6pcb *)(inpcb))->in6p_ip6)
149 1.73 ozaki #define in6p_flowinfo(inpcb) (((struct in6pcb *)(inpcb))->in6p_ip6.ip6_flow)
150 1.73 ozaki #define const_in6p_flowinfo(inpcb) (((const struct in6pcb *)(inpcb))->in6p_ip6.ip6_flow)
151 1.73 ozaki #define in6p_hops6(inpcb) (((struct in6pcb *)(inpcb))->in6p_hops)
152 1.73 ozaki #define in6p_cksum(inpcb) (((struct in6pcb *)(inpcb))->in6p_cksum)
153 1.73 ozaki #define in6p_icmp6filt(inpcb) (((struct in6pcb *)(inpcb))->in6p_icmp6filt)
154 1.73 ozaki #define in6p_outputopts(inpcb) (((struct in6pcb *)(inpcb))->in6p_outputopts)
155 1.73 ozaki #define in6p_moptions(inpcb) (((struct in6pcb *)(inpcb))->in6p_moptions)
156 1.71 ozaki
157 1.71 ozaki LIST_HEAD(inpcbhead, inpcb);
158 1.1 cgd
159 1.1 cgd /* flags in inp_flags: */
160 1.51 christos #define INP_RECVOPTS 0x0001 /* receive incoming IP options */
161 1.51 christos #define INP_RECVRETOPTS 0x0002 /* receive IP options for reply */
162 1.51 christos #define INP_RECVDSTADDR 0x0004 /* receive IP dst address */
163 1.51 christos #define INP_HDRINCL 0x0008 /* user supplies entire IP header */
164 1.51 christos #define INP_HIGHPORT 0x0010 /* (unused; FreeBSD compat) */
165 1.51 christos #define INP_LOWPORT 0x0020 /* user wants "low" port binding */
166 1.51 christos #define INP_ANONPORT 0x0040 /* port chosen for user */
167 1.51 christos #define INP_RECVIF 0x0080 /* receive incoming interface */
168 1.39 manu /* XXX should move to an UDP control block */
169 1.51 christos #define INP_ESPINUDP 0x0100 /* ESP over UDP for NAT-T */
170 1.51 christos #define INP_ESPINUDP_NON_IKE 0x0200 /* ESP over UDP for NAT-T */
171 1.51 christos #define INP_NOHEADER 0x0400 /* Kernel removes IP header
172 1.43 dyoung * before feeding a packet
173 1.43 dyoung * to the raw socket user.
174 1.43 dyoung * The socket user will
175 1.43 dyoung * not supply an IP header.
176 1.43 dyoung * Cancels INP_HDRINCL.
177 1.43 dyoung */
178 1.51 christos #define INP_RECVTTL 0x0800 /* receive incoming IP TTL */
179 1.65 christos #define INP_RECVPKTINFO 0x1000 /* receive IP dst if/addr */
180 1.69 christos #define INP_BINDANY 0x2000 /* allow bind to any address */
181 1.46 minskim #define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\
182 1.65 christos INP_RECVIF|INP_RECVTTL|INP_RECVPKTINFO)
183 1.1 cgd
184 1.71 ozaki /*
185 1.71 ozaki * Flags for IPv6 in inp_flags
186 1.71 ozaki * We define KAME's original flags in higher 16 bits as much as possible
187 1.71 ozaki * for compatibility with *bsd*s.
188 1.71 ozaki */
189 1.71 ozaki #define IN6P_RECVOPTS 0x00001000 /* receive incoming IP6 options */
190 1.71 ozaki #define IN6P_RECVRETOPTS 0x00002000 /* receive IP6 options for reply */
191 1.71 ozaki #define IN6P_RECVDSTADDR 0x00004000 /* receive IP6 dst address */
192 1.71 ozaki #define IN6P_IPV6_V6ONLY 0x00008000 /* restrict AF_INET6 socket for v6 */
193 1.71 ozaki #define IN6P_PKTINFO 0x00010000 /* receive IP6 dst and I/F */
194 1.71 ozaki #define IN6P_HOPLIMIT 0x00020000 /* receive hoplimit */
195 1.71 ozaki #define IN6P_HOPOPTS 0x00040000 /* receive hop-by-hop options */
196 1.71 ozaki #define IN6P_DSTOPTS 0x00080000 /* receive dst options after rthdr */
197 1.71 ozaki #define IN6P_RTHDR 0x00100000 /* receive routing header */
198 1.71 ozaki #define IN6P_RTHDRDSTOPTS 0x00200000 /* receive dstoptions before rthdr */
199 1.71 ozaki #define IN6P_TCLASS 0x00400000 /* traffic class */
200 1.71 ozaki #define IN6P_BINDANY 0x00800000 /* allow bind to any address */
201 1.71 ozaki #define IN6P_HIGHPORT 0x01000000 /* user wants "high" port binding */
202 1.71 ozaki #define IN6P_LOWPORT 0x02000000 /* user wants "low" port binding */
203 1.71 ozaki #define IN6P_ANONPORT 0x04000000 /* port chosen for user */
204 1.71 ozaki #define IN6P_FAITH 0x08000000 /* accept FAITH'ed connections */
205 1.71 ozaki /* XXX should move to an UDP control block */
206 1.71 ozaki #define IN6P_ESPINUDP INP_ESPINUDP /* ESP over UDP for NAT-T */
207 1.71 ozaki
208 1.71 ozaki #define IN6P_RFC2292 0x40000000 /* RFC2292 */
209 1.71 ozaki #define IN6P_MTU 0x80000000 /* use minimum MTU */
210 1.71 ozaki
211 1.71 ozaki #define IN6P_CONTROLOPTS (IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\
212 1.71 ozaki IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\
213 1.71 ozaki IN6P_TCLASS|IN6P_RFC2292|\
214 1.71 ozaki IN6P_MTU)
215 1.71 ozaki
216 1.16 mycroft #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
217 1.71 ozaki #define soaf(so) (so->so_proto->pr_domain->dom_family)
218 1.63 ozaki #define inp_lock(inp) solock((inp)->inp_socket)
219 1.63 ozaki #define inp_unlock(inp) sounlock((inp)->inp_socket)
220 1.63 ozaki #define inp_locked(inp) solocked((inp)->inp_socket)
221 1.1 cgd
222 1.71 ozaki TAILQ_HEAD(inpcbqueue, inpcb);
223 1.71 ozaki
224 1.71 ozaki struct vestigial_hooks;
225 1.71 ozaki
226 1.71 ozaki /* It's still referenced by kvm users */
227 1.71 ozaki struct inpcbtable {
228 1.71 ozaki struct inpcbqueue inpt_queue;
229 1.71 ozaki struct inpcbhead *inpt_porthashtbl;
230 1.71 ozaki struct inpcbhead *inpt_bindhashtbl;
231 1.71 ozaki struct inpcbhead *inpt_connecthashtbl;
232 1.71 ozaki u_long inpt_porthash;
233 1.71 ozaki u_long inpt_bindhash;
234 1.71 ozaki u_long inpt_connecthash;
235 1.76 ozaki in_port_t inpt_lastport;
236 1.76 ozaki in_port_t inpt_lastlow;
237 1.71 ozaki
238 1.71 ozaki struct vestigial_hooks *vestige;
239 1.71 ozaki };
240 1.71 ozaki #define inpt_lasthi inpt_lastport
241 1.71 ozaki
242 1.8 jtc #ifdef _KERNEL
243 1.68 riastrad
244 1.68 riastrad #include <sys/kauth.h>
245 1.68 riastrad #include <sys/queue.h>
246 1.68 riastrad
247 1.68 riastrad struct lwp;
248 1.68 riastrad struct rtentry;
249 1.68 riastrad struct sockaddr_in;
250 1.68 riastrad struct socket;
251 1.68 riastrad struct vestigial_inpcb;
252 1.68 riastrad
253 1.74 ozaki void inpcb_losing(struct inpcb *);
254 1.74 ozaki int inpcb_create(struct socket *, void *);
255 1.74 ozaki int inpcb_bindableaddr(const struct inpcb *, struct sockaddr_in *,
256 1.69 christos kauth_cred_t);
257 1.74 ozaki int inpcb_bind(void *, struct sockaddr_in *, struct lwp *);
258 1.74 ozaki int inpcb_connect(void *, struct sockaddr_in *, struct lwp *);
259 1.74 ozaki void inpcb_destroy(void *);
260 1.74 ozaki void inpcb_disconnect(void *);
261 1.74 ozaki void inpcb_init(struct inpcbtable *, int, int);
262 1.35 itojun struct inpcb *
263 1.74 ozaki inpcb_lookup_local(struct inpcbtable *,
264 1.48 dyoung struct in_addr, u_int, int, struct vestigial_inpcb *);
265 1.13 mycroft struct inpcb *
266 1.74 ozaki inpcb_lookup_bound(struct inpcbtable *,
267 1.37 matt struct in_addr, u_int);
268 1.17 mycroft struct inpcb *
269 1.74 ozaki inpcb_lookup(struct inpcbtable *,
270 1.48 dyoung struct in_addr, u_int, struct in_addr, u_int,
271 1.48 dyoung struct vestigial_inpcb *);
272 1.74 ozaki int inpcb_notify(struct inpcbtable *, struct in_addr, u_int,
273 1.37 matt struct in_addr, u_int, int, void (*)(struct inpcb *, int));
274 1.74 ozaki void inpcb_notifyall(struct inpcbtable *, struct in_addr, int,
275 1.37 matt void (*)(struct inpcb *, int));
276 1.74 ozaki void inpcb_purgeif0(struct inpcbtable *, struct ifnet *);
277 1.74 ozaki void inpcb_purgeif(struct inpcbtable *, struct ifnet *);
278 1.55 seanb void in_purgeifmcast(struct ip_moptions *, struct ifnet *);
279 1.74 ozaki void inpcb_set_state(struct inpcb *, int);
280 1.74 ozaki void inpcb_rtchange(struct inpcb *, int);
281 1.74 ozaki void inpcb_fetch_peeraddr(struct inpcb *, struct sockaddr_in *);
282 1.74 ozaki void inpcb_fetch_sockaddr(struct inpcb *, struct sockaddr_in *);
283 1.21 thorpej struct rtentry *
284 1.74 ozaki inpcb_rtentry(struct inpcb *);
285 1.74 ozaki void inpcb_rtentry_unref(struct rtentry *, struct inpcb *);
286 1.67 riastrad
287 1.75 ozaki void in6pcb_init(struct inpcbtable *, int, int);
288 1.75 ozaki int in6pcb_bind(void *, struct sockaddr_in6 *, struct lwp *);
289 1.75 ozaki int in6pcb_connect(void *, struct sockaddr_in6 *, struct lwp *);
290 1.75 ozaki void in6pcb_destroy(struct inpcb *);
291 1.75 ozaki void in6pcb_disconnect(struct inpcb *);
292 1.75 ozaki struct inpcb *in6pcb_lookup_local(struct inpcbtable *, struct in6_addr *,
293 1.71 ozaki u_int, int, struct vestigial_inpcb *);
294 1.75 ozaki int in6pcb_notify(struct inpcbtable *, const struct sockaddr *,
295 1.71 ozaki u_int, const struct sockaddr *, u_int, int, void *,
296 1.71 ozaki void (*)(struct inpcb *, int));
297 1.75 ozaki void in6pcb_purgeif0(struct inpcbtable *, struct ifnet *);
298 1.75 ozaki void in6pcb_purgeif(struct inpcbtable *, struct ifnet *);
299 1.75 ozaki void in6pcb_set_state(struct inpcb *, int);
300 1.75 ozaki void in6pcb_rtchange(struct inpcb *, int);
301 1.75 ozaki void in6pcb_fetch_peeraddr(struct inpcb *, struct sockaddr_in6 *);
302 1.75 ozaki void in6pcb_fetch_sockaddr(struct inpcb *, struct sockaddr_in6 *);
303 1.71 ozaki
304 1.71 ozaki /* in in6_src.c */
305 1.75 ozaki int in6pcb_selecthlim(struct inpcb *, struct ifnet *);
306 1.75 ozaki int in6pcb_selecthlim_rt(struct inpcb *);
307 1.75 ozaki int in6pcb_set_port(struct sockaddr_in6 *, struct inpcb *, struct lwp *);
308 1.71 ozaki
309 1.71 ozaki extern struct rtentry *
310 1.75 ozaki in6pcb_rtentry(struct inpcb *);
311 1.71 ozaki extern void
312 1.75 ozaki in6pcb_rtentry_unref(struct rtentry *, struct inpcb *);
313 1.75 ozaki extern struct inpcb *in6pcb_lookup(struct inpcbtable *,
314 1.71 ozaki const struct in6_addr *, u_int, const struct in6_addr *, u_int, int,
315 1.71 ozaki struct vestigial_inpcb *);
316 1.75 ozaki extern struct inpcb *in6pcb_lookup_bound(struct inpcbtable *,
317 1.71 ozaki const struct in6_addr *, u_int, int);
318 1.71 ozaki
319 1.67 riastrad static inline void
320 1.74 ozaki inpcb_register_overudp_cb(struct inpcb *inp, pcb_overudp_cb_t cb, void *arg)
321 1.67 riastrad {
322 1.67 riastrad
323 1.67 riastrad inp->inp_overudp_cb = cb;
324 1.67 riastrad inp->inp_overudp_arg = arg;
325 1.67 riastrad }
326 1.24 perry
327 1.71 ozaki /* compute hash value for foreign and local in6_addr and port */
328 1.71 ozaki #define IN6_HASH(faddr, fport, laddr, lport) \
329 1.71 ozaki (((faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^ \
330 1.71 ozaki (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3] ^ \
331 1.71 ozaki (laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^ \
332 1.71 ozaki (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3]) \
333 1.71 ozaki + (fport) + (lport))
334 1.71 ozaki
335 1.71 ozaki // from in_pcb_hdr.h
336 1.71 ozaki struct vestigial_inpcb;
337 1.71 ozaki struct in6_addr;
338 1.71 ozaki
339 1.71 ozaki /* Hooks for vestigial pcb entries.
340 1.71 ozaki * If vestigial entries exist for a table (TCP only)
341 1.71 ozaki * the vestigial pointer is set.
342 1.71 ozaki */
343 1.71 ozaki typedef struct vestigial_hooks {
344 1.71 ozaki /* IPv4 hooks */
345 1.71 ozaki void *(*init_ports4)(struct in_addr, u_int, int);
346 1.71 ozaki int (*next_port4)(void *, struct vestigial_inpcb *);
347 1.71 ozaki int (*lookup4)(struct in_addr, uint16_t,
348 1.71 ozaki struct in_addr, uint16_t,
349 1.71 ozaki struct vestigial_inpcb *);
350 1.71 ozaki /* IPv6 hooks */
351 1.71 ozaki void *(*init_ports6)(const struct in6_addr*, u_int, int);
352 1.71 ozaki int (*next_port6)(void *, struct vestigial_inpcb *);
353 1.71 ozaki int (*lookup6)(const struct in6_addr *, uint16_t,
354 1.71 ozaki const struct in6_addr *, uint16_t,
355 1.71 ozaki struct vestigial_inpcb *);
356 1.71 ozaki } vestigial_hooks_t;
357 1.71 ozaki
358 1.68 riastrad #endif /* _KERNEL */
359 1.68 riastrad
360 1.68 riastrad #endif /* !_NETINET_IN_PCB_H_ */
361