in_var.h revision 189592
1139823Simp/*-
21541Srgrimes * Copyright (c) 1985, 1986, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes *
51541Srgrimes * Redistribution and use in source and binary forms, with or without
61541Srgrimes * modification, are permitted provided that the following conditions
71541Srgrimes * are met:
81541Srgrimes * 1. Redistributions of source code must retain the above copyright
91541Srgrimes *    notice, this list of conditions and the following disclaimer.
101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111541Srgrimes *    notice, this list of conditions and the following disclaimer in the
121541Srgrimes *    documentation and/or other materials provided with the distribution.
131541Srgrimes * 4. Neither the name of the University nor the names of its contributors
141541Srgrimes *    may be used to endorse or promote products derived from this software
151541Srgrimes *    without specific prior written permission.
161541Srgrimes *
171541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271541Srgrimes * SUCH DAMAGE.
281541Srgrimes *
2910939Swollman *	@(#)in_var.h	8.2 (Berkeley) 1/9/95
3050477Speter * $FreeBSD: head/sys/netinet/in_var.h 189592 2009-03-09 17:53:05Z bms $
311541Srgrimes */
321541Srgrimes
332169Spaul#ifndef _NETINET_IN_VAR_H_
342169Spaul#define _NETINET_IN_VAR_H_
352169Spaul
367280Swollman#include <sys/queue.h>
3784102Sjlemon#include <sys/fnv_hash.h>
38189592Sbms#include <sys/tree.h>
397280Swollman
40189592Sbmsstruct igmp_ifinfo;
41189592Sbmsstruct in_multi;
42189592Sbmsstruct lltable;
43189592Sbms
441541Srgrimes/*
45189592Sbms * IPv4 per-interface state.
46189592Sbms */
47189592Sbmsstruct in_ifinfo {
48189592Sbms	struct lltable		*ii_llt;	/* ARP state */
49189592Sbms	struct igmp_ifinfo	*ii_igmp;	/* IGMP state */
50189592Sbms	struct in_multi		*ii_allhosts;	/* 224.0.0.1 membership */
51189592Sbms};
52189592Sbms
53189592Sbms/*
541541Srgrimes * Interface address, Internet version.  One of these structures
5521666Swollman * is allocated for each Internet address on an interface.
561541Srgrimes * The ifaddr structure contains the protocol-independent part
571541Srgrimes * of the structure and is assumed to be first.
581541Srgrimes */
591541Srgrimesstruct in_ifaddr {
601541Srgrimes	struct	ifaddr ia_ifa;		/* protocol-independent info */
611541Srgrimes#define	ia_ifp		ia_ifa.ifa_ifp
621541Srgrimes#define ia_flags	ia_ifa.ifa_flags
631541Srgrimes					/* ia_{,sub}net{,mask} in host order */
641541Srgrimes	u_long	ia_net;			/* network number of interface */
651541Srgrimes	u_long	ia_netmask;		/* mask of net part */
661541Srgrimes	u_long	ia_subnet;		/* subnet number, including net */
671541Srgrimes	u_long	ia_subnetmask;		/* mask of subnet part */
681541Srgrimes	struct	in_addr ia_netbroadcast; /* to recognize net broadcasts */
6984102Sjlemon	LIST_ENTRY(in_ifaddr) ia_hash;	/* entry in bucket of inet addresses */
7084102Sjlemon	TAILQ_ENTRY(in_ifaddr) ia_link;	/* list of internet addresses */
711541Srgrimes	struct	sockaddr_in ia_addr;	/* reserve space for interface name */
721541Srgrimes	struct	sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */
731541Srgrimes#define	ia_broadaddr	ia_dstaddr
741541Srgrimes	struct	sockaddr_in ia_sockmask; /* reserve space for general netmask */
751541Srgrimes};
761541Srgrimes
771541Srgrimesstruct	in_aliasreq {
781541Srgrimes	char	ifra_name[IFNAMSIZ];		/* if name, e.g. "en0" */
791541Srgrimes	struct	sockaddr_in ifra_addr;
801541Srgrimes	struct	sockaddr_in ifra_broadaddr;
811541Srgrimes#define ifra_dstaddr ifra_broadaddr
821541Srgrimes	struct	sockaddr_in ifra_mask;
831541Srgrimes};
841541Srgrimes/*
851541Srgrimes * Given a pointer to an in_ifaddr (ifaddr),
861541Srgrimes * return a pointer to the addr as a sockaddr_in.
871541Srgrimes */
883865Sswallace#define IA_SIN(ia)    (&(((struct in_ifaddr *)(ia))->ia_addr))
893865Sswallace#define IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr))
901541Srgrimes
911541Srgrimes#define IN_LNAOF(in, ifa) \
921541Srgrimes	((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask))
931541Srgrimes
948876Srgrimes
9555205Speter#ifdef	_KERNEL
967090Sbdeextern	u_char	inetctlerrmap[];
971541Srgrimes
98133874Srwatson/*
9984102Sjlemon * Hash table for IP addresses.
10084102Sjlemon */
101186048SbzTAILQ_HEAD(in_ifaddrhead, in_ifaddr);
102186048SbzLIST_HEAD(in_ifaddrhashhead, in_ifaddr);
103186048Sbz#ifdef VIMAGE_GLOBALS
104186048Sbzextern	struct in_ifaddrhashhead *in_ifaddrhashtbl;
105186048Sbzextern	struct in_ifaddrhead in_ifaddrhead;
10684102Sjlemonextern	u_long in_ifaddrhmask;			/* mask for hash table */
107186048Sbz#endif
10884102Sjlemon
10984102Sjlemon#define INADDR_NHASH_LOG2       9
11084102Sjlemon#define INADDR_NHASH		(1 << INADDR_NHASH_LOG2)
11184102Sjlemon#define INADDR_HASHVAL(x)	fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT)
11284102Sjlemon#define INADDR_HASH(x) \
113181803Sbz	(&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask])
11484102Sjlemon
115162615Sbms/*
116162625Sbms * Macro for finding the internet address structure (in_ifaddr)
117162615Sbms * corresponding to one of our IP addresses (in_addr).
118162615Sbms */
119162615Sbms#define INADDR_TO_IFADDR(addr, ia) \
120162615Sbms	/* struct in_addr addr; */ \
121162615Sbms	/* struct in_ifaddr *ia; */ \
122162615Sbmsdo { \
123162615Sbms\
124162615Sbms	LIST_FOREACH(ia, INADDR_HASH((addr).s_addr), ia_hash) \
125162615Sbms		if (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \
126162615Sbms			break; \
127162615Sbms} while (0)
12884102Sjlemon
1291541Srgrimes/*
1301541Srgrimes * Macro for finding the interface (ifnet structure) corresponding to one
1311541Srgrimes * of our IP addresses.
1321541Srgrimes */
1331541Srgrimes#define INADDR_TO_IFP(addr, ifp) \
1341541Srgrimes	/* struct in_addr addr; */ \
1351541Srgrimes	/* struct ifnet *ifp; */ \
1361541Srgrimes{ \
13779821Sru	struct in_ifaddr *ia; \
1381541Srgrimes\
139162615Sbms	INADDR_TO_IFADDR(addr, ia); \
1401541Srgrimes	(ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \
1411541Srgrimes}
1421541Srgrimes
1431541Srgrimes/*
1441541Srgrimes * Macro for finding the internet address structure (in_ifaddr) corresponding
1451541Srgrimes * to a given interface (ifnet structure).
1461541Srgrimes */
1471541Srgrimes#define IFP_TO_IA(ifp, ia) \
1481541Srgrimes	/* struct ifnet *ifp; */ \
1491541Srgrimes	/* struct in_ifaddr *ia; */ \
1501541Srgrimes{ \
151181803Sbz	for ((ia) = TAILQ_FIRST(&V_in_ifaddrhead); \
1521541Srgrimes	    (ia) != NULL && (ia)->ia_ifp != (ifp); \
15371998Sphk	    (ia) = TAILQ_NEXT((ia), ia_link)) \
1541541Srgrimes		continue; \
1551541Srgrimes}
1561541Srgrimes#endif
1571541Srgrimes
1581541Srgrimes/*
159185088Szec * IP datagram reassembly.
160185088Szec */
161185088Szec#define	IPREASS_NHASH_LOG2	6
162185088Szec#define	IPREASS_NHASH		(1 << IPREASS_NHASH_LOG2)
163185088Szec#define	IPREASS_HMASK		(IPREASS_NHASH - 1)
164185088Szec#define	IPREASS_HASH(x,y) \
165185088Szec	(((((x) & 0xF) | ((((x) >> 8) & 0xF) << 4)) ^ (y)) & IPREASS_HMASK)
166185088Szec
167185088Szec/*
168189592Sbms * Legacy IPv4 IGMP per-link structure.
1692531Swollman */
1702531Swollmanstruct router_info {
17114622Sfenner	struct ifnet *rti_ifp;
17214622Sfenner	int    rti_type; /* type of router which is querier on this interface */
17314622Sfenner	int    rti_time; /* # of slow timeouts since last old query */
174119180Srwatson	SLIST_ENTRY(router_info) rti_list;
1752531Swollman};
1762531Swollman
1772531Swollman/*
178189592Sbms * Per-interface IGMP router version information.
1791541Srgrimes */
180189592Sbmsstruct igmp_ifinfo {
181189592Sbms	LIST_ENTRY(igmp_ifinfo) igi_link;
182189592Sbms	struct ifnet *igi_ifp;	/* interface this instance belongs to */
183189592Sbms	uint32_t igi_version;	/* IGMPv3 Host Compatibility Mode */
184189592Sbms	uint32_t igi_v1_timer;	/* IGMPv1 Querier Present timer (s) */
185189592Sbms	uint32_t igi_v2_timer;	/* IGMPv2 Querier Present timer (s) */
186189592Sbms	uint32_t igi_v3_timer;	/* IGMPv3 General Query (interface) timer (s)*/
187189592Sbms	uint32_t igi_flags;	/* IGMP per-interface flags */
188189592Sbms	uint32_t igi_rv;	/* IGMPv3 Robustness Variable */
189189592Sbms	uint32_t igi_qi;	/* IGMPv3 Query Interval (s) */
190189592Sbms	uint32_t igi_qri;	/* IGMPv3 Query Response Interval (s) */
191189592Sbms	uint32_t igi_uri;	/* IGMPv3 Unsolicited Report Interval (s) */
192189592Sbms	SLIST_HEAD(,in_multi)	igi_relinmhead; /* released groups */
193189592Sbms	struct ifqueue	 igi_gq;	/* queue of general query responses */
194189592Sbms};
195189592Sbms
196189592Sbms#define IGIF_SILENT	0x00000001	/* Do not use IGMP on this ifp */
197189592Sbms#define IGIF_LOOPBACK	0x00000002	/* Send IGMP reports to loopback */
198189592Sbms
199189592Sbms/*
200189592Sbms * IPv4 multicast IGMP-layer source entry.
201189592Sbms */
202189592Sbmsstruct ip_msource {
203189592Sbms	RB_ENTRY(ip_msource)	ims_link;	/* RB tree links */
204189592Sbms	in_addr_t		ims_haddr;	/* host byte order */
205189592Sbms	struct ims_st {
206189592Sbms		uint16_t	ex;		/* # of exclusive members */
207189592Sbms		uint16_t	in;		/* # of inclusive members */
208189592Sbms	}			ims_st[2];	/* state at t0, t1 */
209189592Sbms	uint8_t			ims_stp;	/* pending query */
210189592Sbms};
211189592Sbms
212189592Sbms/*
213189592Sbms * IPv4 multicast PCB-layer source entry.
214189592Sbms */
215189592Sbmsstruct in_msource {
216189592Sbms	RB_ENTRY(ip_msource)	ims_link;	/* RB tree links */
217189592Sbms	in_addr_t		ims_haddr;	/* host byte order */
218189592Sbms	uint8_t			imsl_st[2];	/* state before/at commit */
219189592Sbms};
220189592Sbms
221189592SbmsRB_HEAD(ip_msource_tree, ip_msource);	/* define struct ip_msource_tree */
222189592Sbms
223189592Sbmsstatic __inline int
224189592Sbmsip_msource_cmp(const struct ip_msource *a, const struct ip_msource *b)
225189592Sbms{
226189592Sbms
227189592Sbms	if (a->ims_haddr < b->ims_haddr)
228189592Sbms		return (-1);
229189592Sbms	if (a->ims_haddr == b->ims_haddr)
230189592Sbms		return (0);
231189592Sbms	return (1);
232189592Sbms}
233189592SbmsRB_PROTOTYPE(ip_msource_tree, ip_msource, ims_link, ip_msource_cmp);
234189592Sbms
235189592Sbms/*
236189592Sbms * IPv4 multicast PCB-layer group filter descriptor.
237189592Sbms */
238189592Sbmsstruct in_mfilter {
239189592Sbms	struct ip_msource_tree	imf_sources; /* source list for (S,G) */
240189592Sbms	u_long			imf_nsrc;    /* # of source entries */
241189592Sbms	uint8_t			imf_st[2];   /* state before/at commit */
242189592Sbms};
243189592Sbms
244189592Sbms/*
245189592Sbms * IPv4 group descriptor.
246189592Sbms *
247189592Sbms * For every entry on an ifnet's if_multiaddrs list which represents
248189592Sbms * an IP multicast group, there is one of these structures.
249189592Sbms *
250189592Sbms * If any source filters are present, then a node will exist in the RB-tree
251189592Sbms * to permit fast lookup by source whenever an operation takes place.
252189592Sbms * This permits pre-order traversal when we issue reports.
253189592Sbms * Source filter trees are kept separately from the socket layer to
254189592Sbms * greatly simplify locking.
255189592Sbms *
256189592Sbms * When IGMPv3 is active, inm_timer is the response to group query timer.
257189592Sbms * The state-change timer inm_sctimer is separate; whenever state changes
258189592Sbms * for the group the state change record is generated and transmitted,
259189592Sbms * and kept if retransmissions are necessary.
260189592Sbms *
261189592Sbms * FUTURE: inm_link is now only used when groups are being purged
262189592Sbms * on a detaching ifnet. It could be demoted to a SLIST_ENTRY, but
263189592Sbms * because it is at the very start of the struct, we can't do this
264189592Sbms * w/o breaking the ABI for ifmcstat.
265189592Sbms */
2661541Srgrimesstruct in_multi {
267189592Sbms	LIST_ENTRY(in_multi) inm_link;	/* to-be-released by in_ifdetach */
26821666Swollman	struct	in_addr inm_addr;	/* IP multicast address, convenience */
2691541Srgrimes	struct	ifnet *inm_ifp;		/* back pointer to ifnet */
27021666Swollman	struct	ifmultiaddr *inm_ifma;	/* back pointer to ifmultiaddr */
271189592Sbms	u_int	inm_timer;		/* IGMPv1/v2 group / v3 query timer */
272189592Sbms	u_int	inm_state;		/* state of the membership */
273189592Sbms	void	*inm_rti;		/* unused, legacy field */
274167729Sbms	u_int	inm_refcount;		/* reference count */
275189592Sbms
276189592Sbms	/* New fields for IGMPv3 follow. */
277189592Sbms	struct igmp_ifinfo	*inm_igi;	/* IGMP info */
278189592Sbms	SLIST_ENTRY(in_multi)	 inm_nrele;	/* to-be-released by IGMP */
279189592Sbms	struct ip_msource_tree	 inm_srcs;	/* tree of sources */
280189592Sbms	u_long			 inm_nsrc;	/* # of tree entries */
281189592Sbms
282189592Sbms	struct ifqueue		 inm_scq;	/* queue of pending
283189592Sbms						 * state-change packets */
284189592Sbms	struct timeval		 inm_lastgsrtv;	/* Time of last G-S-R query */
285189592Sbms	uint16_t		 inm_sctimer;	/* state-change timer */
286189592Sbms	uint16_t		 inm_scrv;	/* state-change rexmit count */
287189592Sbms
288189592Sbms	/*
289189592Sbms	 * SSM state counters which track state at T0 (the time the last
290189592Sbms	 * state-change report's RV timer went to zero) and T1
291189592Sbms	 * (time of pending report, i.e. now).
292189592Sbms	 * Used for computing IGMPv3 state-change reports. Several refcounts
293189592Sbms	 * are maintained here to optimize for common use-cases.
294189592Sbms	 */
295189592Sbms	struct inm_st {
296189592Sbms		uint16_t	iss_fmode;	/* IGMP filter mode */
297189592Sbms		uint16_t	iss_asm;	/* # of ASM listeners */
298189592Sbms		uint16_t	iss_ex;		/* # of exclusive members */
299189592Sbms		uint16_t	iss_in;		/* # of inclusive members */
300189592Sbms		uint16_t	iss_rec;	/* # of recorded sources */
301189592Sbms	}			inm_st[2];	/* state at t0, t1 */
3021541Srgrimes};
3031541Srgrimes
304170613Sbms/*
305189592Sbms * Helper function to derive the filter mode on a source entry
306189592Sbms * from its internal counters. Predicates are:
307189592Sbms *  A source is only excluded if all listeners exclude it.
308189592Sbms *  A source is only included if no listeners exclude it,
309189592Sbms *  and at least one listener includes it.
310189592Sbms * May be used by ifmcstat(8).
311170613Sbms */
312189592Sbmsstatic __inline uint8_t
313189592Sbmsims_get_mode(const struct in_multi *inm, const struct ip_msource *ims,
314189592Sbms    uint8_t t)
315189592Sbms{
316170613Sbms
317189592Sbms	t = !!t;
318189592Sbms	if (inm->inm_st[t].iss_ex > 0 &&
319189592Sbms	    inm->inm_st[t].iss_ex == ims->ims_st[t].ex)
320189592Sbms		return (MCAST_EXCLUDE);
321189592Sbms	else if (ims->ims_st[t].in > 0 && ims->ims_st[t].ex == 0)
322189592Sbms		return (MCAST_INCLUDE);
323189592Sbms	return (MCAST_UNDEFINED);
324189592Sbms}
325189592Sbms
32655205Speter#ifdef _KERNEL
32744078Sdfr
32844078Sdfr#ifdef SYSCTL_DECL
329136713SandreSYSCTL_DECL(_net_inet);
33044078SdfrSYSCTL_DECL(_net_inet_ip);
33144078SdfrSYSCTL_DECL(_net_inet_raw);
33244078Sdfr#endif
33344078Sdfr
334189592SbmsLIST_HEAD(in_multihead, in_multi);	/* XXX unused */
335186048Sbz#ifdef VIMAGE_GLOBALS
336186048Sbzextern struct in_multihead in_multihead;
337189592Sbms#endif /* BURN_BRIDGES */
33821666Swollman
3391541Srgrimes/*
340148682Srwatson * Lock macros for IPv4 layer multicast address lists.  IPv4 lock goes
341148682Srwatson * before link layer multicast locks in the lock order.  In most cases,
342148682Srwatson * consumers of IN_*_MULTI() macros should acquire the locks before
343148682Srwatson * calling them; users of the in_{add,del}multi() functions should not.
344148682Srwatson */
345148682Srwatsonextern struct mtx in_multi_mtx;
346148682Srwatson#define	IN_MULTI_LOCK()		mtx_lock(&in_multi_mtx)
347148682Srwatson#define	IN_MULTI_UNLOCK()	mtx_unlock(&in_multi_mtx)
348148682Srwatson#define	IN_MULTI_LOCK_ASSERT()	mtx_assert(&in_multi_mtx, MA_OWNED)
349189592Sbms#define	IN_MULTI_UNLOCK_ASSERT() mtx_assert(&in_multi_mtx, MA_NOTOWNED)
350148682Srwatson
351148682Srwatson/*
352189592Sbms * Function for looking up an in_multi record for an IPv4 multicast address
353189592Sbms * on a given interface. ifp must be valid. If no record found, return NULL.
354189592Sbms * The IN_MULTI_LOCK and IF_ADDR_LOCK on ifp must be held.
3551541Srgrimes */
356189592Sbmsstatic __inline struct in_multi *
357189592Sbmsinm_lookup_locked(struct ifnet *ifp, const struct in_addr ina)
358189592Sbms{
359189592Sbms	struct ifmultiaddr *ifma;
360189592Sbms	struct in_multi *inm;
3611541Srgrimes
362189592Sbms	IN_MULTI_LOCK_ASSERT();
363189592Sbms	IF_ADDR_LOCK_ASSERT(ifp);
364189592Sbms
365189592Sbms	inm = NULL;
366189592Sbms	TAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) {
367189592Sbms		if (ifma->ifma_addr->sa_family == AF_INET) {
368189592Sbms			inm = (struct in_multi *)ifma->ifma_protospec;
369189592Sbms			if (inm->inm_addr.s_addr == ina.s_addr)
370189592Sbms				break;
371189592Sbms			inm = NULL;
372189592Sbms		}
373189592Sbms	}
374189592Sbms	return (inm);
375189592Sbms}
376189592Sbms
3771541Srgrimes/*
378189592Sbms * Wrapper for inm_lookup_locked().
379189592Sbms * The IF_ADDR_LOCK will be taken on ifp and released on return.
3801541Srgrimes */
381189592Sbmsstatic __inline struct in_multi *
382189592Sbmsinm_lookup(struct ifnet *ifp, const struct in_addr ina)
383189592Sbms{
384189592Sbms	struct in_multi *inm;
3851541Srgrimes
386189592Sbms	IN_MULTI_LOCK_ASSERT();
387189592Sbms	IF_ADDR_LOCK(ifp);
388189592Sbms	inm = inm_lookup_locked(ifp, ina);
389189592Sbms	IF_ADDR_UNLOCK(ifp);
390189592Sbms
391189592Sbms	return (inm);
392189592Sbms}
393189592Sbms
394189592Sbms/* Acquire an in_multi record. */
395189592Sbmsstatic __inline void
396189592Sbmsinm_acquire_locked(struct in_multi *inm)
397189592Sbms{
398189592Sbms
399189592Sbms	IN_MULTI_LOCK_ASSERT();
400189592Sbms	++inm->inm_refcount;
401189592Sbms}
402189592Sbms
4031541Srgrimes/*
404189592Sbms * Return values for imo_multi_filter().
4051541Srgrimes */
406189592Sbms#define MCAST_PASS		0	/* Pass */
407189592Sbms#define MCAST_NOTGMEMBER	1	/* This host not a member of group */
408189592Sbms#define MCAST_NOTSMEMBER	2	/* This host excluded source */
409189592Sbms#define MCAST_MUTED		3	/* [deprecated] */
4101541Srgrimes
411178888Sjulianstruct	rtentry;
41236192Sdgstruct	route;
413170613Sbmsstruct	ip_moptions;
414170613Sbms
415189592Sbmsint	imo_multi_filter(const struct ip_moptions *, const struct ifnet *,
416189592Sbms	    const struct sockaddr *, const struct sockaddr *);
417189592Sbmsvoid	inm_commit(struct in_multi *);
418189592Sbmsvoid	inm_clear_recorded(struct in_multi *);
419189592Sbmsvoid	inm_print(const struct in_multi *);
420189592Sbmsint	inm_record_source(struct in_multi *inm, const in_addr_t);
421189592Sbmsvoid	inm_release(struct in_multi *);
422189592Sbmsvoid	inm_release_locked(struct in_multi *);
423189592Sbmsstruct	in_multi *
424189592Sbms	in_addmulti(struct in_addr *, struct ifnet *);
42592723Salfredvoid	in_delmulti(struct in_multi *);
426189592Sbmsint	in_joingroup(struct ifnet *, const struct in_addr *,
427189592Sbms	    /*const*/ struct in_mfilter *, struct in_multi **);
428189592Sbmsint	in_joingroup_locked(struct ifnet *, const struct in_addr *,
429189592Sbms	    /*const*/ struct in_mfilter *, struct in_multi **);
430189592Sbmsint	in_leavegroup(struct in_multi *, /*const*/ struct in_mfilter *);
431189592Sbmsint	in_leavegroup_locked(struct in_multi *,
432189592Sbms	    /*const*/ struct in_mfilter *);
43392723Salfredint	in_control(struct socket *, u_long, caddr_t, struct ifnet *,
43493085Sbde	    struct thread *);
43592723Salfredvoid	in_rtqdrain(void);
43692723Salfredvoid	ip_input(struct mbuf *);
43792723Salfredint	in_ifadown(struct ifaddr *ifa, int);
43892723Salfredvoid	in_ifscrub(struct ifnet *, struct in_ifaddr *);
439154518Sandrestruct	mbuf	*ip_fastforward(struct mbuf *);
440186119Sqinglivoid	*in_domifattach(struct ifnet *);
441186119Sqinglivoid	in_domifdetach(struct ifnet *, void *);
4422169Spaul
443186119Sqingli
444178888Sjulian/* XXX */
445178888Sjulianvoid	 in_rtalloc_ign(struct route *ro, u_long ignflags, u_int fibnum);
446178888Sjulianvoid	 in_rtalloc(struct route *ro, u_int fibnum);
447178888Sjulianstruct rtentry *in_rtalloc1(struct sockaddr *, int, u_long, u_int);
448178888Sjulianvoid	 in_rtredirect(struct sockaddr *, struct sockaddr *,
449178888Sjulian	    struct sockaddr *, int, struct sockaddr *, u_int);
450178888Sjulianint	 in_rtrequest(int, struct sockaddr *,
451178888Sjulian	    struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int);
452178888Sjulian
453178888Sjulian#if 0
454178888Sjulianint	 in_rt_getifa(struct rt_addrinfo *, u_int fibnum);
455178888Sjulianint	 in_rtioctl(u_long, caddr_t, u_int);
456178888Sjulianint	 in_rtrequest1(int, struct rt_addrinfo *, struct rtentry **, u_int);
457178888Sjulian#endif
45855205Speter#endif /* _KERNEL */
45910939Swollman
46052904Sshin/* INET6 stuff */
46152904Sshin#include <netinet6/in6_var.h>
46252904Sshin
46310939Swollman#endif /* _NETINET_IN_VAR_H_ */
464