1199767fToomas Soome/*-
2199767fToomas Soome * Copyright (c) 1982, 1986, 1990, 1993
3199767fToomas Soome *	The Regents of the University of California.  All rights reserved.
4199767fToomas Soome *
5199767fToomas Soome * Redistribution and use in source and binary forms, with or without
6199767fToomas Soome * modification, are permitted provided that the following conditions
7199767fToomas Soome * are met:
8199767fToomas Soome * 1. Redistributions of source code must retain the above copyright
9199767fToomas Soome *    notice, this list of conditions and the following disclaimer.
10199767fToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
11199767fToomas Soome *    notice, this list of conditions and the following disclaimer in the
12199767fToomas Soome *    documentation and/or other materials provided with the distribution.
13199767fToomas Soome * 4. Neither the name of the University nor the names of its contributors
14199767fToomas Soome *    may be used to endorse or promote products derived from this software
15199767fToomas Soome *    without specific prior written permission.
16199767fToomas Soome *
17199767fToomas Soome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18199767fToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19199767fToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20199767fToomas Soome * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21199767fToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22199767fToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23199767fToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24199767fToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25199767fToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26199767fToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27199767fToomas Soome * SUCH DAMAGE.
28199767fToomas Soome *
29199767fToomas Soome *	@(#)in.h	8.3 (Berkeley) 1/3/94
30199767fToomas Soome * $FreeBSD$
31199767fToomas Soome */
32199767fToomas Soome
33199767fToomas Soome#ifndef _NETINET_IN_H_
34199767fToomas Soome#define	_NETINET_IN_H_
35199767fToomas Soome
36199767fToomas Soome#include <sys/cdefs.h>
37199767fToomas Soome#include <sys/_types.h>
38199767fToomas Soome#include <machine/endian.h>
39199767fToomas Soome
40199767fToomas Soome/* Protocols common to RFC 1700, POSIX, and X/Open. */
41199767fToomas Soome#define	IPPROTO_IP		0		/* dummy for IP */
42199767fToomas Soome#define	IPPROTO_ICMP		1		/* control message protocol */
43199767fToomas Soome#define	IPPROTO_TCP		6		/* tcp */
44199767fToomas Soome#define	IPPROTO_UDP		17		/* user datagram protocol */
45199767fToomas Soome
46199767fToomas Soome#define	INADDR_ANY		((in_addr_t)0x00000000)
47199767fToomas Soome#define	INADDR_BROADCAST	((in_addr_t)0xffffffff)	/* must be masked */
48199767fToomas Soome
49199767fToomas Soome#ifndef _UINT8_T_DECLARED
50199767fToomas Soometypedef	__uint8_t		uint8_t;
51199767fToomas Soome#define	_UINT8_T_DECLARED
52199767fToomas Soome#endif
53199767fToomas Soome
54199767fToomas Soome#ifndef _UINT16_T_DECLARED
55199767fToomas Soometypedef	__uint16_t		uint16_t;
56199767fToomas Soome#define	_UINT16_T_DECLARED
57199767fToomas Soome#endif
58199767fToomas Soome
59199767fToomas Soome#ifndef _UINT32_T_DECLARED
60199767fToomas Soometypedef	__uint32_t		uint32_t;
61199767fToomas Soome#define	_UINT32_T_DECLARED
62199767fToomas Soome#endif
63199767fToomas Soome
64199767fToomas Soome#ifndef _IN_ADDR_T_DECLARED
65199767fToomas Soometypedef	uint32_t		in_addr_t;
66199767fToomas Soome#define	_IN_ADDR_T_DECLARED
67199767fToomas Soome#endif
68199767fToomas Soome
69199767fToomas Soome#ifndef _IN_PORT_T_DECLARED
70199767fToomas Soometypedef	uint16_t		in_port_t;
71199767fToomas Soome#define	_IN_PORT_T_DECLARED
72199767fToomas Soome#endif
73199767fToomas Soome
74199767fToomas Soome#ifndef _SA_FAMILY_T_DECLARED
75199767fToomas Soometypedef	__sa_family_t		sa_family_t;
76199767fToomas Soome#define	_SA_FAMILY_T_DECLARED
77199767fToomas Soome#endif
78199767fToomas Soome
79199767fToomas Soome/* Internet address (a structure for historical reasons). */
80199767fToomas Soome#ifndef	_STRUCT_IN_ADDR_DECLARED
81199767fToomas Soomestruct in_addr {
82199767fToomas Soome	in_addr_t s_addr;
83199767fToomas Soome};
84199767fToomas Soome#define	_STRUCT_IN_ADDR_DECLARED
85199767fToomas Soome#endif
86199767fToomas Soome
87199767fToomas Soome#ifndef	_SOCKLEN_T_DECLARED
88199767fToomas Soometypedef	__socklen_t	socklen_t;
89199767fToomas Soome#define	_SOCKLEN_T_DECLARED
90199767fToomas Soome#endif
91199767fToomas Soome
92199767fToomas Soome#include <sys/_sockaddr_storage.h>
93199767fToomas Soome
94199767fToomas Soome/* Socket address, internet style. */
95199767fToomas Soomestruct sockaddr_in {
96199767fToomas Soome	uint8_t	sin_len;
97199767fToomas Soome	sa_family_t	sin_family;
98199767fToomas Soome	in_port_t	sin_port;
99199767fToomas Soome	struct	in_addr sin_addr;
100199767fToomas Soome	char	sin_zero[8];
101199767fToomas Soome};
102199767fToomas Soome
103199767fToomas Soome#if !defined(_KERNEL) && __POSIX_VISIBLE >= 200112
104199767fToomas Soome
105199767fToomas Soome#ifndef _BYTEORDER_PROTOTYPED
106199767fToomas Soome#define	_BYTEORDER_PROTOTYPED
107199767fToomas Soome__BEGIN_DECLS
108199767fToomas Soomeuint32_t	htonl(uint32_t);
109199767fToomas Soomeuint16_t	htons(uint16_t);
110199767fToomas Soomeuint32_t	ntohl(uint32_t);
111199767fToomas Soomeuint16_t	ntohs(uint16_t);
112199767fToomas Soome__END_DECLS
113199767fToomas Soome#endif
114199767fToomas Soome
115199767fToomas Soome#ifndef _BYTEORDER_FUNC_DEFINED
116199767fToomas Soome#define	_BYTEORDER_FUNC_DEFINED
117199767fToomas Soome#define	htonl(x)	__htonl(x)
118199767fToomas Soome#define	htons(x)	__htons(x)
119199767fToomas Soome#define	ntohl(x)	__ntohl(x)
120199767fToomas Soome#define	ntohs(x)	__ntohs(x)
121199767fToomas Soome#endif
122199767fToomas Soome
123199767fToomas Soome#endif /* !_KERNEL && __POSIX_VISIBLE >= 200112 */
124199767fToomas Soome
125199767fToomas Soome#if __POSIX_VISIBLE >= 200112
126199767fToomas Soome#define	IPPROTO_IPV6		41		/* IP6 header */
127199767fToomas Soome#define	IPPROTO_RAW		255		/* raw IP packet */
128199767fToomas Soome#define	INET_ADDRSTRLEN		16
129199767fToomas Soome#endif
130199767fToomas Soome
131199767fToomas Soome#if __BSD_VISIBLE
132199767fToomas Soome/*
133199767fToomas Soome * Constants and structures defined by the internet system,
134199767fToomas Soome * Per RFC 790, September 1981, and numerous additions.
135199767fToomas Soome */
136199767fToomas Soome
137199767fToomas Soome/*
138199767fToomas Soome * Protocols (RFC 1700)
139199767fToomas Soome */
140199767fToomas Soome#define	IPPROTO_HOPOPTS		0		/* IP6 hop-by-hop options */
141199767fToomas Soome#define	IPPROTO_IGMP		2		/* group mgmt protocol */
142199767fToomas Soome#define	IPPROTO_GGP		3		/* gateway^2 (deprecated) */
143199767fToomas Soome#define	IPPROTO_IPV4		4		/* IPv4 encapsulation */
144199767fToomas Soome#define	IPPROTO_IPIP		IPPROTO_IPV4	/* for compatibility */
145199767fToomas Soome#define	IPPROTO_ST		7		/* Stream protocol II */
146199767fToomas Soome#define	IPPROTO_EGP		8		/* exterior gateway protocol */
147199767fToomas Soome#define	IPPROTO_PIGP		9		/* private interior gateway */
148199767fToomas Soome#define	IPPROTO_RCCMON		10		/* BBN RCC Monitoring */
149199767fToomas Soome#define	IPPROTO_NVPII		11		/* network voice protocol*/
150199767fToomas Soome#define	IPPROTO_PUP		12		/* pup */
151199767fToomas Soome#define	IPPROTO_ARGUS		13		/* Argus */
152199767fToomas Soome#define	IPPROTO_EMCON		14		/* EMCON */
153199767fToomas Soome#define	IPPROTO_XNET		15		/* Cross Net Debugger */
154199767fToomas Soome#define	IPPROTO_CHAOS		16		/* Chaos*/
155199767fToomas Soome#define	IPPROTO_MUX		18		/* Multiplexing */
156199767fToomas Soome#define	IPPROTO_MEAS		19		/* DCN Measurement Subsystems */
157199767fToomas Soome#define	IPPROTO_HMP		20		/* Host Monitoring */
158199767fToomas Soome#define	IPPROTO_PRM		21		/* Packet Radio Measurement */
159199767fToomas Soome#define	IPPROTO_IDP		22		/* xns idp */
160199767fToomas Soome#define	IPPROTO_TRUNK1		23		/* Trunk-1 */
161199767fToomas Soome#define	IPPROTO_TRUNK2		24		/* Trunk-2 */
162199767fToomas Soome#define	IPPROTO_LEAF1		25		/* Leaf-1 */
163199767fToomas Soome#define	IPPROTO_LEAF2		26		/* Leaf-2 */
164199767fToomas Soome#define	IPPROTO_RDP		27		/* Reliable Data */
165199767fToomas Soome#define	IPPROTO_IRTP		28		/* Reliable Transaction */
166199767fToomas Soome#define	IPPROTO_TP		29		/* tp-4 w/ class negotiation */
167199767fToomas Soome#define	IPPROTO_BLT		30		/* Bulk Data Transfer */
168199767fToomas Soome#define	IPPROTO_NSP		31		/* Network Services */
169199767fToomas Soome#define	IPPROTO_INP		32		/* Merit Internodal */
170199767fToomas Soome#define	IPPROTO_SEP		33		/* Sequential Exchange */
171199767fToomas Soome#define	IPPROTO_3PC		34		/* Third Party Connect */
172199767fToomas Soome#define	IPPROTO_IDPR		35		/* InterDomain Policy Routing */
173199767fToomas Soome#define	IPPROTO_XTP		36		/* XTP */
174199767fToomas Soome#define	IPPROTO_DDP		37		/* Datagram Delivery */
175199767fToomas Soome#define	IPPROTO_CMTP		38		/* Control Message Transport */
176199767fToomas Soome#define	IPPROTO_TPXX		39		/* TP++ Transport */
177199767fToomas Soome#define	IPPROTO_IL		40		/* IL transport protocol */
178199767fToomas Soome#define	IPPROTO_SDRP		42		/* Source Demand Routing */
179199767fToomas Soome#define	IPPROTO_ROUTING		43		/* IP6 routing header */
180199767fToomas Soome#define	IPPROTO_FRAGMENT	44		/* IP6 fragmentation header */
181199767fToomas Soome#define	IPPROTO_IDRP		45		/* InterDomain Routing*/
182199767fToomas Soome#define	IPPROTO_RSVP		46		/* resource reservation */
183199767fToomas Soome#define	IPPROTO_GRE		47		/* General Routing Encap. */
184199767fToomas Soome#define	IPPROTO_MHRP		48		/* Mobile Host Routing */
185199767fToomas Soome#define	IPPROTO_BHA		49		/* BHA */
186199767fToomas Soome#define	IPPROTO_ESP		50		/* IP6 Encap Sec. Payload */
187199767fToomas Soome#define	IPPROTO_AH		51		/* IP6 Auth Header */
188199767fToomas Soome#define	IPPROTO_INLSP		52		/* Integ. Net Layer Security */
189199767fToomas Soome#define	IPPROTO_SWIPE		53		/* IP with encryption */
190199767fToomas Soome#define	IPPROTO_NHRP		54		/* Next Hop Resolution */
191199767fToomas Soome#define	IPPROTO_MOBILE		55		/* IP Mobility */
192199767fToomas Soome#define	IPPROTO_TLSP		56		/* Transport Layer Security */
193199767fToomas Soome#define	IPPROTO_SKIP		57		/* SKIP */
194199767fToomas Soome#define	IPPROTO_ICMPV6		58		/* ICMP6 */
195199767fToomas Soome#define	IPPROTO_NONE		59		/* IP6 no next header */
196199767fToomas Soome#define	IPPROTO_DSTOPTS		60		/* IP6 destination option */
197199767fToomas Soome#define	IPPROTO_AHIP		61		/* any host internal protocol */
198199767fToomas Soome#define	IPPROTO_CFTP		62		/* CFTP */
199199767fToomas Soome#define	IPPROTO_HELLO		63		/* "hello" routing protocol */
200199767fToomas Soome#define	IPPROTO_SATEXPAK	64		/* SATNET/Backroom EXPAK */
201199767fToomas Soome#define	IPPROTO_KRYPTOLAN	65		/* Kryptolan */
202199767fToomas Soome#define	IPPROTO_RVD		66		/* Remote Virtual Disk */
203199767fToomas Soome#define	IPPROTO_IPPC		67		/* Pluribus Packet Core */
204199767fToomas Soome#define	IPPROTO_ADFS		68		/* Any distributed FS */
205199767fToomas Soome#define	IPPROTO_SATMON		69		/* Satnet Monitoring */
206199767fToomas Soome#define	IPPROTO_VISA		70		/* VISA Protocol */
207199767fToomas Soome#define	IPPROTO_IPCV		71		/* Packet Core Utility */
208199767fToomas Soome#define	IPPROTO_CPNX		72		/* Comp. Prot. Net. Executive */
209199767fToomas Soome#define	IPPROTO_CPHB		73		/* Comp. Prot. HeartBeat */
210199767fToomas Soome#define	IPPROTO_WSN		74		/* Wang Span Network */
211199767fToomas Soome#define	IPPROTO_PVP		75		/* Packet Video Protocol */
212199767fToomas Soome#define	IPPROTO_BRSATMON	76		/* BackRoom SATNET Monitoring */
213199767fToomas Soome#define	IPPROTO_ND		77		/* Sun net disk proto (temp.) */
214199767fToomas Soome#define	IPPROTO_WBMON		78		/* WIDEBAND Monitoring */
215199767fToomas Soome#define	IPPROTO_WBEXPAK		79		/* WIDEBAND EXPAK */
216199767fToomas Soome#define	IPPROTO_EON		80		/* ISO cnlp */
217199767fToomas Soome#define	IPPROTO_VMTP		81		/* VMTP */
218199767fToomas Soome#define	IPPROTO_SVMTP		82		/* Secure VMTP */
219199767fToomas Soome#define	IPPROTO_VINES		83		/* Banyon VINES */
220199767fToomas Soome#define	IPPROTO_TTP		84		/* TTP */
221199767fToomas Soome#define	IPPROTO_IGP		85		/* NSFNET-IGP */
222199767fToomas Soome#define	IPPROTO_DGP		86		/* dissimilar gateway prot. */
223199767fToomas Soome#define	IPPROTO_TCF		87		/* TCF */
224199767fToomas Soome#define	IPPROTO_IGRP		88		/* Cisco/GXS IGRP */
225199767fToomas Soome#define	IPPROTO_OSPFIGP		89		/* OSPFIGP */
226199767fToomas Soome#define	IPPROTO_SRPC		90		/* Strite RPC protocol */
227199767fToomas Soome#define	IPPROTO_LARP		91		/* Locus Address Resoloution */
228199767fToomas Soome#define	IPPROTO_MTP		92		/* Multicast Transport */
229199767fToomas Soome#define	IPPROTO_AX25		93		/* AX.25 Frames */
230199767fToomas Soome#define	IPPROTO_IPEIP		94		/* IP encapsulated in IP */
231199767fToomas Soome#define	IPPROTO_MICP		95		/* Mobile Int.ing control */
232199767fToomas Soome#define	IPPROTO_SCCSP		96		/* Semaphore Comm. security */
233199767fToomas Soome#define	IPPROTO_ETHERIP		97		/* Ethernet IP encapsulation */
234199767fToomas Soome#define	IPPROTO_ENCAP		98		/* encapsulation header */
235199767fToomas Soome#define	IPPROTO_APES		99		/* any private encr. scheme */
236199767fToomas Soome#define	IPPROTO_GMTP		100		/* GMTP*/
237199767fToomas Soome#define	IPPROTO_IPCOMP		108		/* payload compression (IPComp) */
238199767fToomas Soome#define	IPPROTO_SCTP		132		/* SCTP */
239199767fToomas Soome#define	IPPROTO_MH		135		/* IPv6 Mobility Header */
240199767fToomas Soome#define	IPPROTO_UDPLITE		136		/* UDP-Lite */
241199767fToomas Soome#define	IPPROTO_HIP		139		/* IP6 Host Identity Protocol */
242199767fToomas Soome#define	IPPROTO_SHIM6		140		/* IP6 Shim6 Protocol */
243199767fToomas Soome/* 101-254: Partly Unassigned */
244199767fToomas Soome#define	IPPROTO_PIM		103		/* Protocol Independent Mcast */
245199767fToomas Soome#define	IPPROTO_CARP		112		/* CARP */
246199767fToomas Soome#define	IPPROTO_PGM		113		/* PGM */
247199767fToomas Soome#define	IPPROTO_MPLS		137		/* MPLS-in-IP */
248199767fToomas Soome#define	IPPROTO_PFSYNC		240		/* PFSYNC */
249199767fToomas Soome#define	IPPROTO_RESERVED_253	253		/* Reserved */
250199767fToomas Soome#define	IPPROTO_RESERVED_254	254		/* Reserved */
251199767fToomas Soome/* 255: Reserved */
252199767fToomas Soome/* BSD Private, local use, namespace incursion, no longer used */
253199767fToomas Soome#define	IPPROTO_OLD_DIVERT	254		/* OLD divert pseudo-proto */
254199767fToomas Soome#define	IPPROTO_MAX		256
255199767fToomas Soome
256199767fToomas Soome/* last return value of *_input(), meaning "all job for this pkt is done".  */
257199767fToomas Soome#define	IPPROTO_DONE		257
258199767fToomas Soome
259199767fToomas Soome/* Only used internally, so can be outside the range of valid IP protocols. */
260199767fToomas Soome#define	IPPROTO_DIVERT		258		/* divert pseudo-protocol */
261199767fToomas Soome#define	IPPROTO_SEND		259		/* SeND pseudo-protocol */
262199767fToomas Soome
263199767fToomas Soome/*
264199767fToomas Soome * Defined to avoid confusion.  The master value is defined by
265199767fToomas Soome * PROTO_SPACER in sys/protosw.h.
266199767fToomas Soome */
267199767fToomas Soome#define	IPPROTO_SPACER		32767		/* spacer for loadable protos */
268199767fToomas Soome
269199767fToomas Soome/*
270199767fToomas Soome * Local port number conventions:
271199767fToomas Soome *
272199767fToomas Soome * When a user does a bind(2) or connect(2) with a port number of zero,
273199767fToomas Soome * a non-conflicting local port address is chosen.
274199767fToomas Soome * The default range is IPPORT_HIFIRSTAUTO through
275199767fToomas Soome * IPPORT_HILASTAUTO, although that is settable by sysctl.
276199767fToomas Soome *
277199767fToomas Soome * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
278199767fToomas Soome * default assignment range.
279199767fToomas Soome *
280199767fToomas Soome * The value IP_PORTRANGE_DEFAULT causes the default behavior.
281199767fToomas Soome *
282199767fToomas Soome * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
283199767fToomas Soome * into the "high" range.  These are reserved for client outbound connections
284199767fToomas Soome * which do not want to be filtered by any firewalls.
285199767fToomas Soome *
286199767fToomas Soome * The value IP_PORTRANGE_LOW changes the range to the "low" are
287199767fToomas Soome * that is (by convention) restricted to privileged processes.  This
288199767fToomas Soome * convention is based on "vouchsafe" principles only.  It is only secure
289199767fToomas Soome * if you trust the remote host to restrict these ports.
290199767fToomas Soome *
291199767fToomas Soome * The default range of ports and the high range can be changed by
292199767fToomas Soome * sysctl(3).  (net.inet.ip.port{hi,low}{first,last}_auto)
293199767fToomas Soome *
294199767fToomas Soome * Changing those values has bad security implications if you are
295199767fToomas Soome * using a stateless firewall that is allowing packets outside of that
296199767fToomas Soome * range in order to allow transparent outgoing connections.
297199767fToomas Soome *
298199767fToomas Soome * Such a firewall configuration will generally depend on the use of these
299199767fToomas Soome * default values.  If you change them, you may find your Security
300199767fToomas Soome * Administrator looking for you with a heavy object.
301199767fToomas Soome *
302199767fToomas Soome * For a slightly more orthodox text view on this:
303199767fToomas Soome *
304199767fToomas Soome *            ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers
305199767fToomas Soome *
306199767fToomas Soome *    port numbers are divided into three ranges:
307199767fToomas Soome *
308199767fToomas Soome *                0 -  1023 Well Known Ports
309199767fToomas Soome *             1024 - 49151 Registered Ports
310199767fToomas Soome *            49152 - 65535 Dynamic and/or Private Ports
311199767fToomas Soome *
312199767fToomas Soome */
313199767fToomas Soome
314199767fToomas Soome/*
315199767fToomas Soome * Ports < IPPORT_RESERVED are reserved for
316199767fToomas Soome * privileged processes (e.g. root).         (IP_PORTRANGE_LOW)
317199767fToomas Soome */
318199767fToomas Soome#define	IPPORT_RESERVED		1024
319199767fToomas Soome
320199767fToomas Soome/*
321199767fToomas Soome * Default local port range, used by IP_PORTRANGE_DEFAULT
322199767fToomas Soome */
323199767fToomas Soome#define IPPORT_EPHEMERALFIRST	10000
324199767fToomas Soome#define IPPORT_EPHEMERALLAST	65535
325199767fToomas Soome
326199767fToomas Soome/*
327199767fToomas Soome * Dynamic port range, used by IP_PORTRANGE_HIGH.
328199767fToomas Soome */
329199767fToomas Soome#define	IPPORT_HIFIRSTAUTO	49152
330199767fToomas Soome#define	IPPORT_HILASTAUTO	65535
331199767fToomas Soome
332199767fToomas Soome/*
333199767fToomas Soome * Scanning for a free reserved port return a value below IPPORT_RESERVED,
334199767fToomas Soome * but higher than IPPORT_RESERVEDSTART.  Traditionally the start value was
335199767fToomas Soome * 512, but that conflicts with some well-known-services that firewalls may
336199767fToomas Soome * have a fit if we use.
337199767fToomas Soome */
338199767fToomas Soome#define	IPPORT_RESERVEDSTART	600
339199767fToomas Soome
340199767fToomas Soome#define	IPPORT_MAX		65535
341199767fToomas Soome
342199767fToomas Soome/*
343199767fToomas Soome * Definitions of bits in internet address integers.
344199767fToomas Soome * On subnets, the decomposition of addresses to host and net parts
345199767fToomas Soome * is done according to subnet mask, not the masks here.
346199767fToomas Soome */
347199767fToomas Soome#define	IN_CLASSA(i)		(((in_addr_t)(i) & 0x80000000) == 0)
348199767fToomas Soome#define	IN_CLASSA_NET		0xff000000
349199767fToomas Soome#define	IN_CLASSA_NSHIFT	24
350199767fToomas Soome#define	IN_CLASSA_HOST		0x00ffffff
351199767fToomas Soome#define	IN_CLASSA_MAX		128
352199767fToomas Soome
353199767fToomas Soome#define	IN_CLASSB(i)		(((in_addr_t)(i) & 0xc0000000) == 0x80000000)
354199767fToomas Soome#define	IN_CLASSB_NET		0xffff0000
355199767fToomas Soome#define	IN_CLASSB_NSHIFT	16
356199767fToomas Soome#define	IN_CLASSB_HOST		0x0000ffff
357199767fToomas Soome#define	IN_CLASSB_MAX		65536
358199767fToomas Soome
359199767fToomas Soome#define	IN_CLASSC(i)		(((in_addr_t)(i) & 0xe0000000) == 0xc0000000)
360199767fToomas Soome#define	IN_CLASSC_NET		0xffffff00
361199767fToomas Soome#define	IN_CLASSC_NSHIFT	8
362199767fToomas Soome#define	IN_CLASSC_HOST		0x000000ff
363199767fToomas Soome
364199767fToomas Soome#define	IN_CLASSD(i)		(((in_addr_t)(i) & 0xf0000000) == 0xe0000000)
365199767fToomas Soome#define	IN_CLASSD_NET		0xf0000000	/* These ones aren't really */
366199767fToomas Soome#define	IN_CLASSD_NSHIFT	28		/* net and host fields, but */
367199767fToomas Soome#define	IN_CLASSD_HOST		0x0fffffff	/* routing needn't know.    */
368199767fToomas Soome#define	IN_MULTICAST(i)		IN_CLASSD(i)
369199767fToomas Soome
370199767fToomas Soome#define	IN_EXPERIMENTAL(i)	(((in_addr_t)(i) & 0xf0000000) == 0xf0000000)
371199767fToomas Soome#define	IN_BADCLASS(i)		(((in_addr_t)(i) & 0xf0000000) == 0xf0000000)
372199767fToomas Soome
373199767fToomas Soome#define IN_LINKLOCAL(i)		(((in_addr_t)(i) & 0xffff0000) == 0xa9fe0000)
374199767fToomas Soome#define IN_LOOPBACK(i)		(((in_addr_t)(i) & 0xff000000) == 0x7f000000)
375199767fToomas Soome#define IN_ZERONET(i)		(((in_addr_t)(i) & 0xff000000) == 0)
376199767fToomas Soome
377199767fToomas Soome#define	IN_PRIVATE(i)	((((in_addr_t)(i) & 0xff000000) == 0x0a000000) || \
378199767fToomas Soome			 (((in_addr_t)(i) & 0xfff00000) == 0xac100000) || \
379199767fToomas Soome			 (((in_addr_t)(i) & 0xffff0000) == 0xc0a80000))
380199767fToomas Soome
381199767fToomas Soome#define	IN_LOCAL_GROUP(i)	(((in_addr_t)(i) & 0xffffff00) == 0xe0000000)
382199767fToomas Soome
383199767fToomas Soome#define	IN_ANY_LOCAL(i)		(IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
384199767fToomas Soome
385199767fToomas Soome#define	INADDR_LOOPBACK		((in_addr_t)0x7f000001)
386199767fToomas Soome#ifndef _KERNEL
387199767fToomas Soome#define	INADDR_NONE		((in_addr_t)0xffffffff)	/* -1 return */
388199767fToomas Soome#endif
389199767fToomas Soome
390199767fToomas Soome#define	INADDR_UNSPEC_GROUP	((in_addr_t)0xe0000000)	/* 224.0.0.0 */
391199767fToomas Soome#define	INADDR_ALLHOSTS_GROUP	((in_addr_t)0xe0000001)	/* 224.0.0.1 */
392199767fToomas Soome#define	INADDR_ALLRTRS_GROUP	((in_addr_t)0xe0000002)	/* 224.0.0.2 */
393199767fToomas Soome#define	INADDR_ALLRPTS_GROUP	((in_addr_t)0xe0000016)	/* 224.0.0.22, IGMPv3 */
394199767fToomas Soome#define	INADDR_CARP_GROUP	((in_addr_t)0xe0000012)	/* 224.0.0.18 */
395199767fToomas Soome#define	INADDR_PFSYNC_GROUP	((in_addr_t)0xe00000f0)	/* 224.0.0.240 */
396199767fToomas Soome#define	INADDR_ALLMDNS_GROUP	((in_addr_t)0xe00000fb)	/* 224.0.0.251 */
397199767fToomas Soome#define	INADDR_MAX_LOCAL_GROUP	((in_addr_t)0xe00000ff)	/* 224.0.0.255 */
398199767fToomas Soome
399199767fToomas Soome#define	IN_LOOPBACKNET		127			/* official! */
400199767fToomas Soome
401199767fToomas Soome#define	IN_RFC3021_MASK		((in_addr_t)0xfffffffe)
402199767fToomas Soome
403199767fToomas Soome/*
404199767fToomas Soome * Options for use with [gs]etsockopt at the IP level.
405199767fToomas Soome * First word of comment is data type; bool is stored in int.
406199767fToomas Soome */
407199767fToomas Soome#define	IP_OPTIONS		1    /* buf/ip_opts; set/get IP options */
408199767fToomas Soome#define	IP_HDRINCL		2    /* int; header is included with data */
409199767fToomas Soome#define	IP_TOS			3    /* int; IP type of service and preced. */
410199767fToomas Soome#define	IP_TTL			4    /* int; IP time to live */
411199767fToomas Soome#define	IP_RECVOPTS		5    /* bool; receive all IP opts w/dgram */
412199767fToomas Soome#define	IP_RECVRETOPTS		6    /* bool; receive IP opts for response */
413199767fToomas Soome#define	IP_RECVDSTADDR		7    /* bool; receive IP dst addr w/dgram */
414199767fToomas Soome#define	IP_SENDSRCADDR		IP_RECVDSTADDR /* cmsg_type to set src addr */
415199767fToomas Soome#define	IP_RETOPTS		8    /* ip_opts; set/get IP options */
416199767fToomas Soome#define	IP_MULTICAST_IF		9    /* struct in_addr *or* struct ip_mreqn;
417199767fToomas Soome				      * set/get IP multicast i/f  */
418199767fToomas Soome#define	IP_MULTICAST_TTL	10   /* u_char; set/get IP multicast ttl */
419199767fToomas Soome#define	IP_MULTICAST_LOOP	11   /* u_char; set/get IP multicast loopback */
420199767fToomas Soome#define	IP_ADD_MEMBERSHIP	12   /* ip_mreq; add an IP group membership */
421199767fToomas Soome#define	IP_DROP_MEMBERSHIP	13   /* ip_mreq; drop an IP group membership */
422199767fToomas Soome#define	IP_MULTICAST_VIF	14   /* set/get IP mcast virt. iface */
423199767fToomas Soome#define	IP_RSVP_ON		15   /* enable RSVP in kernel */
424199767fToomas Soome#define	IP_RSVP_OFF		16   /* disable RSVP in kernel */
425199767fToomas Soome#define	IP_RSVP_VIF_ON		17   /* set RSVP per-vif socket */
426199767fToomas Soome#define	IP_RSVP_VIF_OFF		18   /* unset RSVP per-vif socket */
427199767fToomas Soome#define	IP_PORTRANGE		19   /* int; range to choose for unspec port */
428199767fToomas Soome#define	IP_RECVIF		20   /* bool; receive reception if w/dgram */
429199767fToomas Soome/* for IPSEC */
430199767fToomas Soome#define	IP_IPSEC_POLICY		21   /* int; set/get security policy */
431199767fToomas Soome				     /* unused; was IP_FAITH */
432199767fToomas Soome#define	IP_ONESBCAST		23   /* bool: send all-ones broadcast */
433199767fToomas Soome#define	IP_BINDANY		24   /* bool: allow bind to any address */
434199767fToomas Soome#define	IP_BINDMULTI		25   /* bool: allow multiple listeners on a tuple */
435199767fToomas Soome#define	IP_RSS_LISTEN_BUCKET	26   /* int; set RSS listen bucket */
436199767fToomas Soome
437199767fToomas Soome/*
438199767fToomas Soome * Options for controlling the firewall and dummynet.
439199767fToomas Soome * Historical options (from 40 to 64) will eventually be
440199767fToomas Soome * replaced by only two options, IP_FW3 and IP_DUMMYNET3.
441199767fToomas Soome */
442199767fToomas Soome#define	IP_FW_TABLE_ADD		40   /* add entry */
443199767fToomas Soome#define	IP_FW_TABLE_DEL		41   /* delete entry */
444199767fToomas Soome#define	IP_FW_TABLE_FLUSH	42   /* flush table */
445199767fToomas Soome#define	IP_FW_TABLE_GETSIZE	43   /* get table size */
446199767fToomas Soome#define	IP_FW_TABLE_LIST	44   /* list table contents */
447199767fToomas Soome
448199767fToomas Soome#define	IP_FW3			48   /* generic ipfw v.3 sockopts */
449199767fToomas Soome#define	IP_DUMMYNET3		49   /* generic dummynet v.3 sockopts */
450199767fToomas Soome
451199767fToomas Soome#define	IP_FW_ADD		50   /* add a firewall rule to chain */
452199767fToomas Soome#define	IP_FW_DEL		51   /* delete a firewall rule from chain */
453199767fToomas Soome#define	IP_FW_FLUSH		52   /* flush firewall rule chain */
454199767fToomas Soome#define	IP_FW_ZERO		53   /* clear single/all firewall counter(s) */
455199767fToomas Soome#define	IP_FW_GET		54   /* get entire firewall rule chain */
456199767fToomas Soome#define	IP_FW_RESETLOG		55   /* reset logging counters */
457199767fToomas Soome
458199767fToomas Soome#define IP_FW_NAT_CFG           56   /* add/config a nat rule */
459199767fToomas Soome#define IP_FW_NAT_DEL           57   /* delete a nat rule */
460199767fToomas Soome#define IP_FW_NAT_GET_CONFIG    58   /* get configuration of a nat rule */
461199767fToomas Soome#define IP_FW_NAT_GET_LOG       59   /* get log of a nat rule */
462199767fToomas Soome
463199767fToomas Soome#define	IP_DUMMYNET_CONFIGURE	60   /* add/configure a dummynet pipe */
464199767fToomas Soome#define	IP_DUMMYNET_DEL		61   /* delete a dummynet pipe from chain */
465199767fToomas Soome#define	IP_DUMMYNET_FLUSH	62   /* flush dummynet */
466199767fToomas Soome#define	IP_DUMMYNET_GET		64   /* get entire dummynet pipes */
467199767fToomas Soome
468199767fToomas Soome#define	IP_RECVTTL		65   /* bool; receive IP TTL w/dgram */
469199767fToomas Soome#define	IP_MINTTL		66   /* minimum TTL for packet or drop */
470199767fToomas Soome#define	IP_DONTFRAG		67   /* don't fragment packet */
471199767fToomas Soome#define	IP_RECVTOS		68   /* bool; receive IP TOS w/dgram */
472199767fToomas Soome
473199767fToomas Soome/* IPv4 Source Filter Multicast API [RFC3678] */
474199767fToomas Soome#define	IP_ADD_SOURCE_MEMBERSHIP	70   /* join a source-specific group */
475199767fToomas Soome#define	IP_DROP_SOURCE_MEMBERSHIP	71   /* drop a single source */
476199767fToomas Soome#define	IP_BLOCK_SOURCE			72   /* block a source */
477199767fToomas Soome#define	IP_UNBLOCK_SOURCE		73   /* unblock a source */
478199767fToomas Soome
479199767fToomas Soome/* The following option is private; do not use it from user applications. */
480199767fToomas Soome#define	IP_MSFILTER			74   /* set/get filter list */
481199767fToomas Soome
482199767fToomas Soome/* Protocol Independent Multicast API [RFC3678] */
483199767fToomas Soome#define	MCAST_JOIN_GROUP		80   /* join an any-source group */
484199767fToomas Soome#define	MCAST_LEAVE_GROUP		81   /* leave all sources for group */
485199767fToomas Soome#define	MCAST_JOIN_SOURCE_GROUP		82   /* join a source-specific group */
486199767fToomas Soome#define	MCAST_LEAVE_SOURCE_GROUP	83   /* leave a single source */
487199767fToomas Soome#define	MCAST_BLOCK_SOURCE		84   /* block a source */
488199767fToomas Soome#define	MCAST_UNBLOCK_SOURCE		85   /* unblock a source */
489199767fToomas Soome
490199767fToomas Soome/* Flow and RSS definitions */
491199767fToomas Soome#define	IP_FLOWID		90   /* get flow id for the given socket/inp */
492199767fToomas Soome#define	IP_FLOWTYPE		91   /* get flow type (M_HASHTYPE) */
493199767fToomas Soome#define	IP_RSSBUCKETID		92   /* get RSS flowid -> bucket mapping */
494199767fToomas Soome#define	IP_RECVFLOWID		93   /* bool; receive IP flowid/flowtype w/ datagram */
495199767fToomas Soome#define	IP_RECVRSSBUCKETID	94   /* bool; receive IP RSS bucket id w/ datagram */
496199767fToomas Soome
497199767fToomas Soome/*
498199767fToomas Soome * Defaults and limits for options
499199767fToomas Soome */
500199767fToomas Soome#define	IP_DEFAULT_MULTICAST_TTL  1	/* normally limit m'casts to 1 hop  */
501199767fToomas Soome#define	IP_DEFAULT_MULTICAST_LOOP 1	/* normally hear sends if a member  */
502199767fToomas Soome
503199767fToomas Soome/*
504199767fToomas Soome * The imo_membership vector for each socket is now dynamically allocated at
505199767fToomas Soome * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
506199767fToomas Soome * according to a power-of-two increment.
507199767fToomas Soome */
508199767fToomas Soome#define	IP_MIN_MEMBERSHIPS	31
509199767fToomas Soome#define	IP_MAX_MEMBERSHIPS	4095
510199767fToomas Soome#define	IP_MAX_SOURCE_FILTER	1024	/* XXX to be unused */
511199767fToomas Soome
512199767fToomas Soome/*
513199767fToomas Soome * Default resource limits for IPv4 multicast source filtering.
514199767fToomas Soome * These may be modified by sysctl.
515199767fToomas Soome */
516199767fToomas Soome#define	IP_MAX_GROUP_SRC_FILTER		512	/* sources per group */
517199767fToomas Soome#define	IP_MAX_SOCK_SRC_FILTER		128	/* sources per socket/group */
518199767fToomas Soome#define	IP_MAX_SOCK_MUTE_FILTER		128	/* XXX no longer used */
519199767fToomas Soome
520199767fToomas Soome/*
521199767fToomas Soome * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
522199767fToomas Soome */
523199767fToomas Soomestruct ip_mreq {
524199767fToomas Soome	struct	in_addr imr_multiaddr;	/* IP multicast address of group */
525199767fToomas Soome	struct	in_addr imr_interface;	/* local IP address of interface */
526199767fToomas Soome};
527199767fToomas Soome
528199767fToomas Soome/*
529199767fToomas Soome * Modified argument structure for IP_MULTICAST_IF, obtained from Linux.
530199767fToomas Soome * This is used to specify an interface index for multicast sends, as
531199767fToomas Soome * the IPv4 legacy APIs do not support this (unless IP_SENDIF is available).
532199767fToomas Soome */
533199767fToomas Soomestruct ip_mreqn {
534199767fToomas Soome	struct	in_addr imr_multiaddr;	/* IP multicast address of group */
535199767fToomas Soome	struct	in_addr imr_address;	/* local IP address of interface */
536199767fToomas Soome	int		imr_ifindex;	/* Interface index; cast to uint32_t */
537199767fToomas Soome};
538199767fToomas Soome
539199767fToomas Soome/*
540199767fToomas Soome * Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678]
541199767fToomas Soome */
542199767fToomas Soomestruct ip_mreq_source {
543199767fToomas Soome	struct	in_addr imr_multiaddr;	/* IP multicast address of group */
544199767fToomas Soome	struct	in_addr imr_sourceaddr;	/* IP address of source */
545199767fToomas Soome	struct	in_addr imr_interface;	/* local IP address of interface */
546199767fToomas Soome};
547199767fToomas Soome
548199767fToomas Soome/*
549199767fToomas Soome * Argument structures for Protocol-Independent Multicast Source
550199767fToomas Soome * Filter APIs. [RFC3678]
551199767fToomas Soome */
552199767fToomas Soomestruct group_req {
553199767fToomas Soome	uint32_t		gr_interface;	/* interface index */
554199767fToomas Soome	struct sockaddr_storage	gr_group;	/* group address */
555199767fToomas Soome};
556199767fToomas Soome
557199767fToomas Soomestruct group_source_req {
558199767fToomas Soome	uint32_t		gsr_interface;	/* interface index */
559199767fToomas Soome	struct sockaddr_storage	gsr_group;	/* group address */
560199767fToomas Soome	struct sockaddr_storage	gsr_source;	/* source address */
561199767fToomas Soome};
562199767fToomas Soome
563199767fToomas Soome#ifndef __MSFILTERREQ_DEFINED
564199767fToomas Soome#define __MSFILTERREQ_DEFINED
565199767fToomas Soome/*
566199767fToomas Soome * The following structure is private; do not use it from user applications.
567199767fToomas Soome * It is used to communicate IP_MSFILTER/IPV6_MSFILTER information between
568199767fToomas Soome * the RFC 3678 libc functions and the kernel.
569199767fToomas Soome */
570199767fToomas Soomestruct __msfilterreq {
571199767fToomas Soome	uint32_t		 msfr_ifindex;	/* interface index */
572199767fToomas Soome	uint32_t		 msfr_fmode;	/* filter mode for group */
573199767fToomas Soome	uint32_t		 msfr_nsrcs;	/* # of sources in msfr_srcs */
574199767fToomas Soome	struct sockaddr_storage	 msfr_group;	/* group address */
575199767fToomas Soome	struct sockaddr_storage	*msfr_srcs;	/* pointer to the first member
576199767fToomas Soome						 * of a contiguous array of
577199767fToomas Soome						 * sources to filter in full.
578199767fToomas Soome						 */
579199767fToomas Soome};
580199767fToomas Soome#endif
581199767fToomas Soome
582199767fToomas Soomestruct sockaddr;
583199767fToomas Soome
584199767fToomas Soome/*
585199767fToomas Soome * Advanced (Full-state) APIs [RFC3678]
586199767fToomas Soome * The RFC specifies uint_t for the 6th argument to [sg]etsourcefilter().
587199767fToomas Soome * We use uint32_t here to be consistent.
588199767fToomas Soome */
589199767fToomas Soomeint	setipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t,
590199767fToomas Soome	    uint32_t, struct in_addr *);
591199767fToomas Soomeint	getipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t *,
592199767fToomas Soome	    uint32_t *, struct in_addr *);
593199767fToomas Soomeint	setsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
594199767fToomas Soome	    uint32_t, uint32_t, struct sockaddr_storage *);
595199767fToomas Soomeint	getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
596199767fToomas Soome	    uint32_t *, uint32_t *, struct sockaddr_storage *);
597199767fToomas Soome
598199767fToomas Soome/*
599199767fToomas Soome * Filter modes; also used to represent per-socket filter mode internally.
600199767fToomas Soome */
601199767fToomas Soome#define	MCAST_UNDEFINED	0	/* fmode: not yet defined */
602199767fToomas Soome#define	MCAST_INCLUDE	1	/* fmode: include these source(s) */
603199767fToomas Soome#define	MCAST_EXCLUDE	2	/* fmode: exclude these source(s) */
604199767fToomas Soome
605199767fToomas Soome/*
606199767fToomas Soome * Argument for IP_PORTRANGE:
607199767fToomas Soome * - which range to search when port is unspecified at bind() or connect()
608199767fToomas Soome */
609199767fToomas Soome#define	IP_PORTRANGE_DEFAULT	0	/* default range */
610199767fToomas Soome#define	IP_PORTRANGE_HIGH	1	/* "high" - request firewall bypass */
611199767fToomas Soome#define	IP_PORTRANGE_LOW	2	/* "low" - vouchsafe security */
612199767fToomas Soome
613199767fToomas Soome/*
614199767fToomas Soome * Identifiers for IP sysctl nodes
615199767fToomas Soome */
616199767fToomas Soome#define	IPCTL_FORWARDING	1	/* act as router */
617199767fToomas Soome#define	IPCTL_SENDREDIRECTS	2	/* may send redirects when forwarding */
618199767fToomas Soome#define	IPCTL_DEFTTL		3	/* default TTL */
619199767fToomas Soome#ifdef notyet
620199767fToomas Soome#define	IPCTL_DEFMTU		4	/* default MTU */
621199767fToomas Soome#endif
622199767fToomas Soome/*	IPCTL_RTEXPIRE		5	deprecated */
623199767fToomas Soome/*	IPCTL_RTMINEXPIRE	6	deprecated */
624199767fToomas Soome/*	IPCTL_RTMAXCACHE	7	deprecated */
625199767fToomas Soome#define	IPCTL_SOURCEROUTE	8	/* may perform source routes */
626199767fToomas Soome#define	IPCTL_DIRECTEDBROADCAST	9	/* may re-broadcast received packets */
627199767fToomas Soome#define	IPCTL_INTRQMAXLEN	10	/* max length of netisr queue */
628199767fToomas Soome#define	IPCTL_INTRQDROPS	11	/* number of netisr q drops */
629199767fToomas Soome#define	IPCTL_STATS		12	/* ipstat structure */
630199767fToomas Soome#define	IPCTL_ACCEPTSOURCEROUTE	13	/* may accept source routed packets */
631199767fToomas Soome#define	IPCTL_FASTFORWARDING	14	/* use fast IP forwarding code */
632199767fToomas Soome					/* 15, unused, was: IPCTL_KEEPFAITH  */
633199767fToomas Soome#define	IPCTL_GIF_TTL		16	/* default TTL for gif encap packet */
634199767fToomas Soome
635199767fToomas Soome#endif /* __BSD_VISIBLE */
636199767fToomas Soome
637199767fToomas Soome#ifdef _KERNEL
638199767fToomas Soome
639199767fToomas Soomestruct ifnet; struct mbuf;	/* forward declarations for Standard C */
640199767fToomas Soome
641199767fToomas Soomeint	 in_broadcast(struct in_addr, struct ifnet *);
642199767fToomas Soomeint	 in_canforward(struct in_addr);
643199767fToomas Soomeint	 in_localaddr(struct in_addr);
644199767fToomas Soomeint	 in_localip(struct in_addr);
645199767fToomas Soomeint	 in_ifhasaddr(struct ifnet *, struct in_addr);
646199767fToomas Soomeint	 inet_aton(const char *, struct in_addr *); /* in libkern */
647199767fToomas Soomechar	*inet_ntoa(struct in_addr); /* in libkern */
648199767fToomas Soomechar	*inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */
649199767fToomas Soomechar	*inet_ntop(int, const void *, char *, socklen_t); /* in libkern */
650199767fToomas Soomeint	 inet_pton(int af, const char *, void *); /* in libkern */
651199767fToomas Soomevoid	 in_ifdetach(struct ifnet *);
652199767fToomas Soome
653199767fToomas Soome#define	in_hosteq(s, t)	((s).s_addr == (t).s_addr)
654199767fToomas Soome#define	in_nullhost(x)	((x).s_addr == INADDR_ANY)
655199767fToomas Soome#define	in_allhosts(x)	((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP))
656199767fToomas Soome
657199767fToomas Soome#define	satosin(sa)	((struct sockaddr_in *)(sa))
658199767fToomas Soome#define	sintosa(sin)	((struct sockaddr *)(sin))
659199767fToomas Soome#define	ifatoia(ifa)	((struct in_ifaddr *)(ifa))
660199767fToomas Soome#endif /* _KERNEL */
661199767fToomas Soome
662199767fToomas Soome/* INET6 stuff */
663199767fToomas Soome#if __POSIX_VISIBLE >= 200112
664199767fToomas Soome#define	__KAME_NETINET_IN_H_INCLUDED_
665199767fToomas Soome#include <netinet6/in6.h>
666199767fToomas Soome#undef __KAME_NETINET_IN_H_INCLUDED_
667199767fToomas Soome#endif
668199767fToomas Soome
669199767fToomas Soome#endif /* !_NETINET_IN_H_*/
670