Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/netinet/in.h
+++ new/usr/src/uts/common/netinet/in.h
1 1 /*
2 2 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
3 3 * Use is subject to license terms.
4 4 *
5 5 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
6 6 */
7 7 /*
8 8 * Copyright (c) 1982, 1986 Regents of the University of California.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms are permitted
12 12 * provided that this notice is preserved and that due credit is given
13 13 * to the University of California at Berkeley. The name of the University
14 14 * may not be used to endorse or promote products derived from this
15 15 * software without specific prior written permission. This software
16 16 * is provided ``as is'' without express or implied warranty.
17 17 */
18 18
19 19 /*
20 20 * Constants and structures defined by the internet system,
21 21 * according to following documents
22 22 *
23 23 * Internet ASSIGNED NUMBERS (RFC1700) and its successors:
24 24 * http://www.iana.org/assignments/protocol-numbers
25 25 * http://www.iana.org/assignments/port-numbers
26 26 * Basic Socket Interface Extensions for IPv6 (RFC2133 and its successors)
27 27 *
28 28 */
29 29
30 30 #ifndef _NETINET_IN_H
31 31 #define _NETINET_IN_H
32 32
33 33 #include <sys/feature_tests.h>
34 34
35 35 #ifdef __cplusplus
36 36 extern "C" {
37 37 #endif
38 38
39 39 #include <sys/types.h>
40 40
41 41 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
42 42 #include <sys/socket_impl.h>
43 43 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
44 44
45 45 #ifndef _SOCKLEN_T
46 46 #define _SOCKLEN_T
47 47
48 48 /*
49 49 * The socklen definitions are reproduced here from sys/socket.h so as to
50 50 * not introduce that namespace into existing users of netinet/in.h.
51 51 */
52 52 #if defined(_XPG4_2) && !defined(_XPG5) && !defined(_LP64)
53 53 typedef size_t socklen_t;
54 54 #else
55 55 typedef uint32_t socklen_t;
56 56 #endif /* defined(_XPG4_2) && !defined(_XPG5) && !defined(_LP64) */
57 57
58 58 #if defined(_XPG4_2) || defined(_BOOT)
59 59 typedef socklen_t *Psocklen_t;
60 60 #else
61 61 typedef void *Psocklen_t;
62 62 #endif /* defined(_XPG4_2) || defined(_BOOT) */
63 63
64 64 #endif /* _SOCKLEN_T */
65 65
66 66 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
67 67 #include <sys/stream.h>
68 68 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
69 69 /*
70 70 * Symbols such as htonl() are required to be exposed through this file,
71 71 * per XNS Issue 5. This is achieved by inclusion of <sys/byteorder.h>
72 72 */
73 73 #if !defined(_XPG4_2) || defined(__EXTENSIONS__) || defined(_XPG5)
74 74 #include <sys/byteorder.h>
75 75 #endif
76 76
77 77 #ifndef _IN_PORT_T
78 78 #define _IN_PORT_T
79 79 typedef uint16_t in_port_t;
80 80 #endif
81 81
82 82 /*
83 83 * Note: IPv4 address data structures usage conventions.
84 84 * The "in_addr_t" type below (required by Unix standards)
85 85 * is NOT a typedef of "struct in_addr" and violates the usual
86 86 * conventions where "struct <name>" and <name>_t are corresponding
87 87 * typedefs.
88 88 * To minimize confusion, kernel data structures/usage prefers use
89 89 * of "ipaddr_t" as atomic uint32_t type and avoid using "in_addr_t"
90 90 * The user level APIs continue to follow the historic popular
91 91 * practice of using "struct in_addr".
92 92 */
93 93 #ifndef _IN_ADDR_T
94 94 #define _IN_ADDR_T
95 95 typedef uint32_t in_addr_t;
96 96 #endif
97 97
98 98 #ifndef _IPADDR_T
99 99 #define _IPADDR_T
100 100 typedef uint32_t ipaddr_t;
101 101 #endif
102 102
103 103 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
104 104
105 105 struct in6_addr {
106 106 union {
107 107 /*
108 108 * Note: Static initalizers of "union" type assume
109 109 * the constant on the RHS is the type of the first member
110 110 * of union.
111 111 * To make static initializers (and efficient usage) work,
112 112 * the order of members exposed to user and kernel view of
113 113 * this data structure is different.
114 114 * User environment sees specified uint8_t type as first
115 115 * member whereas kernel sees most efficient type as
116 116 * first member.
117 117 */
118 118 #ifdef _KERNEL
119 119 uint32_t _S6_u32[4]; /* IPv6 address */
120 120 uint8_t _S6_u8[16]; /* IPv6 address */
121 121 #else
122 122 uint8_t _S6_u8[16]; /* IPv6 address */
123 123 uint32_t _S6_u32[4]; /* IPv6 address */
124 124 #endif
125 125 uint32_t __S6_align; /* Align on 32 bit boundary */
126 126 } _S6_un;
127 127 };
128 128 #define s6_addr _S6_un._S6_u8
129 129
130 130 #ifdef _KERNEL
131 131 #define s6_addr8 _S6_un._S6_u8
132 132 #define s6_addr32 _S6_un._S6_u32
133 133 #endif
134 134
135 135 typedef struct in6_addr in6_addr_t;
136 136
137 137 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
138 138
139 139 #ifndef _SA_FAMILY_T
140 140 #define _SA_FAMILY_T
141 141 typedef uint16_t sa_family_t;
142 142 #endif
143 143
144 144 /*
145 145 * Protocols
146 146 *
147 147 * Some of these constant names are copied for the DTrace IP provider in
148 148 * usr/src/lib/libdtrace/common/{ip.d.in, ip.sed.in}, which should be kept
149 149 * in sync.
150 150 */
151 151 #define IPPROTO_IP 0 /* dummy for IP */
152 152 #define IPPROTO_HOPOPTS 0 /* Hop by hop header for IPv6 */
153 153 #define IPPROTO_ICMP 1 /* control message protocol */
154 154 #define IPPROTO_IGMP 2 /* group control protocol */
155 155 #define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
156 156 #define IPPROTO_ENCAP 4 /* IP in IP encapsulation */
157 157 #define IPPROTO_TCP 6 /* tcp */
158 158 #define IPPROTO_EGP 8 /* exterior gateway protocol */
159 159 #define IPPROTO_PUP 12 /* pup */
160 160 #define IPPROTO_UDP 17 /* user datagram protocol */
161 161 #define IPPROTO_IDP 22 /* xns idp */
162 162 #define IPPROTO_IPV6 41 /* IPv6 encapsulated in IP */
163 163 #define IPPROTO_ROUTING 43 /* Routing header for IPv6 */
164 164 #define IPPROTO_FRAGMENT 44 /* Fragment header for IPv6 */
165 165 #define IPPROTO_RSVP 46 /* rsvp */
166 166 #define IPPROTO_ESP 50 /* IPsec Encap. Sec. Payload */
167 167 #define IPPROTO_AH 51 /* IPsec Authentication Hdr. */
168 168 #define IPPROTO_ICMPV6 58 /* ICMP for IPv6 */
169 169 #define IPPROTO_NONE 59 /* No next header for IPv6 */
170 170 #define IPPROTO_DSTOPTS 60 /* Destination options */
171 171 #define IPPROTO_HELLO 63 /* "hello" routing protocol */
172 172 #define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */
173 173 #define IPPROTO_EON 80 /* ISO clnp */
174 174 #define IPPROTO_OSPF 89 /* OSPF */
175 175 #define IPPROTO_PIM 103 /* PIM routing protocol */
176 176 #define IPPROTO_SCTP 132 /* Stream Control */
177 177 /* Transmission Protocol */
178 178
179 179 #define IPPROTO_RAW 255 /* raw IP packet */
180 180 #define IPPROTO_MAX 256
181 181
182 182 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
183 183 #define PROTO_SDP 257 /* Sockets Direct Protocol */
184 184 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
185 185
186 186 /*
187 187 * Port/socket numbers: network standard functions
188 188 *
189 189 * Entries should exist here for each port number compiled into an ON
190 190 * component, such as snoop.
191 191 */
192 192 #define IPPORT_ECHO 7
193 193 #define IPPORT_DISCARD 9
194 194 #define IPPORT_SYSTAT 11
195 195 #define IPPORT_DAYTIME 13
196 196 #define IPPORT_NETSTAT 15
197 197 #define IPPORT_CHARGEN 19
198 198 #define IPPORT_FTP 21
199 199 #define IPPORT_TELNET 23
200 200 #define IPPORT_SMTP 25
201 201 #define IPPORT_TIMESERVER 37
202 202 #define IPPORT_NAMESERVER 42
203 203 #define IPPORT_WHOIS 43
204 204 #define IPPORT_DOMAIN 53
205 205 #define IPPORT_MDNS 5353
206 206 #define IPPORT_MTP 57
207 207
208 208 /*
209 209 * Port/socket numbers: host specific functions
210 210 */
211 211 #define IPPORT_BOOTPS 67
212 212 #define IPPORT_BOOTPC 68
213 213 #define IPPORT_TFTP 69
214 214 #define IPPORT_RJE 77
215 215 #define IPPORT_FINGER 79
216 216 #define IPPORT_HTTP 80
217 217 #define IPPORT_HTTP_ALT 8080
218 218 #define IPPORT_TTYLINK 87
219 219 #define IPPORT_SUPDUP 95
220 220 #define IPPORT_NTP 123
221 221 #define IPPORT_NETBIOS_NS 137
222 222 #define IPPORT_NETBIOS_DGM 138
223 223 #define IPPORT_NETBIOS_SSN 139
224 224 #define IPPORT_LDAP 389
225 225 #define IPPORT_SLP 427
226 226 #define IPPORT_MIP 434
227 227 #define IPPORT_SMB 445 /* a.k.a. microsoft-ds */
228 228
229 229 /*
230 230 * Internet Key Exchange (IKE) ports
231 231 */
232 232 #define IPPORT_IKE 500
233 233 #define IPPORT_IKE_NATT 4500
234 234
235 235 /*
236 236 * UNIX TCP sockets
237 237 */
238 238 #define IPPORT_EXECSERVER 512
239 239 #define IPPORT_LOGINSERVER 513
240 240 #define IPPORT_CMDSERVER 514
241 241 #define IPPORT_PRINTER 515
242 242 #define IPPORT_EFSSERVER 520
243 243
244 244 /*
245 245 * UNIX UDP sockets
246 246 */
247 247 #define IPPORT_BIFFUDP 512
248 248 #define IPPORT_WHOSERVER 513
249 249 #define IPPORT_SYSLOG 514
250 250 #define IPPORT_TALK 517
251 251 #define IPPORT_ROUTESERVER 520
252 252 #define IPPORT_RIPNG 521
253 253
254 254 /*
255 255 * DHCPv6 UDP ports
256 256 */
257 257 #define IPPORT_DHCPV6C 546
258 258 #define IPPORT_DHCPV6S 547
259 259
260 260 #define IPPORT_SOCKS 1080
261 261
262 262 /*
263 263 * Ports < IPPORT_RESERVED are reserved for
264 264 * privileged processes (e.g. root).
265 265 * Ports > IPPORT_USERRESERVED are reserved
266 266 * for servers, not necessarily privileged.
267 267 */
268 268 #define IPPORT_RESERVED 1024
269 269 #define IPPORT_USERRESERVED 5000
270 270
271 271 /*
272 272 * Link numbers
273 273 */
274 274 #define IMPLINK_IP 155
275 275 #define IMPLINK_LOWEXPER 156
276 276 #define IMPLINK_HIGHEXPER 158
277 277
278 278 /*
279 279 * IPv4 Internet address
280 280 * This definition contains obsolete fields for compatibility
281 281 * with SunOS 3.x and 4.2bsd. The presence of subnets renders
282 282 * divisions into fixed fields misleading at best. New code
283 283 * should use only the s_addr field.
284 284 */
285 285
286 286 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
287 287 #define _S_un_b S_un_b
288 288 #define _S_un_w S_un_w
289 289 #define _S_addr S_addr
290 290 #define _S_un S_un
291 291 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
292 292
293 293 struct in_addr {
294 294 union {
295 295 struct { uint8_t s_b1, s_b2, s_b3, s_b4; } _S_un_b;
296 296 struct { uint16_t s_w1, s_w2; } _S_un_w;
297 297 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
298 298 uint32_t _S_addr;
299 299 #else
300 300 in_addr_t _S_addr;
301 301 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
302 302 } _S_un;
303 303 #define s_addr _S_un._S_addr /* should be used for all code */
304 304 #define s_host _S_un._S_un_b.s_b2 /* OBSOLETE: host on imp */
305 305 #define s_net _S_un._S_un_b.s_b1 /* OBSOLETE: network */
306 306 #define s_imp _S_un._S_un_w.s_w2 /* OBSOLETE: imp */
307 307 #define s_impno _S_un._S_un_b.s_b4 /* OBSOLETE: imp # */
308 308 #define s_lh _S_un._S_un_b.s_b3 /* OBSOLETE: logical host */
309 309 };
310 310
311 311 /*
312 312 * Definitions of bits in internet address integers.
313 313 * On subnets, the decomposition of addresses to host and net parts
314 314 * is done according to subnet mask, not the masks here.
315 315 *
316 316 * Note that with the introduction of CIDR, IN_CLASSA, IN_CLASSB,
317 317 * IN_CLASSC, IN_CLASSD and IN_CLASSE macros have become "de-facto
318 318 * obsolete". IN_MULTICAST macro should be used to test if a address
319 319 * is a multicast address.
320 320 */
321 321 #define IN_CLASSA(i) (((i) & 0x80000000U) == 0)
322 322 #define IN_CLASSA_NET 0xff000000U
323 323 #define IN_CLASSA_NSHIFT 24
324 324 #define IN_CLASSA_HOST 0x00ffffffU
325 325 #define IN_CLASSA_MAX 128
326 326
327 327 #define IN_CLASSB(i) (((i) & 0xc0000000U) == 0x80000000U)
328 328 #define IN_CLASSB_NET 0xffff0000U
329 329 #define IN_CLASSB_NSHIFT 16
330 330 #define IN_CLASSB_HOST 0x0000ffffU
331 331 #define IN_CLASSB_MAX 65536
332 332
333 333 #define IN_CLASSC(i) (((i) & 0xe0000000U) == 0xc0000000U)
334 334 #define IN_CLASSC_NET 0xffffff00U
335 335 #define IN_CLASSC_NSHIFT 8
336 336 #define IN_CLASSC_HOST 0x000000ffU
337 337
338 338 #define IN_CLASSD(i) (((i) & 0xf0000000U) == 0xe0000000U)
339 339 #define IN_CLASSD_NET 0xf0000000U /* These aren't really */
340 340 #define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
341 341 #define IN_CLASSD_HOST 0x0fffffffU /* routing needn't know */
342 342
343 343 #define IN_CLASSE(i) (((i) & 0xf0000000U) == 0xf0000000U)
344 344 #define IN_CLASSE_NET 0xffffffffU
345 345
346 346 #define IN_MULTICAST(i) IN_CLASSD(i)
347 347
348 348 /*
349 349 * We have removed CLASS E checks from the kernel
350 350 * But we preserve these defines for userland in order
351 351 * to avoid compile breakage of some 3rd party piece of software
352 352 */
353 353 #ifndef _KERNEL
354 354 #define IN_EXPERIMENTAL(i) (((i) & 0xe0000000U) == 0xe0000000U)
355 355 #define IN_BADCLASS(i) (((i) & 0xf0000000U) == 0xf0000000U)
356 356 #endif
357 357
358 358 #define INADDR_ANY 0x00000000U
359 359 #define INADDR_LOOPBACK 0x7F000001U
360 360 #define INADDR_BROADCAST 0xffffffffU /* must be masked */
361 361 #define INADDR_NONE 0xffffffffU
362 362
363 363 #define INADDR_UNSPEC_GROUP 0xe0000000U /* 224.0.0.0 */
364 364 #define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */
365 365 #define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */
366 366 #define INADDR_ALLRPTS_GROUP 0xe0000016U /* 224.0.0.22, IGMPv3 */
367 367 #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */
368 368
369 369 /* Scoped IPv4 prefixes (in host byte-order) */
370 370 #define IN_AUTOCONF_NET 0xa9fe0000U /* 169.254/16 */
371 371 #define IN_AUTOCONF_MASK 0xffff0000U
372 372 #define IN_PRIVATE8_NET 0x0a000000U /* 10/8 */
373 373 #define IN_PRIVATE8_MASK 0xff000000U
374 374 #define IN_PRIVATE12_NET 0xac100000U /* 172.16/12 */
375 375 #define IN_PRIVATE12_MASK 0xfff00000U
376 376 #define IN_PRIVATE16_NET 0xc0a80000U /* 192.168/16 */
377 377 #define IN_PRIVATE16_MASK 0xffff0000U
378 378
379 379 /* RFC 3927 IPv4 link local address (i in host byte-order) */
380 380 #define IN_LINKLOCAL(i) (((i) & IN_AUTOCONF_MASK) == IN_AUTOCONF_NET)
381 381
382 382 /* Well known 6to4 Relay Router Anycast address defined in RFC 3068 */
383 383 #if !defined(_XPG4_2) || !defined(__EXTENSIONS__)
384 384 #define INADDR_6TO4RRANYCAST 0xc0586301U /* 192.88.99.1 */
385 385 #endif /* !defined(_XPG4_2) || !defined(__EXTENSIONS__) */
386 386
387 387 #define IN_LOOPBACKNET 127 /* official! */
388 388
389 389 /*
390 390 * Define a macro to stuff the loopback address into an Internet address
391 391 */
392 392 #if !defined(_XPG4_2) || !defined(__EXTENSIONS__)
393 393 #define IN_SET_LOOPBACK_ADDR(a) \
394 394 { (a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \
395 395 (a)->sin_family = AF_INET; }
396 396 #endif /* !defined(_XPG4_2) || !defined(__EXTENSIONS__) */
397 397
398 398 /*
399 399 * IPv4 Socket address.
400 400 */
401 401 struct sockaddr_in {
402 402 sa_family_t sin_family;
403 403 in_port_t sin_port;
404 404 struct in_addr sin_addr;
405 405 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
406 406 char sin_zero[8];
407 407 #else
408 408 unsigned char sin_zero[8];
409 409 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
410 410 };
411 411
412 412 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
413 413 /*
414 414 * IPv6 socket address.
415 415 */
416 416 struct sockaddr_in6 {
417 417 sa_family_t sin6_family;
418 418 in_port_t sin6_port;
419 419 uint32_t sin6_flowinfo;
420 420 struct in6_addr sin6_addr;
421 421 uint32_t sin6_scope_id; /* Depends on scope of sin6_addr */
422 422 uint32_t __sin6_src_id; /* Impl. specific - UDP replies */
423 423 };
424 424
425 425 /*
426 426 * Macros for accessing the traffic class and flow label fields from
427 427 * sin6_flowinfo.
428 428 * These are designed to be applied to a 32-bit value.
429 429 */
430 430 #ifdef _BIG_ENDIAN
431 431
432 432 /* masks */
433 433 #define IPV6_FLOWINFO_FLOWLABEL 0x000fffffU
434 434 #define IPV6_FLOWINFO_TCLASS 0x0ff00000U
435 435
436 436 #else /* _BIG_ENDIAN */
437 437
438 438 /* masks */
439 439 #define IPV6_FLOWINFO_FLOWLABEL 0xffff0f00U
440 440 #define IPV6_FLOWINFO_TCLASS 0x0000f00fU
441 441
442 442 #endif /* _BIG_ENDIAN */
443 443
444 444 /*
445 445 * Note: Macros IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT are for
446 446 * use as RHS of Static initializers of "struct in6_addr" (or in6_addr_t)
↓ open down ↓ |
446 lines elided |
↑ open up ↑ |
447 447 * only. They need to be different for User/Kernel versions because union
448 448 * component data structure is defined differently (it is identical at
449 449 * binary representation level).
450 450 *
451 451 * const struct in6_addr IN6ADDR_ANY_INIT;
452 452 * const struct in6_addr IN6ADDR_LOOPBACK_INIT;
453 453 */
454 454
455 455
456 456 #ifdef _KERNEL
457 -#define IN6ADDR_ANY_INIT { 0, 0, 0, 0 }
457 +#define IN6ADDR_ANY_INIT {{{ 0, 0, 0, 0 }}}
458 458
459 459 #ifdef _BIG_ENDIAN
460 -#define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0x00000001U }
460 +#define IN6ADDR_LOOPBACK_INIT {{{ 0, 0, 0, 0x00000001U }}}
461 461 #else /* _BIG_ENDIAN */
462 -#define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0x01000000U }
462 +#define IN6ADDR_LOOPBACK_INIT {{{ 0, 0, 0, 0x01000000U }}}
463 463 #endif /* _BIG_ENDIAN */
464 464
465 465 #else
466 466
467 -#define IN6ADDR_ANY_INIT { 0, 0, 0, 0, \
467 +#define IN6ADDR_ANY_INIT {{{ 0, 0, 0, 0, \
468 468 0, 0, 0, 0, \
469 469 0, 0, 0, 0, \
470 - 0, 0, 0, 0 }
470 + 0, 0, 0, 0 }}}
471 471
472 -#define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \
472 +#define IN6ADDR_LOOPBACK_INIT {{{ 0, 0, 0, 0, \
473 473 0, 0, 0, 0, \
474 474 0, 0, 0, 0, \
475 - 0, 0, 0, 0x1U }
475 + 0, 0, 0, 0x1U }}}
476 476 #endif /* _KERNEL */
477 477
478 478 /*
479 479 * RFC 2553 specifies the following macros. Their type is defined
480 480 * as "int" in the RFC but they only have boolean significance
481 481 * (zero or non-zero). For the purposes of our comment notation,
482 482 * we assume a hypothetical type "bool" defined as follows to
483 483 * write the prototypes assumed for macros in our comments better.
484 484 *
485 485 * typedef int bool;
486 486 */
487 487
488 488 /*
489 489 * IN6 macros used to test for special IPv6 addresses
490 490 * (Mostly from spec)
491 491 *
492 492 * bool IN6_IS_ADDR_UNSPECIFIED (const struct in6_addr *);
493 493 * bool IN6_IS_ADDR_LOOPBACK (const struct in6_addr *);
494 494 * bool IN6_IS_ADDR_MULTICAST (const struct in6_addr *);
495 495 * bool IN6_IS_ADDR_LINKLOCAL (const struct in6_addr *);
496 496 * bool IN6_IS_ADDR_SITELOCAL (const struct in6_addr *);
497 497 * bool IN6_IS_ADDR_V4MAPPED (const struct in6_addr *);
498 498 * bool IN6_IS_ADDR_V4MAPPED_ANY(const struct in6_addr *); -- Not from RFC2553
499 499 * bool IN6_IS_ADDR_V4COMPAT (const struct in6_addr *);
500 500 * bool IN6_IS_ADDR_MC_RESERVED (const struct in6_addr *); -- Not from RFC2553
501 501 * bool IN6_IS_ADDR_MC_NODELOCAL(const struct in6_addr *);
502 502 * bool IN6_IS_ADDR_MC_LINKLOCAL(const struct in6_addr *);
503 503 * bool IN6_IS_ADDR_MC_SITELOCAL(const struct in6_addr *);
504 504 * bool IN6_IS_ADDR_MC_ORGLOCAL (const struct in6_addr *);
505 505 * bool IN6_IS_ADDR_MC_GLOBAL (const struct in6_addr *);
506 506 * bool IN6_IS_ADDR_6TO4 (const struct in6_addr *); -- Not from RFC2553
507 507 * bool IN6_ARE_6TO4_PREFIX_EQUAL(const struct in6_addr *,
508 508 * const struct in6_addr *); -- Not from RFC2553
509 509 * bool IN6_IS_ADDR_LINKSCOPE (const struct in6addr *); -- Not from RFC2553
510 510 */
511 511
512 512 #define IN6_IS_ADDR_UNSPECIFIED(addr) \
513 513 (((addr)->_S6_un._S6_u32[3] == 0) && \
514 514 ((addr)->_S6_un._S6_u32[2] == 0) && \
515 515 ((addr)->_S6_un._S6_u32[1] == 0) && \
516 516 ((addr)->_S6_un._S6_u32[0] == 0))
517 517
518 518 #ifdef _BIG_ENDIAN
519 519 #define IN6_IS_ADDR_LOOPBACK(addr) \
520 520 (((addr)->_S6_un._S6_u32[3] == 0x00000001) && \
521 521 ((addr)->_S6_un._S6_u32[2] == 0) && \
522 522 ((addr)->_S6_un._S6_u32[1] == 0) && \
523 523 ((addr)->_S6_un._S6_u32[0] == 0))
524 524 #else /* _BIG_ENDIAN */
525 525 #define IN6_IS_ADDR_LOOPBACK(addr) \
526 526 (((addr)->_S6_un._S6_u32[3] == 0x01000000) && \
527 527 ((addr)->_S6_un._S6_u32[2] == 0) && \
528 528 ((addr)->_S6_un._S6_u32[1] == 0) && \
529 529 ((addr)->_S6_un._S6_u32[0] == 0))
530 530 #endif /* _BIG_ENDIAN */
531 531
532 532 #ifdef _BIG_ENDIAN
533 533 #define IN6_IS_ADDR_MULTICAST(addr) \
534 534 (((addr)->_S6_un._S6_u32[0] & 0xff000000) == 0xff000000)
535 535 #else /* _BIG_ENDIAN */
536 536 #define IN6_IS_ADDR_MULTICAST(addr) \
537 537 (((addr)->_S6_un._S6_u32[0] & 0x000000ff) == 0x000000ff)
538 538 #endif /* _BIG_ENDIAN */
539 539
540 540 #ifdef _BIG_ENDIAN
541 541 #define IN6_IS_ADDR_LINKLOCAL(addr) \
542 542 (((addr)->_S6_un._S6_u32[0] & 0xffc00000) == 0xfe800000)
543 543 #else /* _BIG_ENDIAN */
544 544 #define IN6_IS_ADDR_LINKLOCAL(addr) \
545 545 (((addr)->_S6_un._S6_u32[0] & 0x0000c0ff) == 0x000080fe)
546 546 #endif /* _BIG_ENDIAN */
547 547
548 548 #ifdef _BIG_ENDIAN
549 549 #define IN6_IS_ADDR_SITELOCAL(addr) \
550 550 (((addr)->_S6_un._S6_u32[0] & 0xffc00000) == 0xfec00000)
551 551 #else /* _BIG_ENDIAN */
552 552 #define IN6_IS_ADDR_SITELOCAL(addr) \
553 553 (((addr)->_S6_un._S6_u32[0] & 0x0000c0ff) == 0x0000c0fe)
554 554 #endif /* _BIG_ENDIAN */
555 555
556 556 #ifdef _BIG_ENDIAN
557 557 #define IN6_IS_ADDR_V4MAPPED(addr) \
558 558 (((addr)->_S6_un._S6_u32[2] == 0x0000ffff) && \
559 559 ((addr)->_S6_un._S6_u32[1] == 0) && \
560 560 ((addr)->_S6_un._S6_u32[0] == 0))
561 561 #else /* _BIG_ENDIAN */
562 562 #define IN6_IS_ADDR_V4MAPPED(addr) \
563 563 (((addr)->_S6_un._S6_u32[2] == 0xffff0000U) && \
564 564 ((addr)->_S6_un._S6_u32[1] == 0) && \
565 565 ((addr)->_S6_un._S6_u32[0] == 0))
566 566 #endif /* _BIG_ENDIAN */
567 567
568 568 /*
569 569 * IN6_IS_ADDR_V4MAPPED - A IPv4 mapped INADDR_ANY
570 570 * Note: This macro is currently NOT defined in RFC2553 specification
571 571 * and not a standard macro that portable applications should use.
572 572 */
573 573 #ifdef _BIG_ENDIAN
574 574 #define IN6_IS_ADDR_V4MAPPED_ANY(addr) \
575 575 (((addr)->_S6_un._S6_u32[3] == 0) && \
576 576 ((addr)->_S6_un._S6_u32[2] == 0x0000ffff) && \
577 577 ((addr)->_S6_un._S6_u32[1] == 0) && \
578 578 ((addr)->_S6_un._S6_u32[0] == 0))
579 579 #else /* _BIG_ENDIAN */
580 580 #define IN6_IS_ADDR_V4MAPPED_ANY(addr) \
581 581 (((addr)->_S6_un._S6_u32[3] == 0) && \
582 582 ((addr)->_S6_un._S6_u32[2] == 0xffff0000U) && \
583 583 ((addr)->_S6_un._S6_u32[1] == 0) && \
584 584 ((addr)->_S6_un._S6_u32[0] == 0))
585 585 #endif /* _BIG_ENDIAN */
586 586
587 587 /* Exclude loopback and unspecified address */
588 588 #ifdef _BIG_ENDIAN
589 589 #define IN6_IS_ADDR_V4COMPAT(addr) \
590 590 (((addr)->_S6_un._S6_u32[2] == 0) && \
591 591 ((addr)->_S6_un._S6_u32[1] == 0) && \
592 592 ((addr)->_S6_un._S6_u32[0] == 0) && \
593 593 !((addr)->_S6_un._S6_u32[3] == 0) && \
594 594 !((addr)->_S6_un._S6_u32[3] == 0x00000001))
595 595
596 596 #else /* _BIG_ENDIAN */
597 597 #define IN6_IS_ADDR_V4COMPAT(addr) \
598 598 (((addr)->_S6_un._S6_u32[2] == 0) && \
599 599 ((addr)->_S6_un._S6_u32[1] == 0) && \
600 600 ((addr)->_S6_un._S6_u32[0] == 0) && \
601 601 !((addr)->_S6_un._S6_u32[3] == 0) && \
602 602 !((addr)->_S6_un._S6_u32[3] == 0x01000000))
603 603 #endif /* _BIG_ENDIAN */
604 604
605 605 /*
606 606 * Note:
607 607 * IN6_IS_ADDR_MC_RESERVED macro is currently NOT defined in RFC2553
608 608 * specification and not a standard macro that portable applications
609 609 * should use.
610 610 */
611 611 #ifdef _BIG_ENDIAN
612 612 #define IN6_IS_ADDR_MC_RESERVED(addr) \
613 613 (((addr)->_S6_un._S6_u32[0] & 0xff0f0000) == 0xff000000)
614 614
615 615 #else /* _BIG_ENDIAN */
616 616 #define IN6_IS_ADDR_MC_RESERVED(addr) \
617 617 (((addr)->_S6_un._S6_u32[0] & 0x00000fff) == 0x000000ff)
618 618 #endif /* _BIG_ENDIAN */
619 619
620 620 #ifdef _BIG_ENDIAN
621 621 #define IN6_IS_ADDR_MC_NODELOCAL(addr) \
622 622 (((addr)->_S6_un._S6_u32[0] & 0xff0f0000) == 0xff010000)
623 623 #else /* _BIG_ENDIAN */
624 624 #define IN6_IS_ADDR_MC_NODELOCAL(addr) \
625 625 (((addr)->_S6_un._S6_u32[0] & 0x00000fff) == 0x000001ff)
626 626 #endif /* _BIG_ENDIAN */
627 627
628 628 #ifdef _BIG_ENDIAN
629 629 #define IN6_IS_ADDR_MC_LINKLOCAL(addr) \
630 630 (((addr)->_S6_un._S6_u32[0] & 0xff0f0000) == 0xff020000)
631 631 #else /* _BIG_ENDIAN */
632 632 #define IN6_IS_ADDR_MC_LINKLOCAL(addr) \
633 633 (((addr)->_S6_un._S6_u32[0] & 0x00000fff) == 0x000002ff)
634 634 #endif /* _BIG_ENDIAN */
635 635
636 636 #ifdef _BIG_ENDIAN
637 637 #define IN6_IS_ADDR_MC_SITELOCAL(addr) \
638 638 (((addr)->_S6_un._S6_u32[0] & 0xff0f0000) == 0xff050000)
639 639 #else /* _BIG_ENDIAN */
640 640 #define IN6_IS_ADDR_MC_SITELOCAL(addr) \
641 641 (((addr)->_S6_un._S6_u32[0] & 0x00000fff) == 0x000005ff)
642 642 #endif /* _BIG_ENDIAN */
643 643
644 644 #ifdef _BIG_ENDIAN
645 645 #define IN6_IS_ADDR_MC_ORGLOCAL(addr) \
646 646 (((addr)->_S6_un._S6_u32[0] & 0xff0f0000) == 0xff080000)
647 647 #else /* _BIG_ENDIAN */
648 648 #define IN6_IS_ADDR_MC_ORGLOCAL(addr) \
649 649 (((addr)->_S6_un._S6_u32[0] & 0x00000fff) == 0x000008ff)
650 650 #endif /* _BIG_ENDIAN */
651 651
652 652 #ifdef _BIG_ENDIAN
653 653 #define IN6_IS_ADDR_MC_GLOBAL(addr) \
654 654 (((addr)->_S6_un._S6_u32[0] & 0xff0f0000) == 0xff0e0000)
655 655 #else /* _BIG_ENDIAN */
656 656 #define IN6_IS_ADDR_MC_GLOBAL(addr) \
657 657 (((addr)->_S6_un._S6_u32[0] & 0x00000fff) == 0x00000eff)
658 658 #endif /* _BIG_ENDIAN */
659 659
660 660 /*
661 661 * The IN6_IS_ADDR_MC_SOLICITEDNODE macro is not defined in any standard or
662 662 * RFC, and shouldn't be used by portable applications. It is used to see
663 663 * if an address is a solicited-node multicast address, which is prefixed
664 664 * with ff02:0:0:0:0:1:ff00::/104.
665 665 */
666 666 #ifdef _BIG_ENDIAN
667 667 #define IN6_IS_ADDR_MC_SOLICITEDNODE(addr) \
668 668 (((addr)->_S6_un._S6_u32[0] == 0xff020000) && \
669 669 ((addr)->_S6_un._S6_u32[1] == 0x00000000) && \
670 670 ((addr)->_S6_un._S6_u32[2] == 0x00000001) && \
671 671 (((addr)->_S6_un._S6_u32[3] & 0xff000000) == 0xff000000))
672 672 #else
673 673 #define IN6_IS_ADDR_MC_SOLICITEDNODE(addr) \
674 674 (((addr)->_S6_un._S6_u32[0] == 0x000002ff) && \
675 675 ((addr)->_S6_un._S6_u32[1] == 0x00000000) && \
676 676 ((addr)->_S6_un._S6_u32[2] == 0x01000000) && \
677 677 (((addr)->_S6_un._S6_u32[3] & 0x000000ff) == 0x000000ff))
678 678 #endif
679 679
680 680 /*
681 681 * Macros to a) test for 6to4 IPv6 address, and b) to test if two
682 682 * 6to4 addresses have the same /48 prefix, and, hence, are from the
683 683 * same 6to4 site.
684 684 */
685 685
686 686 #ifdef _BIG_ENDIAN
687 687 #define IN6_IS_ADDR_6TO4(addr) \
688 688 (((addr)->_S6_un._S6_u32[0] & 0xffff0000) == 0x20020000)
689 689 #else /* _BIG_ENDIAN */
690 690 #define IN6_IS_ADDR_6TO4(addr) \
691 691 (((addr)->_S6_un._S6_u32[0] & 0x0000ffff) == 0x00000220)
692 692 #endif /* _BIG_ENDIAN */
693 693
694 694 #define IN6_ARE_6TO4_PREFIX_EQUAL(addr1, addr2) \
695 695 (((addr1)->_S6_un._S6_u32[0] == (addr2)->_S6_un._S6_u32[0]) && \
696 696 ((addr1)->_S6_un._S6_u8[4] == (addr2)->_S6_un._S6_u8[4]) && \
697 697 ((addr1)->_S6_un._S6_u8[5] == (addr2)->_S6_un._S6_u8[5]))
698 698
699 699 /*
700 700 * IN6_IS_ADDR_LINKSCOPE
701 701 * Identifies an address as being either link-local, link-local multicast or
702 702 * node-local multicast. All types of addresses are considered to be unique
703 703 * within the scope of a given link.
704 704 */
705 705 #define IN6_IS_ADDR_LINKSCOPE(addr) \
706 706 (IN6_IS_ADDR_LINKLOCAL(addr) || IN6_IS_ADDR_MC_LINKLOCAL(addr) || \
707 707 IN6_IS_ADDR_MC_NODELOCAL(addr))
708 708
709 709 /*
710 710 * Useful utility macros for operations with IPv6 addresses
711 711 * Note: These macros are NOT defined in the RFC2553 or any other
712 712 * standard specification and are not standard macros that portable
713 713 * applications should use.
714 714 */
715 715
716 716 /*
717 717 * IN6_V4MAPPED_TO_INADDR
718 718 * IN6_V4MAPPED_TO_IPADDR
719 719 * Assign a IPv4-Mapped IPv6 address to an IPv4 address.
720 720 * Note: These macros are NOT defined in RFC2553 or any other standard
721 721 * specification and are not macros that portable applications should
722 722 * use.
723 723 *
724 724 * void IN6_V4MAPPED_TO_INADDR(const in6_addr_t *v6, struct in_addr *v4);
725 725 * void IN6_V4MAPPED_TO_IPADDR(const in6_addr_t *v6, ipaddr_t v4);
726 726 *
727 727 */
728 728 #define IN6_V4MAPPED_TO_INADDR(v6, v4) \
729 729 ((v4)->s_addr = (v6)->_S6_un._S6_u32[3])
730 730 #define IN6_V4MAPPED_TO_IPADDR(v6, v4) \
731 731 ((v4) = (v6)->_S6_un._S6_u32[3])
732 732
733 733 /*
734 734 * IN6_INADDR_TO_V4MAPPED
735 735 * IN6_IPADDR_TO_V4MAPPED
736 736 * Assign a IPv4 address address to an IPv6 address as a IPv4-mapped
737 737 * address.
738 738 * Note: These macros are NOT defined in RFC2553 or any other standard
739 739 * specification and are not macros that portable applications should
740 740 * use.
741 741 *
742 742 * void IN6_INADDR_TO_V4MAPPED(const struct in_addr *v4, in6_addr_t *v6);
743 743 * void IN6_IPADDR_TO_V4MAPPED(const ipaddr_t v4, in6_addr_t *v6);
744 744 *
745 745 */
746 746 #ifdef _BIG_ENDIAN
747 747 #define IN6_INADDR_TO_V4MAPPED(v4, v6) \
748 748 ((v6)->_S6_un._S6_u32[3] = (v4)->s_addr, \
749 749 (v6)->_S6_un._S6_u32[2] = 0x0000ffff, \
750 750 (v6)->_S6_un._S6_u32[1] = 0, \
751 751 (v6)->_S6_un._S6_u32[0] = 0)
752 752 #define IN6_IPADDR_TO_V4MAPPED(v4, v6) \
753 753 ((v6)->_S6_un._S6_u32[3] = (v4), \
754 754 (v6)->_S6_un._S6_u32[2] = 0x0000ffff, \
755 755 (v6)->_S6_un._S6_u32[1] = 0, \
756 756 (v6)->_S6_un._S6_u32[0] = 0)
757 757 #else /* _BIG_ENDIAN */
758 758 #define IN6_INADDR_TO_V4MAPPED(v4, v6) \
759 759 ((v6)->_S6_un._S6_u32[3] = (v4)->s_addr, \
760 760 (v6)->_S6_un._S6_u32[2] = 0xffff0000U, \
761 761 (v6)->_S6_un._S6_u32[1] = 0, \
762 762 (v6)->_S6_un._S6_u32[0] = 0)
763 763 #define IN6_IPADDR_TO_V4MAPPED(v4, v6) \
764 764 ((v6)->_S6_un._S6_u32[3] = (v4), \
765 765 (v6)->_S6_un._S6_u32[2] = 0xffff0000U, \
766 766 (v6)->_S6_un._S6_u32[1] = 0, \
767 767 (v6)->_S6_un._S6_u32[0] = 0)
768 768 #endif /* _BIG_ENDIAN */
769 769
770 770 /*
771 771 * IN6_6TO4_TO_V4ADDR
772 772 * Extract the embedded IPv4 address from the prefix to a 6to4 IPv6
773 773 * address.
774 774 * Note: This macro is NOT defined in RFC2553 or any other standard
775 775 * specification and is not a macro that portable applications should
776 776 * use.
777 777 * Note: we don't use the IPADDR form of the macro because we need
778 778 * to do a bytewise copy; the V4ADDR in the 6to4 address is not
779 779 * 32-bit aligned.
780 780 *
781 781 * void IN6_6TO4_TO_V4ADDR(const in6_addr_t *v6, struct in_addr *v4);
782 782 *
783 783 */
784 784 #define IN6_6TO4_TO_V4ADDR(v6, v4) \
785 785 ((v4)->_S_un._S_un_b.s_b1 = (v6)->_S6_un._S6_u8[2], \
786 786 (v4)->_S_un._S_un_b.s_b2 = (v6)->_S6_un._S6_u8[3], \
787 787 (v4)->_S_un._S_un_b.s_b3 = (v6)->_S6_un._S6_u8[4], \
788 788 (v4)->_S_un._S_un_b.s_b4 = (v6)->_S6_un._S6_u8[5])
789 789
790 790 /*
791 791 * IN6_V4ADDR_TO_6TO4
792 792 * Given an IPv4 address and an IPv6 address for output, a 6to4 address
793 793 * will be created from the IPv4 Address.
794 794 * Note: This method for creating 6to4 addresses is not standardized
795 795 * outside of Solaris. The newly created 6to4 address will be of the form
796 796 * 2002:<V4ADDR>:<SUBNETID>::<HOSTID>, where SUBNETID will equal 0 and
797 797 * HOSTID will equal 1.
798 798 *
799 799 * void IN6_V4ADDR_TO_6TO4(const struct in_addr *v4, in6_addr_t *v6)
800 800 *
801 801 */
802 802 #ifdef _BIG_ENDIAN
803 803 #define IN6_V4ADDR_TO_6TO4(v4, v6) \
804 804 ((v6)->_S6_un._S6_u8[0] = 0x20, \
805 805 (v6)->_S6_un._S6_u8[1] = 0x02, \
806 806 (v6)->_S6_un._S6_u8[2] = (v4)->_S_un._S_un_b.s_b1, \
807 807 (v6)->_S6_un._S6_u8[3] = (v4)->_S_un._S_un_b.s_b2, \
808 808 (v6)->_S6_un._S6_u8[4] = (v4)->_S_un._S_un_b.s_b3, \
809 809 (v6)->_S6_un._S6_u8[5] = (v4)->_S_un._S_un_b.s_b4, \
810 810 (v6)->_S6_un._S6_u8[6] = 0, \
811 811 (v6)->_S6_un._S6_u8[7] = 0, \
812 812 (v6)->_S6_un._S6_u32[2] = 0, \
813 813 (v6)->_S6_un._S6_u32[3] = 0x00000001U)
814 814 #else
815 815 #define IN6_V4ADDR_TO_6TO4(v4, v6) \
816 816 ((v6)->_S6_un._S6_u8[0] = 0x20, \
817 817 (v6)->_S6_un._S6_u8[1] = 0x02, \
818 818 (v6)->_S6_un._S6_u8[2] = (v4)->_S_un._S_un_b.s_b1, \
819 819 (v6)->_S6_un._S6_u8[3] = (v4)->_S_un._S_un_b.s_b2, \
820 820 (v6)->_S6_un._S6_u8[4] = (v4)->_S_un._S_un_b.s_b3, \
821 821 (v6)->_S6_un._S6_u8[5] = (v4)->_S_un._S_un_b.s_b4, \
822 822 (v6)->_S6_un._S6_u8[6] = 0, \
823 823 (v6)->_S6_un._S6_u8[7] = 0, \
824 824 (v6)->_S6_un._S6_u32[2] = 0, \
825 825 (v6)->_S6_un._S6_u32[3] = 0x01000000U)
826 826 #endif /* _BIG_ENDIAN */
827 827
828 828 /*
829 829 * IN6_ARE_ADDR_EQUAL (defined in RFC2292)
830 830 * Compares if IPv6 addresses are equal.
831 831 * Note: Compares in order of high likelyhood of a miss so we minimize
832 832 * compares. (Current heuristic order, compare in reverse order of
833 833 * uint32_t units)
834 834 *
835 835 * bool IN6_ARE_ADDR_EQUAL(const struct in6_addr *,
836 836 * const struct in6_addr *);
837 837 */
838 838 #define IN6_ARE_ADDR_EQUAL(addr1, addr2) \
839 839 (((addr1)->_S6_un._S6_u32[3] == (addr2)->_S6_un._S6_u32[3]) && \
840 840 ((addr1)->_S6_un._S6_u32[2] == (addr2)->_S6_un._S6_u32[2]) && \
841 841 ((addr1)->_S6_un._S6_u32[1] == (addr2)->_S6_un._S6_u32[1]) && \
842 842 ((addr1)->_S6_un._S6_u32[0] == (addr2)->_S6_un._S6_u32[0]))
843 843
844 844 /*
845 845 * IN6_ARE_PREFIXEDADDR_EQUAL (not defined in RFCs)
846 846 * Compares if prefixed parts of IPv6 addresses are equal.
847 847 *
848 848 * uint32_t IN6_MASK_FROM_PREFIX(int, int);
849 849 * bool IN6_ARE_PREFIXEDADDR_EQUAL(const struct in6_addr *,
850 850 * const struct in6_addr *,
851 851 * int);
852 852 */
853 853 #define IN6_MASK_FROM_PREFIX(qoctet, prefix) \
854 854 ((((qoctet) + 1) * 32 < (prefix)) ? 0xFFFFFFFFu : \
855 855 ((((qoctet) * 32) >= (prefix)) ? 0x00000000u : \
856 856 0xFFFFFFFFu << (((qoctet) + 1) * 32 - (prefix))))
857 857
858 858 #define IN6_ARE_PREFIXEDADDR_EQUAL(addr1, addr2, prefix) \
859 859 (((ntohl((addr1)->_S6_un._S6_u32[0]) & \
860 860 IN6_MASK_FROM_PREFIX(0, prefix)) == \
861 861 (ntohl((addr2)->_S6_un._S6_u32[0]) & \
862 862 IN6_MASK_FROM_PREFIX(0, prefix))) && \
863 863 ((ntohl((addr1)->_S6_un._S6_u32[1]) & \
864 864 IN6_MASK_FROM_PREFIX(1, prefix)) == \
865 865 (ntohl((addr2)->_S6_un._S6_u32[1]) & \
866 866 IN6_MASK_FROM_PREFIX(1, prefix))) && \
867 867 ((ntohl((addr1)->_S6_un._S6_u32[2]) & \
868 868 IN6_MASK_FROM_PREFIX(2, prefix)) == \
869 869 (ntohl((addr2)->_S6_un._S6_u32[2]) & \
870 870 IN6_MASK_FROM_PREFIX(2, prefix))) && \
871 871 ((ntohl((addr1)->_S6_un._S6_u32[3]) & \
872 872 IN6_MASK_FROM_PREFIX(3, prefix)) == \
873 873 (ntohl((addr2)->_S6_un._S6_u32[3]) & \
874 874 IN6_MASK_FROM_PREFIX(3, prefix))))
875 875
876 876 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
877 877
878 878
879 879 /*
880 880 * Options for use with [gs]etsockopt at the IP level.
881 881 *
882 882 * Note: Some of the IP_ namespace has conflict with and
883 883 * and is exposed through <xti.h>. (It also requires exposing
884 884 * options not implemented). The options with potential
885 885 * for conflicts use #ifndef guards.
886 886 */
887 887 #ifndef IP_OPTIONS
888 888 #define IP_OPTIONS 1 /* set/get IP per-packet options */
889 889 #endif
890 890
891 891 #define IP_HDRINCL 2 /* int; header is included with data (raw) */
892 892
893 893 #ifndef IP_TOS
894 894 #define IP_TOS 3 /* int; IP type of service and precedence */
895 895 #endif
896 896
897 897 #ifndef IP_TTL
898 898 #define IP_TTL 4 /* int; IP time to live */
899 899 #endif
900 900
901 901 #define IP_RECVOPTS 0x5 /* int; receive all IP options w/datagram */
902 902 #define IP_RECVRETOPTS 0x6 /* int; receive IP options for response */
903 903 #define IP_RECVDSTADDR 0x7 /* int; receive IP dst addr w/datagram */
904 904 #define IP_RETOPTS 0x8 /* ip_opts; set/get IP per-packet options */
905 905 #define IP_RECVIF 0x9 /* int; receive the inbound interface index */
906 906 #define IP_RECVSLLA 0xa /* sockaddr_dl; get source link layer address */
907 907 #define IP_RECVTTL 0xb /* uint8_t; get TTL for inbound packet */
908 908
909 909 #define IP_MULTICAST_IF 0x10 /* set/get IP multicast interface */
910 910 #define IP_MULTICAST_TTL 0x11 /* set/get IP multicast timetolive */
911 911 #define IP_MULTICAST_LOOP 0x12 /* set/get IP multicast loopback */
912 912 #define IP_ADD_MEMBERSHIP 0x13 /* add an IP group membership */
913 913 #define IP_DROP_MEMBERSHIP 0x14 /* drop an IP group membership */
914 914 #define IP_BLOCK_SOURCE 0x15 /* block mcast pkts from source */
915 915 #define IP_UNBLOCK_SOURCE 0x16 /* unblock mcast pkts from source */
916 916 #define IP_ADD_SOURCE_MEMBERSHIP 0x17 /* add mcast group/source pair */
917 917 #define IP_DROP_SOURCE_MEMBERSHIP 0x18 /* drop mcast group/source pair */
918 918 #define IP_NEXTHOP 0x19 /* send directly to next hop */
919 919 /*
920 920 * IP_PKTINFO and IP_RECVPKTINFO have same value. Size of argument passed in
921 921 * is used to differentiate b/w the two.
922 922 */
923 923 #define IP_PKTINFO 0x1a /* specify src address and/or index */
924 924 #define IP_RECVPKTINFO 0x1a /* recv dest/matched addr and index */
925 925 #define IP_DONTFRAG 0x1b /* don't fragment packets */
926 926
927 927 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
928 928 /*
929 929 * Different preferences that can be requested from IPSEC protocols.
930 930 */
931 931 #define IP_SEC_OPT 0x22 /* Used to set IPSEC options */
932 932 #define IPSEC_PREF_NEVER 0x01
933 933 #define IPSEC_PREF_REQUIRED 0x02
934 934 #define IPSEC_PREF_UNIQUE 0x04
935 935 /*
936 936 * This can be used with the setsockopt() call to set per socket security
937 937 * options. When the application uses per-socket API, we will reflect
938 938 * the request on both outbound and inbound packets.
939 939 */
940 940
941 941 typedef struct ipsec_req {
942 942 uint_t ipsr_ah_req; /* AH request */
943 943 uint_t ipsr_esp_req; /* ESP request */
944 944 uint_t ipsr_self_encap_req; /* Self-Encap request */
945 945 uint8_t ipsr_auth_alg; /* Auth algs for AH */
946 946 uint8_t ipsr_esp_alg; /* Encr algs for ESP */
947 947 uint8_t ipsr_esp_auth_alg; /* Auth algs for ESP */
948 948 } ipsec_req_t;
949 949
950 950 /*
951 951 * MCAST_* options are protocol-independent. The actual definitions
952 952 * are with the v6 options below; this comment is here to note the
953 953 * namespace usage.
954 954 *
955 955 * #define MCAST_JOIN_GROUP 0x29
956 956 * #define MCAST_LEAVE_GROUP 0x2a
957 957 * #define MCAST_BLOCK_SOURCE 0x2b
958 958 * #define MCAST_UNBLOCK_SOURCE 0x2c
959 959 * #define MCAST_JOIN_SOURCE_GROUP 0x2d
960 960 * #define MCAST_LEAVE_SOURCE_GROUP 0x2e
961 961 */
962 962 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
963 963
964 964 /*
965 965 * SunOS private (potentially not portable) IP_ option names
966 966 */
967 967 #define IP_BOUND_IF 0x41 /* bind socket to an ifindex */
968 968 #define IP_UNSPEC_SRC 0x42 /* use unspecified source address */
969 969 #define IP_BROADCAST_TTL 0x43 /* use specific TTL for broadcast */
970 970 /* can be reused 0x44 */
971 971 #define IP_DHCPINIT_IF 0x45 /* accept all unicast DHCP traffic */
972 972
973 973 /*
974 974 * Option values and names (when !_XPG5) shared with <xti_inet.h>
975 975 */
976 976 #ifndef IP_REUSEADDR
977 977 #define IP_REUSEADDR 0x104
978 978 #endif
979 979
980 980 #ifndef IP_DONTROUTE
981 981 #define IP_DONTROUTE 0x105
982 982 #endif
983 983
984 984 #ifndef IP_BROADCAST
985 985 #define IP_BROADCAST 0x106
986 986 #endif
987 987
988 988 /*
989 989 * The following option values are reserved by <xti_inet.h>
990 990 *
991 991 * T_IP_OPTIONS 0x107 - IP per-packet options
992 992 * T_IP_TOS 0x108 - IP per packet type of service
993 993 */
994 994
995 995 /*
996 996 * Default value constants for multicast attributes controlled by
997 997 * IP*_MULTICAST_LOOP and IP*_MULTICAST_{TTL,HOPS} options.
998 998 */
999 999 #define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
1000 1000 #define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
1001 1001
1002 1002 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
1003 1003 /*
1004 1004 * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
1005 1005 */
1006 1006 struct ip_mreq {
1007 1007 struct in_addr imr_multiaddr; /* IP multicast address of group */
1008 1008 struct in_addr imr_interface; /* local IP address of interface */
1009 1009 };
1010 1010
1011 1011 /*
1012 1012 * Argument structure for IP_BLOCK_SOURCE, IP_UNBLOCK_SOURCE,
1013 1013 * IP_ADD_SOURCE_MEMBERSHIP, and IP_DROP_SOURCE_MEMBERSHIP.
1014 1014 */
1015 1015 struct ip_mreq_source {
1016 1016 struct in_addr imr_multiaddr; /* IP address of group */
1017 1017 struct in_addr imr_sourceaddr; /* IP address of source */
1018 1018 struct in_addr imr_interface; /* IP address of interface */
1019 1019 };
1020 1020
1021 1021 /*
1022 1022 * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP on
1023 1023 * IPv6 addresses.
1024 1024 */
1025 1025 struct ipv6_mreq {
1026 1026 struct in6_addr ipv6mr_multiaddr; /* IPv6 multicast addr */
1027 1027 unsigned int ipv6mr_interface; /* interface index */
1028 1028 };
1029 1029
1030 1030 /*
1031 1031 * Use #pragma pack() construct to force 32-bit alignment on amd64.
1032 1032 * This is needed to keep the structure size and offsets consistent
1033 1033 * between a 32-bit app and the 64-bit amd64 kernel in structures
1034 1034 * where 64-bit alignment would create gaps (in this case, structures
1035 1035 * which have a uint32_t followed by a struct sockaddr_storage).
1036 1036 */
1037 1037 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1038 1038 #pragma pack(4)
1039 1039 #endif
1040 1040
1041 1041 /*
1042 1042 * Argument structure for MCAST_JOIN_GROUP and MCAST_LEAVE_GROUP.
1043 1043 */
1044 1044 struct group_req {
1045 1045 uint32_t gr_interface; /* interface index */
1046 1046 struct sockaddr_storage gr_group; /* group address */
1047 1047 };
1048 1048
1049 1049 /*
1050 1050 * Argument structure for MCAST_BLOCK_SOURCE, MCAST_UNBLOCK_SOURCE,
1051 1051 * MCAST_JOIN_SOURCE_GROUP, MCAST_LEAVE_SOURCE_GROUP.
1052 1052 */
1053 1053 struct group_source_req {
1054 1054 uint32_t gsr_interface; /* interface index */
1055 1055 struct sockaddr_storage gsr_group; /* group address */
1056 1056 struct sockaddr_storage gsr_source; /* source address */
1057 1057 };
1058 1058
1059 1059 /*
1060 1060 * Argument for SIOC[GS]MSFILTER ioctls
1061 1061 */
1062 1062 struct group_filter {
1063 1063 uint32_t gf_interface; /* interface index */
1064 1064 struct sockaddr_storage gf_group; /* multicast address */
1065 1065 uint32_t gf_fmode; /* filter mode */
1066 1066 uint32_t gf_numsrc; /* number of sources */
1067 1067 struct sockaddr_storage gf_slist[1]; /* source address */
1068 1068 };
1069 1069
1070 1070 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1071 1071 #pragma pack()
1072 1072 #endif
1073 1073
1074 1074 #define GROUP_FILTER_SIZE(numsrc) \
1075 1075 (sizeof (struct group_filter) - sizeof (struct sockaddr_storage) \
1076 1076 + (numsrc) * sizeof (struct sockaddr_storage))
1077 1077
1078 1078 /*
1079 1079 * Argument for SIOC[GS]IPMSFILTER ioctls (IPv4-specific)
1080 1080 */
1081 1081 struct ip_msfilter {
1082 1082 struct in_addr imsf_multiaddr; /* IP multicast address of group */
1083 1083 struct in_addr imsf_interface; /* local IP address of interface */
1084 1084 uint32_t imsf_fmode; /* filter mode */
1085 1085 uint32_t imsf_numsrc; /* number of sources in src_list */
1086 1086 struct in_addr imsf_slist[1]; /* start of source list */
1087 1087 };
1088 1088
1089 1089 #define IP_MSFILTER_SIZE(numsrc) \
1090 1090 (sizeof (struct ip_msfilter) - sizeof (struct in_addr) \
1091 1091 + (numsrc) * sizeof (struct in_addr))
1092 1092
1093 1093 /*
1094 1094 * Multicast source filter manipulation functions in libsocket;
1095 1095 * defined in RFC 3678.
1096 1096 */
1097 1097 int setsourcefilter(int, uint32_t, struct sockaddr *, socklen_t, uint32_t,
1098 1098 uint_t, struct sockaddr_storage *);
1099 1099
1100 1100 int getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t, uint32_t *,
1101 1101 uint_t *, struct sockaddr_storage *);
1102 1102
1103 1103 int setipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t,
1104 1104 uint32_t, struct in_addr *);
1105 1105
1106 1106 int getipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t *,
1107 1107 uint32_t *, struct in_addr *);
1108 1108
1109 1109 /*
1110 1110 * Definitions needed for [gs]etsourcefilter(), [gs]etipv4sourcefilter()
1111 1111 */
1112 1112 #define MCAST_INCLUDE 1
1113 1113 #define MCAST_EXCLUDE 2
1114 1114
1115 1115 /*
1116 1116 * Argument struct for IP_PKTINFO option
1117 1117 */
1118 1118 typedef struct in_pktinfo {
1119 1119 unsigned int ipi_ifindex; /* send/recv interface index */
1120 1120 struct in_addr ipi_spec_dst; /* matched source address */
1121 1121 struct in_addr ipi_addr; /* src/dst address in IP hdr */
1122 1122 } in_pktinfo_t;
1123 1123
1124 1124 /*
1125 1125 * Argument struct for IPV6_PKTINFO option
1126 1126 */
1127 1127 struct in6_pktinfo {
1128 1128 struct in6_addr ipi6_addr; /* src/dst IPv6 address */
1129 1129 unsigned int ipi6_ifindex; /* send/recv interface index */
1130 1130 };
1131 1131
1132 1132 /*
1133 1133 * Argument struct for IPV6_MTUINFO option
1134 1134 */
1135 1135 struct ip6_mtuinfo {
1136 1136 struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */
1137 1137 uint32_t ip6m_mtu; /* path MTU in host byte order */
1138 1138 };
1139 1139
1140 1140 /*
1141 1141 * IPv6 routing header types
1142 1142 */
1143 1143 #define IPV6_RTHDR_TYPE_0 0
1144 1144
1145 1145 extern socklen_t inet6_rth_space(int type, int segments);
1146 1146 extern void *inet6_rth_init(void *bp, socklen_t bp_len, int type, int segments);
1147 1147 extern int inet6_rth_add(void *bp, const struct in6_addr *addr);
1148 1148 extern int inet6_rth_reverse(const void *in, void *out);
1149 1149 extern int inet6_rth_segments(const void *bp);
1150 1150 extern struct in6_addr *inet6_rth_getaddr(const void *bp, int index);
1151 1151
1152 1152 extern int inet6_opt_init(void *extbuf, socklen_t extlen);
1153 1153 extern int inet6_opt_append(void *extbuf, socklen_t extlen, int offset,
1154 1154 uint8_t type, socklen_t len, uint_t align, void **databufp);
1155 1155 extern int inet6_opt_finish(void *extbuf, socklen_t extlen, int offset);
1156 1156 extern int inet6_opt_set_val(void *databuf, int offset, void *val,
1157 1157 socklen_t vallen);
1158 1158 extern int inet6_opt_next(void *extbuf, socklen_t extlen, int offset,
1159 1159 uint8_t *typep, socklen_t *lenp, void **databufp);
1160 1160 extern int inet6_opt_find(void *extbufp, socklen_t extlen, int offset,
1161 1161 uint8_t type, socklen_t *lenp, void **databufp);
1162 1162 extern int inet6_opt_get_val(void *databuf, int offset, void *val,
1163 1163 socklen_t vallen);
1164 1164 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
1165 1165
1166 1166 /*
1167 1167 * Argument structure for IP_ADD_PROXY_ADDR.
1168 1168 * Note that this is an unstable, experimental interface. It may change
1169 1169 * later. Don't use it unless you know what it is.
1170 1170 */
1171 1171 typedef struct {
1172 1172 struct in_addr in_prefix_addr;
1173 1173 unsigned int in_prefix_len;
1174 1174 } in_prefix_t;
1175 1175
1176 1176
1177 1177 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
1178 1178 /*
1179 1179 * IPv6 options
1180 1180 */
1181 1181 #define IPV6_UNICAST_HOPS 0x5 /* hop limit value for unicast */
1182 1182 /* packets. */
1183 1183 /* argument type: uint_t */
1184 1184 #define IPV6_MULTICAST_IF 0x6 /* outgoing interface for */
1185 1185 /* multicast packets. */
1186 1186 /* argument type: struct in6_addr */
1187 1187 #define IPV6_MULTICAST_HOPS 0x7 /* hop limit value to use for */
1188 1188 /* multicast packets. */
1189 1189 /* argument type: uint_t */
1190 1190 #define IPV6_MULTICAST_LOOP 0x8 /* enable/disable delivery of */
1191 1191 /* multicast packets on same socket. */
1192 1192 /* argument type: uint_t */
1193 1193 #define IPV6_JOIN_GROUP 0x9 /* join an IPv6 multicast group. */
1194 1194 /* argument type: struct ipv6_mreq */
1195 1195 #define IPV6_LEAVE_GROUP 0xa /* leave an IPv6 multicast group */
1196 1196 /* argument type: struct ipv6_mreq */
1197 1197
1198 1198 /*
1199 1199 * Other XPG6 constants.
1200 1200 */
1201 1201 #define INET_ADDRSTRLEN 16 /* max len IPv4 addr in ascii dotted */
1202 1202 /* decimal notation. */
1203 1203 #define INET6_ADDRSTRLEN 46 /* max len of IPv6 addr in ascii */
1204 1204 /* standard colon-hex notation. */
1205 1205
1206 1206 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
1207 1207
1208 1208 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
1209 1209
1210 1210 /*
1211 1211 * IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMBERSHIP are being kept
1212 1212 * for backward compatibility. They have the same meaning as IPV6_JOIN_GROUP
1213 1213 * and IPV6_LEAVE_GROUP respectively.
1214 1214 */
1215 1215 #define IPV6_ADD_MEMBERSHIP 0x9 /* join an IPv6 multicast group. */
1216 1216 /* argument type: struct ipv6_mreq */
1217 1217 #define IPV6_DROP_MEMBERSHIP 0xa /* leave an IPv6 multicast group */
1218 1218 /* argument type: struct ipv6_mreq */
1219 1219
1220 1220 #define IPV6_PKTINFO 0xb /* addr plus interface index */
1221 1221 /* arg type: "struct in6_pktingo" - */
1222 1222 #define IPV6_HOPLIMIT 0xc /* hoplimit for datagram */
1223 1223 #define IPV6_NEXTHOP 0xd /* next hop address */
1224 1224 #define IPV6_HOPOPTS 0xe /* hop by hop options */
1225 1225 #define IPV6_DSTOPTS 0xf /* destination options - after */
1226 1226 /* the routing header */
1227 1227 #define IPV6_RTHDR 0x10 /* routing header */
1228 1228 #define IPV6_RTHDRDSTOPTS 0x11 /* destination options - before */
1229 1229 /* the routing header */
1230 1230 #define IPV6_RECVPKTINFO 0x12 /* enable/disable IPV6_PKTINFO */
1231 1231 #define IPV6_RECVHOPLIMIT 0x13 /* enable/disable IPV6_HOPLIMIT */
1232 1232 #define IPV6_RECVHOPOPTS 0x14 /* enable/disable IPV6_HOPOPTS */
1233 1233
1234 1234 /*
1235 1235 * This options exists for backwards compatability and should no longer be
1236 1236 * used. Use IPV6_RECVDSTOPTS instead.
1237 1237 */
1238 1238 #define _OLD_IPV6_RECVDSTOPTS 0x15
1239 1239
1240 1240 #define IPV6_RECVRTHDR 0x16 /* enable/disable IPV6_RTHDR */
1241 1241
1242 1242 /*
1243 1243 * enable/disable IPV6_RTHDRDSTOPTS. Now obsolete. IPV6_RECVDSTOPTS enables
1244 1244 * the receipt of both headers.
1245 1245 */
1246 1246 #define IPV6_RECVRTHDRDSTOPTS 0x17
1247 1247
1248 1248 #define IPV6_CHECKSUM 0x18 /* Control checksum on raw sockets */
1249 1249 #define IPV6_RECVTCLASS 0x19 /* enable/disable IPV6_CLASS */
1250 1250 #define IPV6_USE_MIN_MTU 0x20 /* send packets with minimum MTU */
1251 1251 #define IPV6_DONTFRAG 0x21 /* don't fragment packets */
1252 1252 #define IPV6_SEC_OPT 0x22 /* Used to set IPSEC options */
1253 1253 #define IPV6_SRC_PREFERENCES 0x23 /* Control socket's src addr select */
1254 1254 #define IPV6_RECVPATHMTU 0x24 /* receive PMTU info */
1255 1255 #define IPV6_PATHMTU 0x25 /* get the PMTU */
1256 1256 #define IPV6_TCLASS 0x26 /* traffic class */
1257 1257 #define IPV6_V6ONLY 0x27 /* v6 only socket option */
1258 1258
1259 1259 /*
1260 1260 * enable/disable receipt of both both IPV6_DSTOPTS headers.
1261 1261 */
1262 1262 #define IPV6_RECVDSTOPTS 0x28
1263 1263
1264 1264 /*
1265 1265 * protocol-independent multicast membership options.
1266 1266 */
1267 1267 #define MCAST_JOIN_GROUP 0x29 /* join group for all sources */
1268 1268 #define MCAST_LEAVE_GROUP 0x2a /* leave group */
1269 1269 #define MCAST_BLOCK_SOURCE 0x2b /* block specified source */
1270 1270 #define MCAST_UNBLOCK_SOURCE 0x2c /* unblock specified source */
1271 1271 #define MCAST_JOIN_SOURCE_GROUP 0x2d /* join group for specified source */
1272 1272 #define MCAST_LEAVE_SOURCE_GROUP 0x2e /* leave source/group pair */
1273 1273
1274 1274 /* 32Bit field for IPV6_SRC_PREFERENCES */
1275 1275 #define IPV6_PREFER_SRC_HOME 0x00000001
1276 1276 #define IPV6_PREFER_SRC_COA 0x00000002
1277 1277 #define IPV6_PREFER_SRC_PUBLIC 0x00000004
1278 1278 #define IPV6_PREFER_SRC_TMP 0x00000008
1279 1279 #define IPV6_PREFER_SRC_NONCGA 0x00000010
1280 1280 #define IPV6_PREFER_SRC_CGA 0x00000020
1281 1281
1282 1282 #define IPV6_PREFER_SRC_MIPMASK (IPV6_PREFER_SRC_HOME | IPV6_PREFER_SRC_COA)
1283 1283 #define IPV6_PREFER_SRC_MIPDEFAULT IPV6_PREFER_SRC_HOME
1284 1284 #define IPV6_PREFER_SRC_TMPMASK (IPV6_PREFER_SRC_PUBLIC | IPV6_PREFER_SRC_TMP)
1285 1285 #define IPV6_PREFER_SRC_TMPDEFAULT IPV6_PREFER_SRC_PUBLIC
1286 1286 #define IPV6_PREFER_SRC_CGAMASK (IPV6_PREFER_SRC_NONCGA | IPV6_PREFER_SRC_CGA)
1287 1287 #define IPV6_PREFER_SRC_CGADEFAULT IPV6_PREFER_SRC_NONCGA
1288 1288
1289 1289 #define IPV6_PREFER_SRC_MASK (IPV6_PREFER_SRC_MIPMASK |\
1290 1290 IPV6_PREFER_SRC_TMPMASK | IPV6_PREFER_SRC_CGAMASK)
1291 1291
1292 1292 #define IPV6_PREFER_SRC_DEFAULT (IPV6_PREFER_SRC_MIPDEFAULT |\
1293 1293 IPV6_PREFER_SRC_TMPDEFAULT | IPV6_PREFER_SRC_CGADEFAULT)
1294 1294
1295 1295 /*
1296 1296 * SunOS private (potentially not portable) IPV6_ option names
1297 1297 */
1298 1298 #define IPV6_BOUND_IF 0x41 /* bind to an ifindex */
1299 1299 #define IPV6_UNSPEC_SRC 0x42 /* source of packets set to */
1300 1300 /* unspecified (all zeros) */
1301 1301
1302 1302 /*
1303 1303 * Miscellaneous IPv6 constants.
1304 1304 */
1305 1305 #define IPV6_PAD1_OPT 0 /* pad byte in IPv6 extension hdrs */
1306 1306
1307 1307 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
1308 1308
1309 1309 /*
1310 1310 * Extern declarations for pre-defined global const variables
1311 1311 */
1312 1312 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
1313 1313 #ifndef _KERNEL
1314 1314 #ifdef __STDC__
1315 1315 extern const struct in6_addr in6addr_any;
1316 1316 extern const struct in6_addr in6addr_loopback;
1317 1317 #else
1318 1318 extern struct in6_addr in6addr_any;
1319 1319 extern struct in6_addr in6addr_loopback;
1320 1320 #endif
1321 1321 #endif
1322 1322 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
1323 1323
1324 1324 #ifdef __cplusplus
1325 1325 }
1326 1326 #endif
1327 1327
1328 1328 #endif /* _NETINET_IN_H */
↓ open down ↓ |
843 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX