207 |
mateuszvis |
1 |
/*!\file netinet/in.h
|
|
|
2 |
* IP address, options and definitions.
|
|
|
3 |
*/
|
|
|
4 |
|
|
|
5 |
/*
|
|
|
6 |
* Copyright (c) 1982, 1986, 1990, 1993
|
|
|
7 |
* The Regents of the University of California. All rights reserved.
|
|
|
8 |
*
|
|
|
9 |
* Redistribution and use in source and binary forms, with or without
|
|
|
10 |
* modification, are permitted provided that the following conditions
|
|
|
11 |
* are met:
|
|
|
12 |
* 1. Redistributions of source code must retain the above copyright
|
|
|
13 |
* notice, this list of conditions and the following disclaimer.
|
|
|
14 |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
15 |
* notice, this list of conditions and the following disclaimer in the
|
|
|
16 |
* documentation and/or other materials provided with the distribution.
|
|
|
17 |
* 3. All advertising materials mentioning features or use of this software
|
|
|
18 |
* must display the following acknowledgement:
|
|
|
19 |
* This product includes software developed by the University of
|
|
|
20 |
* California, Berkeley and its contributors.
|
|
|
21 |
* 4. Neither the name of the University nor the names of its contributors
|
|
|
22 |
* may be used to endorse or promote products derived from this software
|
|
|
23 |
* without specific prior written permission.
|
|
|
24 |
*
|
|
|
25 |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
26 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
27 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
28 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
29 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
30 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
31 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
32 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
33 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
34 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
35 |
* SUCH DAMAGE.
|
|
|
36 |
*
|
|
|
37 |
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
|
|
38 |
* $Id: in.h,v 1.22.2.1 1996/11/11 23:40:37 phk Exp $
|
|
|
39 |
*/
|
|
|
40 |
|
|
|
41 |
#ifndef __NETINET_IN_H
|
|
|
42 |
#define __NETINET_IN_H
|
|
|
43 |
|
|
|
44 |
#ifndef __SYS_SOCKET_H
|
|
|
45 |
#include <sys/socket.h>
|
|
|
46 |
#endif
|
|
|
47 |
|
|
|
48 |
/*
|
|
|
49 |
* Constants and structures defined by the internet system,
|
|
|
50 |
* Per RFC 790, September 1981, and numerous additions.
|
|
|
51 |
*/
|
|
|
52 |
|
|
|
53 |
/*
|
|
|
54 |
* Protocols
|
|
|
55 |
*/
|
|
|
56 |
#define IPPROTO_IP 0 /* dummy for IP */
|
|
|
57 |
#define IPPROTO_ICMP 1 /* control message protocol */
|
|
|
58 |
#define IPPROTO_IGMP 2 /* group mgmt protocol */
|
|
|
59 |
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
|
|
|
60 |
#define IPPROTO_IPIP 4 /* IP encapsulation in IP */
|
|
|
61 |
#define IPPROTO_TCP 6 /* tcp */
|
|
|
62 |
#define IPPROTO_EGP 8 /* exterior gateway protocol */
|
|
|
63 |
#define IPPROTO_IGRP 9 /* interior gw routing protocol */
|
|
|
64 |
#define IPPROTO_PUP 12 /* pup */
|
|
|
65 |
#define IPPROTO_UDP 17 /* user datagram protocol */
|
|
|
66 |
#define IPPROTO_IDP 22 /* xns idp */
|
|
|
67 |
#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
|
|
|
68 |
#define IPPROTO_XTP 36 /* eXpress Transfer Protocol */
|
|
|
69 |
#define IPPROTO_RSVP 46 /* resource reservation */
|
|
|
70 |
#define IPPROTO_ESP 50
|
|
|
71 |
#define IPPROTO_AH 51 /* authenticate header */
|
|
|
72 |
#define IPPROTO_ICMPV6 58 /* ICMP v6 */
|
|
|
73 |
#define IPPROTO_NONE 59
|
|
|
74 |
#define IPPROTO_EON 80 /* ISO cnlp */
|
|
|
75 |
#define IPPROTO_ENCAP 98 /* encapsulation header */
|
|
|
76 |
#define IPPROTO_PIM 103
|
|
|
77 |
#define IPPROTO_VRRP 112
|
|
|
78 |
#define IPPROTO_SCTP 132
|
|
|
79 |
|
|
|
80 |
#define IPPROTO_DIVERT 254 /* divert pseudo-protocol */
|
|
|
81 |
#define IPPROTO_RAW 255 /* raw IP packet */
|
|
|
82 |
#define IPPROTO_MAX 256
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
/*
|
|
|
86 |
* Local port number conventions:
|
|
|
87 |
*
|
|
|
88 |
* When a user does a bind(2) or connect(2) with a port number of zero,
|
|
|
89 |
* a non-conflicting local port address is chosen.
|
|
|
90 |
* The default range is IPPORT_RESERVED through
|
|
|
91 |
* IPPORT_USERRESERVED, although that is settable by sysctl.
|
|
|
92 |
*
|
|
|
93 |
* A user may set the IPPROTO_IP option IP_PORTRANGE to change this
|
|
|
94 |
* default assignment range.
|
|
|
95 |
*
|
|
|
96 |
* The value IP_PORTRANGE_DEFAULT causes the default behavior.
|
|
|
97 |
*
|
|
|
98 |
* The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
|
|
|
99 |
* into the "high" range. These are reserved for client outbound connections
|
|
|
100 |
* which do not want to be filtered by any firewalls.
|
|
|
101 |
*
|
|
|
102 |
* The value IP_PORTRANGE_LOW changes the range to the "low" are
|
|
|
103 |
* that is (by convention) restricted to privileged processes. This
|
|
|
104 |
* convention is based on "vouchsafe" principles only. It is only secure
|
|
|
105 |
* if you trust the remote host to restrict these ports.
|
|
|
106 |
*
|
|
|
107 |
* The default range of ports and the high range can be changed by
|
|
|
108 |
* sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto)
|
|
|
109 |
*
|
|
|
110 |
* Changing those values has bad security implications if you are
|
|
|
111 |
* using a a stateless firewall that is allowing packets outside of that
|
|
|
112 |
* range in order to allow transparent outgoing connections.
|
|
|
113 |
*
|
|
|
114 |
* Such a firewall configuration will generally depend on the use of these
|
|
|
115 |
* default values. If you change them, you may find your Security
|
|
|
116 |
* Administrator looking for you with a heavy object.
|
|
|
117 |
*/
|
|
|
118 |
|
|
|
119 |
/*
|
|
|
120 |
* Ports < IPPORT_RESERVED are reserved for
|
|
|
121 |
* privileged processes (e.g. root). (IP_PORTRANGE_LOW)
|
|
|
122 |
* Ports > IPPORT_USERRESERVED are reserved
|
|
|
123 |
* for servers, not necessarily privileged. (IP_PORTRANGE_DEFAULT)
|
|
|
124 |
*/
|
|
|
125 |
#define IPPORT_RESERVED 1024
|
|
|
126 |
#define IPPORT_USERRESERVED 5000
|
|
|
127 |
|
|
|
128 |
/*
|
|
|
129 |
* Default local port range to use by setting IP_PORTRANGE_HIGH
|
|
|
130 |
*/
|
|
|
131 |
#define IPPORT_HIFIRSTAUTO 40000
|
|
|
132 |
#define IPPORT_HILASTAUTO 44999
|
|
|
133 |
|
|
|
134 |
/*
|
|
|
135 |
* Scanning for a free reserved port return a value below IPPORT_RESERVED,
|
|
|
136 |
* but higher than IPPORT_RESERVEDSTART. Traditionally the start value was
|
|
|
137 |
* 512, but that conflicts with some well-known-services that firewalls may
|
|
|
138 |
* have a fit if we use.
|
|
|
139 |
*/
|
|
|
140 |
#define IPPORT_RESERVEDSTART 600
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
/*
|
|
|
144 |
* Internet address (a structure for historical reasons)
|
|
|
145 |
*/
|
|
|
146 |
struct in_addr {
|
|
|
147 |
u_long s_addr;
|
|
|
148 |
};
|
|
|
149 |
/*
|
|
|
150 |
* For IPv6 from RFC2133
|
|
|
151 |
*/
|
|
|
152 |
struct in6_addr {
|
|
|
153 |
u_int8_t s6_addr[16];
|
|
|
154 |
};
|
|
|
155 |
|
|
|
156 |
/*
|
|
|
157 |
* Definitions of bits in internet address integers.
|
|
|
158 |
* On subnets, the decomposition of addresses to host and net parts
|
|
|
159 |
* is done according to subnet mask, not the masks here.
|
|
|
160 |
*/
|
|
|
161 |
#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
|
|
|
162 |
#define IN_CLASSA_NET 0xff000000
|
|
|
163 |
#define IN_CLASSA_NSHIFT 24
|
|
|
164 |
#define IN_CLASSA_HOST 0x00ffffff
|
|
|
165 |
#define IN_CLASSA_MAX 128
|
|
|
166 |
|
|
|
167 |
#define IN_CLASSB(i) (((long)(i) & 0xC0000000) == 0x80000000)
|
|
|
168 |
#define IN_CLASSB_NET 0xffff0000
|
|
|
169 |
#define IN_CLASSB_NSHIFT 16
|
|
|
170 |
#define IN_CLASSB_HOST 0x0000ffff
|
|
|
171 |
#define IN_CLASSB_MAX 65536
|
|
|
172 |
|
|
|
173 |
#define IN_CLASSC(i) (((long)(i) & 0xE0000000) == 0xC0000000)
|
|
|
174 |
#define IN_CLASSC_NET 0xffffff00
|
|
|
175 |
#define IN_CLASSC_NSHIFT 8
|
|
|
176 |
#define IN_CLASSC_HOST 0x000000ff
|
|
|
177 |
|
|
|
178 |
#define IN_CLASSD(i) (((long)(i) & 0xF0000000) == 0xE0000000)
|
|
|
179 |
#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
|
|
|
180 |
#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
|
|
|
181 |
#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
|
|
|
182 |
#define IN_MULTICAST(i) IN_CLASSD(i)
|
|
|
183 |
|
|
|
184 |
#define IN_EXPERIMENTAL(i) (((long)(i) & 0xF0000000) == 0xF0000000)
|
|
|
185 |
#define IN_BADCLASS(i) (((long)(i) & 0xF0000000) == 0xF0000000)
|
|
|
186 |
|
|
|
187 |
#define INADDR_ANY (u_long)0x00000000
|
|
|
188 |
#define INADDR_BROADCAST (u_long)0xFFFFFFFF /* must be masked */
|
|
|
189 |
#define INADDR_LOOPBACK (u_long)0x7F000001 /* 127.0.0.1 */
|
|
|
190 |
#define INADDR_NONE 0xFFFFFFFF /* -1 return */
|
|
|
191 |
|
|
|
192 |
#define INADDR_UNSPEC_GROUP (u_long)0xE0000000 /* 224.0.0.0 */
|
|
|
193 |
#define INADDR_ALLHOSTS_GROUP (u_long)0xE0000001 /* 224.0.0.1 */
|
|
|
194 |
#define INADDR_ALLRTRS_GROUP (u_long)0xE0000002 /* 224.0.0.2 */
|
|
|
195 |
#define INADDR_MAX_LOCAL_GROUP (u_long)0xE00000FF /* 224.0.0.255 */
|
|
|
196 |
|
|
|
197 |
#define IN_LOOPBACKNET 127 /* official! */
|
|
|
198 |
|
|
|
199 |
W32_DATA const struct in6_addr in6addr_any; /* :: */
|
|
|
200 |
W32_DATA const struct in6_addr in6addr_loopback; /* ::1 */
|
|
|
201 |
|
|
|
202 |
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
|
|
|
203 |
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
|
|
|
204 |
|
|
|
205 |
#define INET_ADDRSTRLEN 16
|
|
|
206 |
#define INET6_ADDRSTRLEN 46
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
/*
|
|
|
210 |
* Socket address, internet style.
|
|
|
211 |
*/
|
|
|
212 |
struct sockaddr_in {
|
|
|
213 |
u_short sin_family;
|
|
|
214 |
u_short sin_port;
|
|
|
215 |
struct in_addr sin_addr;
|
|
|
216 |
char sin_zero[8];
|
|
|
217 |
};
|
|
|
218 |
|
|
|
219 |
struct sockaddr_in6 {
|
|
|
220 |
u_int16_t sin6_family;
|
|
|
221 |
u_int16_t sin6_port;
|
|
|
222 |
u_int32_t sin6_flowinfo;
|
|
|
223 |
struct in6_addr sin6_addr;
|
|
|
224 |
u_int32_t sin6_scope_id; /* IPv6 scope-id */
|
|
|
225 |
};
|
|
|
226 |
|
|
|
227 |
/*
|
|
|
228 |
* Stolen from winsock2.h (hope this is portable)
|
|
|
229 |
* Portable IPv6/IPv4 version of sockaddr.
|
|
|
230 |
* Uses padding to force 8 byte alignment
|
|
|
231 |
* and maximum size of 128 bytes
|
|
|
232 |
*/
|
|
|
233 |
struct sockaddr_storage {
|
|
|
234 |
u_short ss_family;
|
|
|
235 |
u_short ss_len; /* !! added for BSD progs, gv Nov-2003 */
|
|
|
236 |
char __ss_pad1[6]; /* pad to 8 */
|
|
|
237 |
long __ss_align1, __ssalign2; /* force alignment */
|
|
|
238 |
char __ss_pad2[110]; /* pad to 128 */
|
|
|
239 |
};
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
/* IPv6 multicast request. */
|
|
|
243 |
struct ipv6_mreq {
|
|
|
244 |
/* IPv6 multicast address of group */
|
|
|
245 |
struct in6_addr ipv6mr_multiaddr;
|
|
|
246 |
|
|
|
247 |
/* local interface */
|
|
|
248 |
unsigned long ipv6mr_interface;
|
|
|
249 |
};
|
|
|
250 |
|
|
|
251 |
/*
|
|
|
252 |
* Structure used to describe IP options.
|
|
|
253 |
* Used to store options internally, to pass them to a process,
|
|
|
254 |
* or to restore options retrieved earlier.
|
|
|
255 |
* The ip_dst is used for the first-hop gateway when using a source route
|
|
|
256 |
* (this gets put into the header proper).
|
|
|
257 |
*/
|
|
|
258 |
struct ip_opts {
|
|
|
259 |
struct in_addr ip_dst; /* first hop, 0 w/o src rt */
|
|
|
260 |
char IP_opts[40]; /* actually variable in size */
|
|
|
261 |
};
|
|
|
262 |
|
|
|
263 |
/*
|
|
|
264 |
* Options for use with [gs]etsockopt at the IP level.
|
|
|
265 |
* First word of comment is data type; bool is stored in int.
|
|
|
266 |
*/
|
|
|
267 |
#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
|
|
|
268 |
#define IP_HDRINCL 2 /* int; header is included with data */
|
|
|
269 |
#define IP_TOS 3 /* int; IP type of service and preced. */
|
|
|
270 |
#define IP_TTL 4 /* int; IP time to live */
|
|
|
271 |
#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
|
|
|
272 |
#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
|
|
|
273 |
#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
|
|
|
274 |
#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
|
|
|
275 |
#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */
|
|
|
276 |
#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
|
|
|
277 |
#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
|
|
|
278 |
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
|
|
|
279 |
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
|
|
|
280 |
#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */
|
|
|
281 |
#define IP_RSVP_ON 15 /* enable RSVP in kernel */
|
|
|
282 |
#define IP_RSVP_OFF 16 /* disable RSVP in kernel */
|
|
|
283 |
#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */
|
|
|
284 |
#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */
|
|
|
285 |
#define IP_PORTRANGE 19 /* int; range to choose for unspec port */
|
|
|
286 |
#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
|
|
|
287 |
|
|
|
288 |
#define IP_FW_ADD 50 /* add a firewall rule to chain */
|
|
|
289 |
#define IP_FW_DEL 51 /* delete a firewall rule from chain */
|
|
|
290 |
#define IP_FW_FLUSH 52 /* flush firewall rule chain */
|
|
|
291 |
#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */
|
|
|
292 |
#define IP_FW_GET 54 /* get entire firewall rule chain */
|
|
|
293 |
#define IP_NAT 55 /* set/get NAT opts */
|
|
|
294 |
|
|
|
295 |
/*
|
|
|
296 |
* Defaults and limits for options
|
|
|
297 |
*/
|
|
|
298 |
#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
|
|
|
299 |
#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
|
|
|
300 |
#define IP_MAX_MEMBERSHIPS 20 /* per socket */
|
|
|
301 |
|
|
|
302 |
/*
|
|
|
303 |
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
|
|
|
304 |
*/
|
|
|
305 |
struct ip_mreq {
|
|
|
306 |
struct in_addr imr_multiaddr; /* IP multicast address of group */
|
|
|
307 |
struct in_addr imr_interface; /* local IP address of interface */
|
|
|
308 |
};
|
|
|
309 |
|
|
|
310 |
/*
|
|
|
311 |
* Argument for IP_PORTRANGE:
|
|
|
312 |
* - which range to search when port is unspecified at bind() or connect()
|
|
|
313 |
*/
|
|
|
314 |
#define IP_PORTRANGE_DEFAULT 0 /* default range */
|
|
|
315 |
#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
|
|
|
316 |
#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
|
|
|
317 |
|
|
|
318 |
/*
|
|
|
319 |
* Definitions for inet sysctl operations.
|
|
|
320 |
*
|
|
|
321 |
* Third level is protocol number.
|
|
|
322 |
* Fourth level is desired variable within that protocol.
|
|
|
323 |
*/
|
|
|
324 |
#define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */
|
|
|
325 |
|
|
|
326 |
#define CTL_IPPROTO_NAMES { \
|
|
|
327 |
{ "ip", CTLTYPE_NODE }, \
|
|
|
328 |
{ "icmp", CTLTYPE_NODE }, \
|
|
|
329 |
{ "igmp", CTLTYPE_NODE }, \
|
|
|
330 |
{ "ggp", CTLTYPE_NODE }, \
|
|
|
331 |
{ 0, 0 }, \
|
|
|
332 |
{ 0, 0 }, \
|
|
|
333 |
{ "tcp", CTLTYPE_NODE }, \
|
|
|
334 |
{ 0, 0 }, \
|
|
|
335 |
{ "egp", CTLTYPE_NODE }, \
|
|
|
336 |
{ 0, 0 }, \
|
|
|
337 |
{ 0, 0 }, \
|
|
|
338 |
{ 0, 0 }, \
|
|
|
339 |
{ "pup", CTLTYPE_NODE }, \
|
|
|
340 |
{ 0, 0 }, \
|
|
|
341 |
{ 0, 0 }, \
|
|
|
342 |
{ 0, 0 }, \
|
|
|
343 |
{ 0, 0 }, \
|
|
|
344 |
{ "udp", CTLTYPE_NODE }, \
|
|
|
345 |
{ 0, 0 }, \
|
|
|
346 |
{ 0, 0 }, \
|
|
|
347 |
{ 0, 0 }, \
|
|
|
348 |
{ 0, 0 }, \
|
|
|
349 |
{ "idp", CTLTYPE_NODE }, \
|
|
|
350 |
}
|
|
|
351 |
|
|
|
352 |
/*
|
|
|
353 |
* Names for IP sysctl objects
|
|
|
354 |
*/
|
|
|
355 |
#define IPCTL_FORWARDING 1 /* act as router */
|
|
|
356 |
#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
|
|
|
357 |
#define IPCTL_DEFTTL 3 /* default TTL */
|
|
|
358 |
#define IPCTL_DEFMTU 4 /* default MTU */
|
|
|
359 |
#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */
|
|
|
360 |
#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */
|
|
|
361 |
#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */
|
|
|
362 |
#define IPCTL_SOURCEROUTE 8 /* may perform source routes */
|
|
|
363 |
#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */
|
|
|
364 |
#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */
|
|
|
365 |
#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */
|
|
|
366 |
#define IPCTL_MAXID 12
|
|
|
367 |
|
|
|
368 |
#define IPCTL_NAMES { \
|
|
|
369 |
{ 0, 0 }, \
|
|
|
370 |
{ "forwarding", CTLTYPE_INT }, \
|
|
|
371 |
{ "redirect", CTLTYPE_INT }, \
|
|
|
372 |
{ "ttl", CTLTYPE_INT }, \
|
|
|
373 |
{ "mtu", CTLTYPE_INT }, \
|
|
|
374 |
{ "rtexpire", CTLTYPE_INT }, \
|
|
|
375 |
{ "rtminexpire", CTLTYPE_INT }, \
|
|
|
376 |
{ "rtmaxcache", CTLTYPE_INT }, \
|
|
|
377 |
{ "sourceroute", CTLTYPE_INT }, \
|
|
|
378 |
{ "directed-broadcast", CTLTYPE_INT }, \
|
|
|
379 |
{ "intr-queue-maxlen", CTLTYPE_INT }, \
|
|
|
380 |
{ "intr-queue-drops", CTLTYPE_INT }, \
|
|
|
381 |
}
|
|
|
382 |
|
|
|
383 |
|
|
|
384 |
/*
|
|
|
385 |
* IPv6 address macros
|
|
|
386 |
*/
|
|
|
387 |
#define IN6_IS_ADDR_UNSPECIFIED(a) \
|
|
|
388 |
(((u_int32_t*)(a))[0] == 0 \
|
|
|
389 |
&& ((u_int32_t*)(a))[1] == 0 \
|
|
|
390 |
&& ((u_int32_t*)(a))[2] == 0 \
|
|
|
391 |
&& ((u_int32_t*)(a))[3] == 0)
|
|
|
392 |
|
|
|
393 |
#define IN6_IS_ADDR_LOOPBACK(a) \
|
|
|
394 |
(((u_int32_t*)(a))[0] == 0 \
|
|
|
395 |
&& ((u_int32_t*)(a))[1] == 0 \
|
|
|
396 |
&& ((u_int32_t*)(a))[2] == 0 \
|
|
|
397 |
&& ((u_int32_t*)(a))[3] == htonl (1))
|
|
|
398 |
|
|
|
399 |
#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t*) (a))[0] == 0xff)
|
|
|
400 |
|
|
|
401 |
#define IN6_IS_ADDR_LINKLOCAL(a) \
|
|
|
402 |
((((u_int32_t*)(a))[0] & htonl(0xffc00000)) == htonl(0xfe800000))
|
|
|
403 |
|
|
|
404 |
#define IN6_IS_ADDR_SITELOCAL(a) \
|
|
|
405 |
((((u_int32_t*)(a))[0] & htonl(0xffc00000)) == htonl(0xfec00000))
|
|
|
406 |
|
|
|
407 |
#define IN6_IS_ADDR_V4MAPPED(a) \
|
|
|
408 |
((((u_int32_t*)(a))[0] == 0) \
|
|
|
409 |
&& (((u_int32_t*)(a))[1] == 0) \
|
|
|
410 |
&& (((u_int32_t*)(a))[2] == htonl(0xffff)))
|
|
|
411 |
|
|
|
412 |
#define IN6_IS_ADDR_V4COMPAT(a) \
|
|
|
413 |
((((u_int32_t*)(a))[0] == 0) \
|
|
|
414 |
&& (((u_int32_t*)(a))[1] == 0) \
|
|
|
415 |
&& (((u_int32_t*)(a))[2] == 0) \
|
|
|
416 |
&& (ntohl(((u_int32_t*)(a))[3]) > 1))
|
|
|
417 |
|
|
|
418 |
#define IN6_ARE_ADDR_EQUAL(a,b) \
|
|
|
419 |
((((u_int32_t*)(a))[0] == ((u_int32_t*)(b))[0]) \
|
|
|
420 |
&& (((u_int32_t*)(a))[1] == ((u_int32_t*)(b))[1]) \
|
|
|
421 |
&& (((u_int32_t*)(a))[2] == ((u_int32_t*)(b))[2]) \
|
|
|
422 |
&& (((u_int32_t*)(a))[3] == ((u_int32_t*)(b))[3]))
|
|
|
423 |
|
|
|
424 |
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
|
|
|
425 |
(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t*)(a))[1] & 0xf) == 0x1))
|
|
|
426 |
|
|
|
427 |
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
|
|
|
428 |
(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t*)(a))[1] & 0xf) == 0x2))
|
|
|
429 |
|
|
|
430 |
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
|
|
|
431 |
(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t*)(a))[1] & 0xf) == 0x5))
|
|
|
432 |
|
|
|
433 |
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
|
|
|
434 |
(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t*)(a))[1] & 0xf) == 0x8))
|
|
|
435 |
|
|
|
436 |
#define IN6_IS_ADDR_MC_GLOBAL(a) \
|
|
|
437 |
(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t*)(a))[1] & 0xf) == 0xe))
|
|
|
438 |
|
|
|
439 |
#endif /* __NETINET_IN_H */
|
|
|
440 |
|