xref: /freebsd/sys/netinet/in_var.h (revision 6e6b3f7cbc89cf29eafdfa6d1613c6b1a37c364b)
1c398230bSWarner Losh /*-
2df8bae1dSRodney W. Grimes  * Copyright (c) 1985, 1986, 1993
3df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
4df8bae1dSRodney W. Grimes  *
5df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
6df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
7df8bae1dSRodney W. Grimes  * are met:
8df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
9df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
10df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
11df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
12df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
13df8bae1dSRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
14df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
15df8bae1dSRodney W. Grimes  *    without specific prior written permission.
16df8bae1dSRodney W. Grimes  *
17df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
28df8bae1dSRodney W. Grimes  *
292180b925SGarrett Wollman  *	@(#)in_var.h	8.2 (Berkeley) 1/9/95
30c3aac50fSPeter Wemm  * $FreeBSD$
31df8bae1dSRodney W. Grimes  */
32df8bae1dSRodney W. Grimes 
33707f139eSPaul Richards #ifndef _NETINET_IN_VAR_H_
34707f139eSPaul Richards #define _NETINET_IN_VAR_H_
35707f139eSPaul Richards 
36ffa5b11aSGarrett Wollman #include <sys/queue.h>
37ca925d9cSJonathan Lemon #include <sys/fnv_hash.h>
38ffa5b11aSGarrett Wollman 
39df8bae1dSRodney W. Grimes /*
40df8bae1dSRodney W. Grimes  * Interface address, Internet version.  One of these structures
41477180fbSGarrett Wollman  * is allocated for each Internet address on an interface.
42df8bae1dSRodney W. Grimes  * The ifaddr structure contains the protocol-independent part
43df8bae1dSRodney W. Grimes  * of the structure and is assumed to be first.
44df8bae1dSRodney W. Grimes  */
45df8bae1dSRodney W. Grimes struct in_ifaddr {
46df8bae1dSRodney W. Grimes 	struct	ifaddr ia_ifa;		/* protocol-independent info */
47df8bae1dSRodney W. Grimes #define	ia_ifp		ia_ifa.ifa_ifp
48df8bae1dSRodney W. Grimes #define ia_flags	ia_ifa.ifa_flags
49df8bae1dSRodney W. Grimes 					/* ia_{,sub}net{,mask} in host order */
50df8bae1dSRodney W. Grimes 	u_long	ia_net;			/* network number of interface */
51df8bae1dSRodney W. Grimes 	u_long	ia_netmask;		/* mask of net part */
52df8bae1dSRodney W. Grimes 	u_long	ia_subnet;		/* subnet number, including net */
53df8bae1dSRodney W. Grimes 	u_long	ia_subnetmask;		/* mask of subnet part */
54df8bae1dSRodney W. Grimes 	struct	in_addr ia_netbroadcast; /* to recognize net broadcasts */
55ca925d9cSJonathan Lemon 	LIST_ENTRY(in_ifaddr) ia_hash;	/* entry in bucket of inet addresses */
56ca925d9cSJonathan Lemon 	TAILQ_ENTRY(in_ifaddr) ia_link;	/* list of internet addresses */
57df8bae1dSRodney W. Grimes 	struct	sockaddr_in ia_addr;	/* reserve space for interface name */
58df8bae1dSRodney W. Grimes 	struct	sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */
59df8bae1dSRodney W. Grimes #define	ia_broadaddr	ia_dstaddr
60df8bae1dSRodney W. Grimes 	struct	sockaddr_in ia_sockmask; /* reserve space for general netmask */
61df8bae1dSRodney W. Grimes };
62df8bae1dSRodney W. Grimes 
63df8bae1dSRodney W. Grimes struct	in_aliasreq {
64df8bae1dSRodney W. Grimes 	char	ifra_name[IFNAMSIZ];		/* if name, e.g. "en0" */
65df8bae1dSRodney W. Grimes 	struct	sockaddr_in ifra_addr;
66df8bae1dSRodney W. Grimes 	struct	sockaddr_in ifra_broadaddr;
67df8bae1dSRodney W. Grimes #define ifra_dstaddr ifra_broadaddr
68df8bae1dSRodney W. Grimes 	struct	sockaddr_in ifra_mask;
69df8bae1dSRodney W. Grimes };
70df8bae1dSRodney W. Grimes /*
71df8bae1dSRodney W. Grimes  * Given a pointer to an in_ifaddr (ifaddr),
72df8bae1dSRodney W. Grimes  * return a pointer to the addr as a sockaddr_in.
73df8bae1dSRodney W. Grimes  */
74df8bae1dSRodney W. Grimes #define IA_SIN(ia)    (&(((struct in_ifaddr *)(ia))->ia_addr))
751bc8a809SSteven Wallace #define IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr))
76df8bae1dSRodney W. Grimes 
77df8bae1dSRodney W. Grimes #define IN_LNAOF(in, ifa) \
78df8bae1dSRodney W. Grimes 	((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask))
79df8bae1dSRodney W. Grimes 
80df8bae1dSRodney W. Grimes 
81664a31e4SPeter Wemm #ifdef	_KERNEL
82b5e8ce9fSBruce Evans extern	u_char	inetctlerrmap[];
83df8bae1dSRodney W. Grimes 
84df8bae1dSRodney W. Grimes /*
85ca925d9cSJonathan Lemon  * Hash table for IP addresses.
86ca925d9cSJonathan Lemon  */
871b193af6SBjoern A. Zeeb TAILQ_HEAD(in_ifaddrhead, in_ifaddr);
881b193af6SBjoern A. Zeeb LIST_HEAD(in_ifaddrhashhead, in_ifaddr);
891b193af6SBjoern A. Zeeb #ifdef VIMAGE_GLOBALS
901b193af6SBjoern A. Zeeb extern	struct in_ifaddrhashhead *in_ifaddrhashtbl;
911b193af6SBjoern A. Zeeb extern	struct in_ifaddrhead in_ifaddrhead;
92ca925d9cSJonathan Lemon extern	u_long in_ifaddrhmask;			/* mask for hash table */
931b193af6SBjoern A. Zeeb #endif
94ca925d9cSJonathan Lemon 
95ca925d9cSJonathan Lemon #define INADDR_NHASH_LOG2       9
96ca925d9cSJonathan Lemon #define INADDR_NHASH		(1 << INADDR_NHASH_LOG2)
97ca925d9cSJonathan Lemon #define INADDR_HASHVAL(x)	fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT)
98ca925d9cSJonathan Lemon #define INADDR_HASH(x) \
99603724d3SBjoern A. Zeeb 	(&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask])
100ca925d9cSJonathan Lemon 
10107ea6709SBruce M Simpson /*
102e2fd806bSBruce M Simpson  * Macro for finding the internet address structure (in_ifaddr)
10307ea6709SBruce M Simpson  * corresponding to one of our IP addresses (in_addr).
10407ea6709SBruce M Simpson  */
10507ea6709SBruce M Simpson #define INADDR_TO_IFADDR(addr, ia) \
10607ea6709SBruce M Simpson 	/* struct in_addr addr; */ \
10707ea6709SBruce M Simpson 	/* struct in_ifaddr *ia; */ \
10807ea6709SBruce M Simpson do { \
10907ea6709SBruce M Simpson \
11007ea6709SBruce M Simpson 	LIST_FOREACH(ia, INADDR_HASH((addr).s_addr), ia_hash) \
11107ea6709SBruce M Simpson 		if (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \
11207ea6709SBruce M Simpson 			break; \
11307ea6709SBruce M Simpson } while (0)
114ca925d9cSJonathan Lemon 
115ca925d9cSJonathan Lemon /*
116df8bae1dSRodney W. Grimes  * Macro for finding the interface (ifnet structure) corresponding to one
117df8bae1dSRodney W. Grimes  * of our IP addresses.
118df8bae1dSRodney W. Grimes  */
119df8bae1dSRodney W. Grimes #define INADDR_TO_IFP(addr, ifp) \
120df8bae1dSRodney W. Grimes 	/* struct in_addr addr; */ \
121df8bae1dSRodney W. Grimes 	/* struct ifnet *ifp; */ \
122df8bae1dSRodney W. Grimes { \
1239f81cc84SRuslan Ermilov 	struct in_ifaddr *ia; \
124df8bae1dSRodney W. Grimes \
12507ea6709SBruce M Simpson 	INADDR_TO_IFADDR(addr, ia); \
126df8bae1dSRodney W. Grimes 	(ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \
127df8bae1dSRodney W. Grimes }
128df8bae1dSRodney W. Grimes 
129df8bae1dSRodney W. Grimes /*
130df8bae1dSRodney W. Grimes  * Macro for finding the internet address structure (in_ifaddr) corresponding
131df8bae1dSRodney W. Grimes  * to a given interface (ifnet structure).
132df8bae1dSRodney W. Grimes  */
133df8bae1dSRodney W. Grimes #define IFP_TO_IA(ifp, ia) \
134df8bae1dSRodney W. Grimes 	/* struct ifnet *ifp; */ \
135df8bae1dSRodney W. Grimes 	/* struct in_ifaddr *ia; */ \
136df8bae1dSRodney W. Grimes { \
137603724d3SBjoern A. Zeeb 	for ((ia) = TAILQ_FIRST(&V_in_ifaddrhead); \
138df8bae1dSRodney W. Grimes 	    (ia) != NULL && (ia)->ia_ifp != (ifp); \
139ef9e85abSPoul-Henning Kamp 	    (ia) = TAILQ_NEXT((ia), ia_link)) \
140df8bae1dSRodney W. Grimes 		continue; \
141df8bae1dSRodney W. Grimes }
142df8bae1dSRodney W. Grimes #endif
143df8bae1dSRodney W. Grimes 
144df8bae1dSRodney W. Grimes /*
14544e33a07SMarko Zec  * IP datagram reassembly.
14644e33a07SMarko Zec  */
14744e33a07SMarko Zec #define	IPREASS_NHASH_LOG2	6
14844e33a07SMarko Zec #define	IPREASS_NHASH		(1 << IPREASS_NHASH_LOG2)
14944e33a07SMarko Zec #define	IPREASS_HMASK		(IPREASS_NHASH - 1)
15044e33a07SMarko Zec #define	IPREASS_HASH(x,y) \
15144e33a07SMarko Zec 	(((((x) & 0xF) | ((((x) >> 8) & 0xF) << 4)) ^ (y)) & IPREASS_HMASK)
15244e33a07SMarko Zec 
15344e33a07SMarko Zec /*
154f0068c4aSGarrett Wollman  * This information should be part of the ifnet structure but we don't wish
155f0068c4aSGarrett Wollman  * to change that - as it might break a number of things
156f0068c4aSGarrett Wollman  */
157f0068c4aSGarrett Wollman 
158f0068c4aSGarrett Wollman struct router_info {
15949fa849bSBill Fenner 	struct ifnet *rti_ifp;
16049fa849bSBill Fenner 	int    rti_type; /* type of router which is querier on this interface */
16149fa849bSBill Fenner 	int    rti_time; /* # of slow timeouts since last old query */
1626c4b2ad3SRobert Watson 	SLIST_ENTRY(router_info) rti_list;
16371498f30SBruce M Simpson #ifdef notyet
16471498f30SBruce M Simpson 	int	rti_timev1;	/* IGMPv1 querier present */
16571498f30SBruce M Simpson 	int	rti_timev2;	/* IGMPv2 querier present */
16671498f30SBruce M Simpson 	int	rti_timer;	/* report to general query */
16771498f30SBruce M Simpson 	int	rti_qrv;	/* querier robustness */
16871498f30SBruce M Simpson #endif
169f0068c4aSGarrett Wollman };
170f0068c4aSGarrett Wollman 
171f0068c4aSGarrett Wollman /*
172df8bae1dSRodney W. Grimes  * Internet multicast address structure.  There is one of these for each IP
173df8bae1dSRodney W. Grimes  * multicast group to which this host belongs on a given network interface.
174477180fbSGarrett Wollman  * For every entry on the interface's if_multiaddrs list which represents
175477180fbSGarrett Wollman  * an IP multicast group, there is one of these structures.  They are also
176477180fbSGarrett Wollman  * kept on a system-wide list to make it easier to keep our legacy IGMP code
177477180fbSGarrett Wollman  * compatible with the rest of the world (see IN_FIRST_MULTI et al, below).
178df8bae1dSRodney W. Grimes  */
179df8bae1dSRodney W. Grimes struct in_multi {
180e3975643SJake Burkholder 	LIST_ENTRY(in_multi) inm_link;	/* queue macro glue */
181477180fbSGarrett Wollman 	struct	in_addr inm_addr;	/* IP multicast address, convenience */
182df8bae1dSRodney W. Grimes 	struct	ifnet *inm_ifp;		/* back pointer to ifnet */
183477180fbSGarrett Wollman 	struct	ifmultiaddr *inm_ifma;	/* back pointer to ifmultiaddr */
184df8bae1dSRodney W. Grimes 	u_int	inm_timer;		/* IGMP membership report timer */
185f0068c4aSGarrett Wollman 	u_int	inm_state;		/*  state of the membership */
186f0068c4aSGarrett Wollman 	struct	router_info *inm_rti;	/* router info*/
187ec002feeSBruce M Simpson 	u_int	inm_refcount;		/* reference count */
18871498f30SBruce M Simpson #ifdef notyet		/* IGMPv3 source-specific multicast fields */
18971498f30SBruce M Simpson 	TAILQ_HEAD(, in_msfentry) inm_msf;	/* all active source filters */
19071498f30SBruce M Simpson 	TAILQ_HEAD(, in_msfentry) inm_msf_record;	/* recorded sources */
19171498f30SBruce M Simpson 	TAILQ_HEAD(, in_msfentry) inm_msf_exclude;	/* exclude sources */
19271498f30SBruce M Simpson 	TAILQ_HEAD(, in_msfentry) inm_msf_include;	/* include sources */
19371498f30SBruce M Simpson 	/* XXX: should this lot go to the router_info structure? */
19471498f30SBruce M Simpson 	/* XXX: can/should these be callouts? */
19571498f30SBruce M Simpson 	/* IGMP protocol timers */
19671498f30SBruce M Simpson 	int32_t		inm_ti_curstate;	/* current state timer */
19771498f30SBruce M Simpson 	int32_t		inm_ti_statechg;	/* state change timer */
19871498f30SBruce M Simpson 	/* IGMP report timers */
19971498f30SBruce M Simpson 	uint16_t	inm_rpt_statechg;	/* state change report timer */
20071498f30SBruce M Simpson 	uint16_t	inm_rpt_toxx;		/* fmode change report timer */
20171498f30SBruce M Simpson 	/* IGMP protocol state */
20271498f30SBruce M Simpson 	uint16_t	inm_fmode;		/* filter mode */
20371498f30SBruce M Simpson 	uint32_t	inm_recsrc_count;	/* # of recorded sources */
20471498f30SBruce M Simpson 	uint16_t	inm_exclude_sock_count;	/* # of exclude-mode sockets */
20571498f30SBruce M Simpson 	uint16_t	inm_gass_count;		/* # of g-a-s queries */
20671498f30SBruce M Simpson #endif
207df8bae1dSRodney W. Grimes };
208df8bae1dSRodney W. Grimes 
20971498f30SBruce M Simpson #ifdef notyet
21071498f30SBruce M Simpson /*
21171498f30SBruce M Simpson  * Internet multicast source filter list. This list is used to store
21271498f30SBruce M Simpson  * IP multicast source addresses for each membership on an interface.
21371498f30SBruce M Simpson  * TODO: Allocate these structures using UMA.
21471498f30SBruce M Simpson  * TODO: Find an easier way of linking the struct into two lists at once.
21571498f30SBruce M Simpson  */
21671498f30SBruce M Simpson struct in_msfentry {
21771498f30SBruce M Simpson 	TAILQ_ENTRY(in_msfentry) isf_link;	/* next filter in all-list */
21871498f30SBruce M Simpson 	TAILQ_ENTRY(in_msfentry) isf_next;	/* next filter in queue */
21971498f30SBruce M Simpson 	struct in_addr	isf_addr;	/* the address of this source */
22071498f30SBruce M Simpson 	uint16_t	isf_refcount;	/* reference count */
22171498f30SBruce M Simpson 	uint16_t	isf_reporttag;	/* what to report to the IGMP router */
22271498f30SBruce M Simpson 	uint16_t	isf_rexmit;	/* retransmission state/count */
22371498f30SBruce M Simpson };
22471498f30SBruce M Simpson #endif
22571498f30SBruce M Simpson 
226664a31e4SPeter Wemm #ifdef _KERNEL
227ce02431fSDoug Rabson 
228ce02431fSDoug Rabson #ifdef SYSCTL_DECL
229969bb53eSAndre Oppermann SYSCTL_DECL(_net_inet);
230ce02431fSDoug Rabson SYSCTL_DECL(_net_inet_ip);
231ce02431fSDoug Rabson SYSCTL_DECL(_net_inet_raw);
232ce02431fSDoug Rabson #endif
233ce02431fSDoug Rabson 
2341b193af6SBjoern A. Zeeb LIST_HEAD(in_multihead, in_multi);
2351b193af6SBjoern A. Zeeb #ifdef VIMAGE_GLOBALS
2361b193af6SBjoern A. Zeeb extern struct in_multihead in_multihead;
2371b193af6SBjoern A. Zeeb #endif
238477180fbSGarrett Wollman 
239df8bae1dSRodney W. Grimes /*
240dd5a318bSRobert Watson  * Lock macros for IPv4 layer multicast address lists.  IPv4 lock goes
241dd5a318bSRobert Watson  * before link layer multicast locks in the lock order.  In most cases,
242dd5a318bSRobert Watson  * consumers of IN_*_MULTI() macros should acquire the locks before
243dd5a318bSRobert Watson  * calling them; users of the in_{add,del}multi() functions should not.
244dd5a318bSRobert Watson  */
245dd5a318bSRobert Watson extern struct mtx in_multi_mtx;
246dd5a318bSRobert Watson #define	IN_MULTI_LOCK()		mtx_lock(&in_multi_mtx)
247dd5a318bSRobert Watson #define	IN_MULTI_UNLOCK()	mtx_unlock(&in_multi_mtx)
248dd5a318bSRobert Watson #define	IN_MULTI_LOCK_ASSERT()	mtx_assert(&in_multi_mtx, MA_OWNED)
249dd5a318bSRobert Watson 
250dd5a318bSRobert Watson /*
251df8bae1dSRodney W. Grimes  * Structure used by macros below to remember position when stepping through
252df8bae1dSRodney W. Grimes  * all of the in_multi records.
253df8bae1dSRodney W. Grimes  */
254df8bae1dSRodney W. Grimes struct in_multistep {
255df8bae1dSRodney W. Grimes 	struct in_multi *i_inm;
256df8bae1dSRodney W. Grimes };
257df8bae1dSRodney W. Grimes 
258df8bae1dSRodney W. Grimes /*
259df8bae1dSRodney W. Grimes  * Macro for looking up the in_multi record for a given IP multicast address
260477180fbSGarrett Wollman  * on a given interface.  If no matching record is found, "inm" is set null.
261df8bae1dSRodney W. Grimes  */
262df8bae1dSRodney W. Grimes #define IN_LOOKUP_MULTI(addr, ifp, inm) \
263df8bae1dSRodney W. Grimes 	/* struct in_addr addr; */ \
264df8bae1dSRodney W. Grimes 	/* struct ifnet *ifp; */ \
265df8bae1dSRodney W. Grimes 	/* struct in_multi *inm; */ \
26659562606SGarrett Wollman do { \
2679f81cc84SRuslan Ermilov 	struct ifmultiaddr *ifma; \
268df8bae1dSRodney W. Grimes \
269dd5a318bSRobert Watson 	IN_MULTI_LOCK_ASSERT(); \
270bccb4101SRobert Watson 	IF_ADDR_LOCK(ifp); \
2716817526dSPoul-Henning Kamp 	TAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { \
272477180fbSGarrett Wollman 		if (ifma->ifma_addr->sa_family == AF_INET \
27393e808cdSGarrett Wollman 		    && ((struct sockaddr_in *)ifma->ifma_addr)->sin_addr.s_addr == \
274477180fbSGarrett Wollman 		    (addr).s_addr) \
275477180fbSGarrett Wollman 			break; \
276477180fbSGarrett Wollman 	} \
277477180fbSGarrett Wollman 	(inm) = ifma ? ifma->ifma_protospec : 0; \
278bccb4101SRobert Watson 	IF_ADDR_UNLOCK(ifp); \
27959562606SGarrett Wollman } while(0)
280df8bae1dSRodney W. Grimes 
281df8bae1dSRodney W. Grimes /*
282df8bae1dSRodney W. Grimes  * Macro to step through all of the in_multi records, one at a time.
283df8bae1dSRodney W. Grimes  * The current position is remembered in "step", which the caller must
284df8bae1dSRodney W. Grimes  * provide.  IN_FIRST_MULTI(), below, must be called to initialize "step"
285df8bae1dSRodney W. Grimes  * and get the first record.  Both macros return a NULL "inm" when there
286df8bae1dSRodney W. Grimes  * are no remaining records.
287df8bae1dSRodney W. Grimes  */
288df8bae1dSRodney W. Grimes #define IN_NEXT_MULTI(step, inm) \
289df8bae1dSRodney W. Grimes 	/* struct in_multistep  step; */ \
290df8bae1dSRodney W. Grimes 	/* struct in_multi *inm; */ \
29159562606SGarrett Wollman do { \
292dd5a318bSRobert Watson 	IN_MULTI_LOCK_ASSERT(); \
293df8bae1dSRodney W. Grimes 	if (((inm) = (step).i_inm) != NULL) \
294ef9e85abSPoul-Henning Kamp 		(step).i_inm = LIST_NEXT((step).i_inm, inm_link); \
29559562606SGarrett Wollman } while(0)
296df8bae1dSRodney W. Grimes 
297df8bae1dSRodney W. Grimes #define IN_FIRST_MULTI(step, inm) \
298df8bae1dSRodney W. Grimes 	/* struct in_multistep step; */ \
299df8bae1dSRodney W. Grimes 	/* struct in_multi *inm; */ \
30059562606SGarrett Wollman do { \
301dd5a318bSRobert Watson 	IN_MULTI_LOCK_ASSERT(); \
302603724d3SBjoern A. Zeeb 	(step).i_inm = LIST_FIRST(&V_in_multihead); \
303df8bae1dSRodney W. Grimes 	IN_NEXT_MULTI((step), (inm)); \
30459562606SGarrett Wollman } while(0)
305df8bae1dSRodney W. Grimes 
3068b07e49aSJulian Elischer struct	rtentry;
3071f91d8c5SDavid Greenman struct	route;
30871498f30SBruce M Simpson struct	ip_moptions;
30971498f30SBruce M Simpson 
31071498f30SBruce M Simpson size_t	imo_match_group(struct ip_moptions *, struct ifnet *,
31171498f30SBruce M Simpson 	    struct sockaddr *);
31271498f30SBruce M Simpson struct	in_msource *imo_match_source(struct ip_moptions *, size_t,
31371498f30SBruce M Simpson 	    struct sockaddr *);
3144d77a549SAlfred Perlstein struct	in_multi *in_addmulti(struct in_addr *, struct ifnet *);
3154d77a549SAlfred Perlstein void	in_delmulti(struct in_multi *);
316d9668414SBruce M Simpson void	in_delmulti_locked(struct in_multi *);
3174d77a549SAlfred Perlstein int	in_control(struct socket *, u_long, caddr_t, struct ifnet *,
3184d77a549SAlfred Perlstein 	    struct thread *);
3194d77a549SAlfred Perlstein void	in_rtqdrain(void);
3204d77a549SAlfred Perlstein void	ip_input(struct mbuf *);
3214d77a549SAlfred Perlstein int	in_ifadown(struct ifaddr *ifa, int);
3224d77a549SAlfred Perlstein void	in_ifscrub(struct ifnet *, struct in_ifaddr *);
3235d691e6dSAndre Oppermann struct	mbuf	*ip_fastforward(struct mbuf *);
3246e6b3f7cSQing Li void	*in_domifattach(struct ifnet *);
3256e6b3f7cSQing Li void	in_domifdetach(struct ifnet *, void *);
3266e6b3f7cSQing Li 
327707f139eSPaul Richards 
3288b07e49aSJulian Elischer /* XXX */
3298b07e49aSJulian Elischer void	 in_rtalloc_ign(struct route *ro, u_long ignflags, u_int fibnum);
3308b07e49aSJulian Elischer void	 in_rtalloc(struct route *ro, u_int fibnum);
3318b07e49aSJulian Elischer struct rtentry *in_rtalloc1(struct sockaddr *, int, u_long, u_int);
3328b07e49aSJulian Elischer void	 in_rtredirect(struct sockaddr *, struct sockaddr *,
3338b07e49aSJulian Elischer 	    struct sockaddr *, int, struct sockaddr *, u_int);
3348b07e49aSJulian Elischer int	 in_rtrequest(int, struct sockaddr *,
3358b07e49aSJulian Elischer 	    struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int);
3368b07e49aSJulian Elischer 
3378b07e49aSJulian Elischer #if 0
3388b07e49aSJulian Elischer int	 in_rt_getifa(struct rt_addrinfo *, u_int fibnum);
3398b07e49aSJulian Elischer int	 in_rtioctl(u_long, caddr_t, u_int);
3408b07e49aSJulian Elischer int	 in_rtrequest1(int, struct rt_addrinfo *, struct rtentry **, u_int);
3418b07e49aSJulian Elischer #endif
342664a31e4SPeter Wemm #endif /* _KERNEL */
3432180b925SGarrett Wollman 
34476429de4SYoshinobu Inoue /* INET6 stuff */
34576429de4SYoshinobu Inoue #include <netinet6/in6_var.h>
34676429de4SYoshinobu Inoue 
3472180b925SGarrett Wollman #endif /* _NETINET_IN_VAR_H_ */
348