Home | History | Annotate | Line # | Download | only in netinet
in_pcb.h revision 1.71
      1  1.71     ozaki /*	$NetBSD: in_pcb.h,v 1.71 2022/10/28 05:18:39 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.35    itojun #include <netinet/in_pcb_hdr.h>
     72  1.68  riastrad #include <netinet/ip.h>
     73  1.71     ozaki #include <netinet/ip6.h>
     74  1.71     ozaki 
     75  1.71     ozaki typedef int (*pcb_overudp_cb_t)(struct mbuf **, int, struct socket *,
     76  1.71     ozaki     struct sockaddr *, void *);
     77  1.68  riastrad 
     78  1.68  riastrad struct ip_moptions;
     79  1.68  riastrad struct mbuf;
     80  1.71     ozaki struct icmp6_filter;
     81  1.10   mycroft 
     82   1.1       cgd /*
     83   1.1       cgd  * Common structure pcb for internet protocol implementation.
     84   1.1       cgd  * Here are stored pointers to local and foreign host table
     85   1.1       cgd  * entries, local and foreign socket numbers, and pointers
     86   1.1       cgd  * up (to a socket structure) and down (to a protocol-specific)
     87   1.1       cgd  * control block.
     88   1.1       cgd  */
     89  1.71     ozaki 
     90   1.1       cgd struct inpcb {
     91  1.71     ozaki 	LIST_ENTRY(inpcb) inp_hash;
     92  1.71     ozaki 	LIST_ENTRY(inpcb) inp_lhash;
     93  1.71     ozaki 	TAILQ_ENTRY(inpcb) inp_queue;
     94  1.71     ozaki 	int	  inp_af;		/* address family - AF_INET or AF_INET6 */
     95  1.71     ozaki 	void *	  inp_ppcb;		/* pointer to per-protocol pcb */
     96  1.71     ozaki 	int	  inp_state;		/* bind/connect state */
     97  1.71     ozaki #define	INP_ATTACHED		0
     98  1.71     ozaki #define	INP_BOUND		1
     99  1.71     ozaki #define	INP_CONNECTED		2
    100  1.71     ozaki 	int       inp_portalgo;
    101  1.71     ozaki 	struct	  socket *inp_socket;	/* back pointer to socket */
    102  1.71     ozaki 	struct	  inpcbtable *inp_table;
    103  1.71     ozaki 	struct	  inpcbpolicy *inp_sp;	/* security policy */
    104  1.71     ozaki 	struct route	inp_route;	/* placeholder for routing entry */
    105  1.71     ozaki 	u_int16_t	inp_fport;	/* foreign port */
    106  1.71     ozaki 	u_int16_t	inp_lport;	/* local port */
    107  1.71     ozaki 	int	 	inp_flags;	/* generic IP/datagram flags */
    108  1.71     ozaki 	union {				/* header prototype. */
    109  1.71     ozaki 		struct ip inp_ip;
    110  1.71     ozaki 		struct ip6_hdr inp_ip6;
    111  1.71     ozaki 	};
    112  1.71     ozaki #define	inp_flowinfo	inp_ip6.ip6_flow
    113  1.71     ozaki 	struct mbuf	*inp_options;	/* IP options */
    114  1.71     ozaki 	bool		inp_bindportonsend;
    115  1.71     ozaki 
    116  1.71     ozaki 	/* We still need both for IPv6 due to v4-mapped addresses */
    117  1.71     ozaki 	struct ip_moptions *inp_moptions;	/* IPv4 multicast options */
    118  1.71     ozaki 	struct ip6_moptions *inp_moptions6;	/* IPv6 multicast options */
    119  1.71     ozaki 
    120  1.71     ozaki 	union {
    121  1.71     ozaki 		/* IPv4 only stuffs */
    122  1.71     ozaki 		struct {
    123  1.71     ozaki 			int	inp_errormtu;	/* MTU of last xmit status = EMSGSIZE */
    124  1.71     ozaki 			uint8_t	inp_ip_minttl;
    125  1.71     ozaki 			struct in_addr	inp_prefsrcip; /* preferred src IP when wild  */
    126  1.71     ozaki 		};
    127  1.71     ozaki 		/* IPv6 only stuffs */
    128  1.71     ozaki 		struct {
    129  1.71     ozaki 			int	inp_hops6;	/* default IPv6 hop limit */
    130  1.71     ozaki 			int	inp_cksum6;	/* IPV6_CHECKSUM setsockopt */
    131  1.71     ozaki 			struct icmp6_filter	*inp_icmp6filt;
    132  1.71     ozaki 			struct ip6_pktopts	*inp_outputopts6; /* IP6 options for outgoing packets */
    133  1.71     ozaki 		};
    134  1.71     ozaki 	};
    135  1.71     ozaki 
    136  1.71     ozaki 	pcb_overudp_cb_t	inp_overudp_cb;
    137  1.71     ozaki 	void		*inp_overudp_arg;
    138   1.1       cgd };
    139  1.35    itojun 
    140  1.18   mycroft #define	inp_faddr	inp_ip.ip_dst
    141  1.18   mycroft #define	inp_laddr	inp_ip.ip_src
    142  1.71     ozaki #define inp_faddr6	inp_ip6.ip6_dst
    143  1.71     ozaki #define inp_laddr6	inp_ip6.ip6_src
    144  1.71     ozaki 
    145  1.71     ozaki LIST_HEAD(inpcbhead, inpcb);
    146   1.1       cgd 
    147   1.1       cgd /* flags in inp_flags: */
    148  1.51  christos #define	INP_RECVOPTS		0x0001	/* receive incoming IP options */
    149  1.51  christos #define	INP_RECVRETOPTS		0x0002	/* receive IP options for reply */
    150  1.51  christos #define	INP_RECVDSTADDR		0x0004	/* receive IP dst address */
    151  1.51  christos #define	INP_HDRINCL		0x0008	/* user supplies entire IP header */
    152  1.51  christos #define	INP_HIGHPORT		0x0010	/* (unused; FreeBSD compat) */
    153  1.51  christos #define	INP_LOWPORT		0x0020	/* user wants "low" port binding */
    154  1.51  christos #define	INP_ANONPORT		0x0040	/* port chosen for user */
    155  1.51  christos #define	INP_RECVIF		0x0080	/* receive incoming interface */
    156  1.39      manu /* XXX should move to an UDP control block */
    157  1.51  christos #define INP_ESPINUDP		0x0100	/* ESP over UDP for NAT-T */
    158  1.51  christos #define INP_ESPINUDP_NON_IKE	0x0200	/* ESP over UDP for NAT-T */
    159  1.51  christos #define INP_NOHEADER		0x0400	/* Kernel removes IP header
    160  1.43    dyoung 					 * before feeding a packet
    161  1.43    dyoung 					 * to the raw socket user.
    162  1.43    dyoung 					 * The socket user will
    163  1.43    dyoung 					 * not supply an IP header.
    164  1.43    dyoung 					 * Cancels INP_HDRINCL.
    165  1.43    dyoung 					 */
    166  1.51  christos #define	INP_RECVTTL		0x0800	/* receive incoming IP TTL */
    167  1.65  christos #define	INP_RECVPKTINFO		0x1000	/* receive IP dst if/addr */
    168  1.69  christos #define	INP_BINDANY		0x2000	/* allow bind to any address */
    169  1.46   minskim #define	INP_CONTROLOPTS		(INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\
    170  1.65  christos 				INP_RECVIF|INP_RECVTTL|INP_RECVPKTINFO)
    171   1.1       cgd 
    172  1.71     ozaki /*
    173  1.71     ozaki  * Flags for IPv6 in inp_flags
    174  1.71     ozaki  * We define KAME's original flags in higher 16 bits as much as possible
    175  1.71     ozaki  * for compatibility with *bsd*s.
    176  1.71     ozaki  */
    177  1.71     ozaki #define IN6P_RECVOPTS		0x00001000 /* receive incoming IP6 options */
    178  1.71     ozaki #define IN6P_RECVRETOPTS	0x00002000 /* receive IP6 options for reply */
    179  1.71     ozaki #define IN6P_RECVDSTADDR	0x00004000 /* receive IP6 dst address */
    180  1.71     ozaki #define IN6P_IPV6_V6ONLY	0x00008000 /* restrict AF_INET6 socket for v6 */
    181  1.71     ozaki #define IN6P_PKTINFO		0x00010000 /* receive IP6 dst and I/F */
    182  1.71     ozaki #define IN6P_HOPLIMIT		0x00020000 /* receive hoplimit */
    183  1.71     ozaki #define IN6P_HOPOPTS		0x00040000 /* receive hop-by-hop options */
    184  1.71     ozaki #define IN6P_DSTOPTS		0x00080000 /* receive dst options after rthdr */
    185  1.71     ozaki #define IN6P_RTHDR		0x00100000 /* receive routing header */
    186  1.71     ozaki #define IN6P_RTHDRDSTOPTS	0x00200000 /* receive dstoptions before rthdr */
    187  1.71     ozaki #define IN6P_TCLASS		0x00400000 /* traffic class */
    188  1.71     ozaki #define IN6P_BINDANY		0x00800000 /* allow bind to any address */
    189  1.71     ozaki #define IN6P_HIGHPORT		0x01000000 /* user wants "high" port binding */
    190  1.71     ozaki #define IN6P_LOWPORT		0x02000000 /* user wants "low" port binding */
    191  1.71     ozaki #define IN6P_ANONPORT		0x04000000 /* port chosen for user */
    192  1.71     ozaki #define IN6P_FAITH		0x08000000 /* accept FAITH'ed connections */
    193  1.71     ozaki /* XXX should move to an UDP control block */
    194  1.71     ozaki #define IN6P_ESPINUDP		INP_ESPINUDP /* ESP over UDP for NAT-T */
    195  1.71     ozaki 
    196  1.71     ozaki #define IN6P_RFC2292		0x40000000 /* RFC2292 */
    197  1.71     ozaki #define IN6P_MTU		0x80000000 /* use minimum MTU */
    198  1.71     ozaki 
    199  1.71     ozaki #define IN6P_CONTROLOPTS	(IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\
    200  1.71     ozaki 				 IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\
    201  1.71     ozaki 				 IN6P_TCLASS|IN6P_RFC2292|\
    202  1.71     ozaki 				 IN6P_MTU)
    203  1.71     ozaki 
    204  1.16   mycroft #define	sotoinpcb(so)		((struct inpcb *)(so)->so_pcb)
    205  1.71     ozaki #define soaf(so) 		(so->so_proto->pr_domain->dom_family)
    206  1.63     ozaki #define	inp_lock(inp)		solock((inp)->inp_socket)
    207  1.63     ozaki #define	inp_unlock(inp)		sounlock((inp)->inp_socket)
    208  1.63     ozaki #define	inp_locked(inp)		solocked((inp)->inp_socket)
    209   1.1       cgd 
    210  1.71     ozaki TAILQ_HEAD(inpcbqueue, inpcb);
    211  1.71     ozaki 
    212  1.71     ozaki struct vestigial_hooks;
    213  1.71     ozaki 
    214  1.71     ozaki /* It's still referenced by kvm users */
    215  1.71     ozaki struct inpcbtable {
    216  1.71     ozaki 	struct	  inpcbqueue inpt_queue;
    217  1.71     ozaki 	struct	  inpcbhead *inpt_porthashtbl;
    218  1.71     ozaki 	struct	  inpcbhead *inpt_bindhashtbl;
    219  1.71     ozaki 	struct	  inpcbhead *inpt_connecthashtbl;
    220  1.71     ozaki 	u_long	  inpt_porthash;
    221  1.71     ozaki 	u_long	  inpt_bindhash;
    222  1.71     ozaki 	u_long	  inpt_connecthash;
    223  1.71     ozaki 	u_int16_t inpt_lastport;
    224  1.71     ozaki 	u_int16_t inpt_lastlow;
    225  1.71     ozaki 
    226  1.71     ozaki 	struct vestigial_hooks *vestige;
    227  1.71     ozaki };
    228  1.71     ozaki #define inpt_lasthi inpt_lastport
    229  1.71     ozaki 
    230   1.8       jtc #ifdef _KERNEL
    231  1.68  riastrad 
    232  1.68  riastrad #include <sys/kauth.h>
    233  1.68  riastrad #include <sys/queue.h>
    234  1.68  riastrad 
    235  1.68  riastrad struct lwp;
    236  1.68  riastrad struct rtentry;
    237  1.68  riastrad struct sockaddr_in;
    238  1.68  riastrad struct socket;
    239  1.68  riastrad struct vestigial_inpcb;
    240  1.68  riastrad 
    241  1.38    itojun void	in_losing(struct inpcb *);
    242  1.38    itojun int	in_pcballoc(struct socket *, void *);
    243  1.69  christos int	in_pcbbindableaddr(const struct inpcb *, struct sockaddr_in *,
    244  1.69  christos     kauth_cred_t);
    245  1.56       rtr int	in_pcbbind(void *, struct sockaddr_in *, struct lwp *);
    246  1.58       rtr int	in_pcbconnect(void *, struct sockaddr_in *, struct lwp *);
    247  1.38    itojun void	in_pcbdetach(void *);
    248  1.38    itojun void	in_pcbdisconnect(void *);
    249  1.38    itojun void	in_pcbinit(struct inpcbtable *, int, int);
    250  1.35    itojun struct inpcb *
    251  1.38    itojun 	in_pcblookup_port(struct inpcbtable *,
    252  1.48    dyoung 			  struct in_addr, u_int, int, struct vestigial_inpcb *);
    253  1.13   mycroft struct inpcb *
    254  1.38    itojun 	in_pcblookup_bind(struct inpcbtable *,
    255  1.37      matt 	    struct in_addr, u_int);
    256  1.17   mycroft struct inpcb *
    257  1.38    itojun 	in_pcblookup_connect(struct inpcbtable *,
    258  1.48    dyoung 			     struct in_addr, u_int, struct in_addr, u_int,
    259  1.48    dyoung 			     struct vestigial_inpcb *);
    260  1.38    itojun int	in_pcbnotify(struct inpcbtable *, struct in_addr, u_int,
    261  1.37      matt 	    struct in_addr, u_int, int, void (*)(struct inpcb *, int));
    262  1.38    itojun void	in_pcbnotifyall(struct inpcbtable *, struct in_addr, int,
    263  1.37      matt 	    void (*)(struct inpcb *, int));
    264  1.38    itojun void	in_pcbpurgeif0(struct inpcbtable *, struct ifnet *);
    265  1.38    itojun void	in_pcbpurgeif(struct inpcbtable *, struct ifnet *);
    266  1.55     seanb void	in_purgeifmcast(struct ip_moptions *, struct ifnet *);
    267  1.38    itojun void	in_pcbstate(struct inpcb *, int);
    268  1.38    itojun void	in_rtchange(struct inpcb *, int);
    269  1.57       rtr void	in_setpeeraddr(struct inpcb *, struct sockaddr_in *);
    270  1.57       rtr void	in_setsockaddr(struct inpcb *, struct sockaddr_in *);
    271  1.21   thorpej struct rtentry *
    272  1.38    itojun 	in_pcbrtentry(struct inpcb *);
    273  1.61     ozaki void	in_pcbrtentry_unref(struct rtentry *, struct inpcb *);
    274  1.67  riastrad 
    275  1.71     ozaki void	in6_pcbinit(struct inpcbtable *, int, int);
    276  1.71     ozaki int	in6_pcbbind(void *, struct sockaddr_in6 *, struct lwp *);
    277  1.71     ozaki int	in6_pcbconnect(void *, struct sockaddr_in6 *, struct lwp *);
    278  1.71     ozaki void	in6_pcbdetach(struct inpcb *);
    279  1.71     ozaki void	in6_pcbdisconnect(struct inpcb *);
    280  1.71     ozaki struct	inpcb *in6_pcblookup_port(struct inpcbtable *, struct in6_addr *,
    281  1.71     ozaki 				   u_int, int, struct vestigial_inpcb *);
    282  1.71     ozaki int	in6_pcbnotify(struct inpcbtable *, const struct sockaddr *,
    283  1.71     ozaki 	u_int, const struct sockaddr *, u_int, int, void *,
    284  1.71     ozaki 	void (*)(struct inpcb *, int));
    285  1.71     ozaki void	in6_pcbpurgeif0(struct inpcbtable *, struct ifnet *);
    286  1.71     ozaki void	in6_pcbpurgeif(struct inpcbtable *, struct ifnet *);
    287  1.71     ozaki void	in6_pcbstate(struct inpcb *, int);
    288  1.71     ozaki void	in6_rtchange(struct inpcb *, int);
    289  1.71     ozaki void	in6_setpeeraddr(struct inpcb *, struct sockaddr_in6 *);
    290  1.71     ozaki void	in6_setsockaddr(struct inpcb *, struct sockaddr_in6 *);
    291  1.71     ozaki 
    292  1.71     ozaki /* in in6_src.c */
    293  1.71     ozaki int	in6_selecthlim(struct inpcb *, struct ifnet *);
    294  1.71     ozaki int	in6_selecthlim_rt(struct inpcb *);
    295  1.71     ozaki int	in6_pcbsetport(struct sockaddr_in6 *, struct inpcb *, struct lwp *);
    296  1.71     ozaki 
    297  1.71     ozaki extern struct rtentry *
    298  1.71     ozaki 	in6_pcbrtentry(struct inpcb *);
    299  1.71     ozaki extern void
    300  1.71     ozaki 	in6_pcbrtentry_unref(struct rtentry *, struct inpcb *);
    301  1.71     ozaki extern struct inpcb *in6_pcblookup_connect(struct inpcbtable *,
    302  1.71     ozaki 					    const struct in6_addr *, u_int, const struct in6_addr *, u_int, int,
    303  1.71     ozaki 					    struct vestigial_inpcb *);
    304  1.71     ozaki extern struct inpcb *in6_pcblookup_bind(struct inpcbtable *,
    305  1.71     ozaki 	const struct in6_addr *, u_int, int);
    306  1.71     ozaki 
    307  1.67  riastrad static inline void
    308  1.67  riastrad in_pcb_register_overudp_cb(struct inpcb *inp, pcb_overudp_cb_t cb, void *arg)
    309  1.67  riastrad {
    310  1.67  riastrad 
    311  1.67  riastrad 	inp->inp_overudp_cb = cb;
    312  1.67  riastrad 	inp->inp_overudp_arg = arg;
    313  1.67  riastrad }
    314  1.24     perry 
    315  1.71     ozaki /* compute hash value for foreign and local in6_addr and port */
    316  1.71     ozaki #define IN6_HASH(faddr, fport, laddr, lport) 			\
    317  1.71     ozaki 	(((faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^	\
    318  1.71     ozaki 	  (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3] ^	\
    319  1.71     ozaki 	  (laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^	\
    320  1.71     ozaki 	  (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3])	\
    321  1.71     ozaki 	 + (fport) + (lport))
    322  1.71     ozaki 
    323  1.71     ozaki // from in_pcb_hdr.h
    324  1.71     ozaki struct vestigial_inpcb;
    325  1.71     ozaki struct in6_addr;
    326  1.71     ozaki 
    327  1.71     ozaki /* Hooks for vestigial pcb entries.
    328  1.71     ozaki  * If vestigial entries exist for a table (TCP only)
    329  1.71     ozaki  * the vestigial pointer is set.
    330  1.71     ozaki  */
    331  1.71     ozaki typedef struct vestigial_hooks {
    332  1.71     ozaki 	/* IPv4 hooks */
    333  1.71     ozaki 	void	*(*init_ports4)(struct in_addr, u_int, int);
    334  1.71     ozaki 	int	(*next_port4)(void *, struct vestigial_inpcb *);
    335  1.71     ozaki 	int	(*lookup4)(struct in_addr, uint16_t,
    336  1.71     ozaki 			   struct in_addr, uint16_t,
    337  1.71     ozaki 			   struct vestigial_inpcb *);
    338  1.71     ozaki 	/* IPv6 hooks */
    339  1.71     ozaki 	void	*(*init_ports6)(const struct in6_addr*, u_int, int);
    340  1.71     ozaki 	int	(*next_port6)(void *, struct vestigial_inpcb *);
    341  1.71     ozaki 	int	(*lookup6)(const struct in6_addr *, uint16_t,
    342  1.71     ozaki 			   const struct in6_addr *, uint16_t,
    343  1.71     ozaki 			   struct vestigial_inpcb *);
    344  1.71     ozaki } vestigial_hooks_t;
    345  1.71     ozaki 
    346  1.68  riastrad #endif	/* _KERNEL */
    347  1.68  riastrad 
    348  1.68  riastrad #endif	/* !_NETINET_IN_PCB_H_ */
    349