1 Fix libc kernel headers conflict
3 Add missing kernel headers to fix conflicts with toolchain provided kernel
4 headers of older versions.
6 This patch is equivalent to upstream commit 6c7f4215003 ("build: distribute
7 in.h in6.h libc-compat.h"). These files are present in upstream git repo, but
8 are missing from the distributed tarball.
10 Signed-off-by: Baruch Siach <baruch@tkos.co.il>
14 +++ b/include/linux-private/linux/in.h
17 + * INET An implementation of the TCP/IP protocol suite for the LINUX
18 + * operating system. INET is implemented using the BSD Socket
19 + * interface as the means of communication with the user level.
21 + * Definitions of the Internet Protocol.
23 + * Version: @(#)in.h 1.0.1 04/21/93
25 + * Authors: Original taken from the GNU Project <netinet/in.h> file.
26 + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
28 + * This program is free software; you can redistribute it and/or
29 + * modify it under the terms of the GNU General Public License
30 + * as published by the Free Software Foundation; either version
31 + * 2 of the License, or (at your option) any later version.
36 +#include <linux/types.h>
37 +#include <linux/libc-compat.h>
38 +#include <linux/socket.h>
40 +#if __UAPI_DEF_IN_IPPROTO
41 +/* Standard well-defined IP protocols. */
43 + IPPROTO_IP = 0, /* Dummy protocol for TCP */
44 +#define IPPROTO_IP IPPROTO_IP
45 + IPPROTO_ICMP = 1, /* Internet Control Message Protocol */
46 +#define IPPROTO_ICMP IPPROTO_ICMP
47 + IPPROTO_IGMP = 2, /* Internet Group Management Protocol */
48 +#define IPPROTO_IGMP IPPROTO_IGMP
49 + IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */
50 +#define IPPROTO_IPIP IPPROTO_IPIP
51 + IPPROTO_TCP = 6, /* Transmission Control Protocol */
52 +#define IPPROTO_TCP IPPROTO_TCP
53 + IPPROTO_EGP = 8, /* Exterior Gateway Protocol */
54 +#define IPPROTO_EGP IPPROTO_EGP
55 + IPPROTO_PUP = 12, /* PUP protocol */
56 +#define IPPROTO_PUP IPPROTO_PUP
57 + IPPROTO_UDP = 17, /* User Datagram Protocol */
58 +#define IPPROTO_UDP IPPROTO_UDP
59 + IPPROTO_IDP = 22, /* XNS IDP protocol */
60 +#define IPPROTO_IDP IPPROTO_IDP
61 + IPPROTO_TP = 29, /* SO Transport Protocol Class 4 */
62 +#define IPPROTO_TP IPPROTO_TP
63 + IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */
64 +#define IPPROTO_DCCP IPPROTO_DCCP
65 + IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */
66 +#define IPPROTO_IPV6 IPPROTO_IPV6
67 + IPPROTO_RSVP = 46, /* RSVP Protocol */
68 +#define IPPROTO_RSVP IPPROTO_RSVP
69 + IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */
70 +#define IPPROTO_GRE IPPROTO_GRE
71 + IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
72 +#define IPPROTO_ESP IPPROTO_ESP
73 + IPPROTO_AH = 51, /* Authentication Header protocol */
74 +#define IPPROTO_AH IPPROTO_AH
75 + IPPROTO_MTP = 92, /* Multicast Transport Protocol */
76 +#define IPPROTO_MTP IPPROTO_MTP
77 + IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */
78 +#define IPPROTO_BEETPH IPPROTO_BEETPH
79 + IPPROTO_ENCAP = 98, /* Encapsulation Header */
80 +#define IPPROTO_ENCAP IPPROTO_ENCAP
81 + IPPROTO_PIM = 103, /* Protocol Independent Multicast */
82 +#define IPPROTO_PIM IPPROTO_PIM
83 + IPPROTO_COMP = 108, /* Compression Header Protocol */
84 +#define IPPROTO_COMP IPPROTO_COMP
85 + IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
86 +#define IPPROTO_SCTP IPPROTO_SCTP
87 + IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */
88 +#define IPPROTO_UDPLITE IPPROTO_UDPLITE
89 + IPPROTO_MPLS = 137, /* MPLS in IP (RFC 4023) */
90 +#define IPPROTO_MPLS IPPROTO_MPLS
91 + IPPROTO_RAW = 255, /* Raw IP packets */
92 +#define IPPROTO_RAW IPPROTO_RAW
97 +#if __UAPI_DEF_IN_ADDR
98 +/* Internet address. */
106 +#define IP_HDRINCL 3
107 +#define IP_OPTIONS 4
108 +#define IP_ROUTER_ALERT 5
109 +#define IP_RECVOPTS 6
110 +#define IP_RETOPTS 7
111 +#define IP_PKTINFO 8
112 +#define IP_PKTOPTIONS 9
113 +#define IP_MTU_DISCOVER 10
114 +#define IP_RECVERR 11
115 +#define IP_RECVTTL 12
116 +#define IP_RECVTOS 13
118 +#define IP_FREEBIND 15
119 +#define IP_IPSEC_POLICY 16
120 +#define IP_XFRM_POLICY 17
121 +#define IP_PASSSEC 18
122 +#define IP_TRANSPARENT 19
124 +/* BSD compatibility */
125 +#define IP_RECVRETOPTS IP_RETOPTS
127 +/* TProxy original addresses */
128 +#define IP_ORIGDSTADDR 20
129 +#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
131 +#define IP_MINTTL 21
132 +#define IP_NODEFRAG 22
133 +#define IP_CHECKSUM 23
134 +#define IP_BIND_ADDRESS_NO_PORT 24
136 +/* IP_MTU_DISCOVER values */
137 +#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
138 +#define IP_PMTUDISC_WANT 1 /* Use per route hints */
139 +#define IP_PMTUDISC_DO 2 /* Always DF */
140 +#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */
141 +/* Always use interface mtu (ignores dst pmtu) but don't set DF flag.
142 + * Also incoming ICMP frag_needed notifications will be ignored on
143 + * this socket to prevent accepting spoofed ones.
145 +#define IP_PMTUDISC_INTERFACE 4
146 +/* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get
147 + * fragmented if they exeed the interface mtu
149 +#define IP_PMTUDISC_OMIT 5
151 +#define IP_MULTICAST_IF 32
152 +#define IP_MULTICAST_TTL 33
153 +#define IP_MULTICAST_LOOP 34
154 +#define IP_ADD_MEMBERSHIP 35
155 +#define IP_DROP_MEMBERSHIP 36
156 +#define IP_UNBLOCK_SOURCE 37
157 +#define IP_BLOCK_SOURCE 38
158 +#define IP_ADD_SOURCE_MEMBERSHIP 39
159 +#define IP_DROP_SOURCE_MEMBERSHIP 40
160 +#define IP_MSFILTER 41
161 +#define MCAST_JOIN_GROUP 42
162 +#define MCAST_BLOCK_SOURCE 43
163 +#define MCAST_UNBLOCK_SOURCE 44
164 +#define MCAST_LEAVE_GROUP 45
165 +#define MCAST_JOIN_SOURCE_GROUP 46
166 +#define MCAST_LEAVE_SOURCE_GROUP 47
167 +#define MCAST_MSFILTER 48
168 +#define IP_MULTICAST_ALL 49
169 +#define IP_UNICAST_IF 50
171 +#define MCAST_EXCLUDE 0
172 +#define MCAST_INCLUDE 1
174 +/* These need to appear somewhere around here */
175 +#define IP_DEFAULT_MULTICAST_TTL 1
176 +#define IP_DEFAULT_MULTICAST_LOOP 1
178 +/* Request struct for multicast socket ops */
180 +#if __UAPI_DEF_IP_MREQ
182 + struct in_addr imr_multiaddr; /* IP multicast address of group */
183 + struct in_addr imr_interface; /* local IP address of interface */
187 + struct in_addr imr_multiaddr; /* IP multicast address of group */
188 + struct in_addr imr_address; /* local IP address of interface */
189 + int imr_ifindex; /* Interface index */
192 +struct ip_mreq_source {
193 + __be32 imr_multiaddr;
194 + __be32 imr_interface;
195 + __be32 imr_sourceaddr;
198 +struct ip_msfilter {
199 + __be32 imsf_multiaddr;
200 + __be32 imsf_interface;
203 + __be32 imsf_slist[1];
206 +#define IP_MSFILTER_SIZE(numsrc) \
207 + (sizeof(struct ip_msfilter) - sizeof(__u32) \
208 + + (numsrc) * sizeof(__u32))
211 + __u32 gr_interface; /* interface index */
212 + struct __kernel_sockaddr_storage gr_group; /* group address */
215 +struct group_source_req {
216 + __u32 gsr_interface; /* interface index */
217 + struct __kernel_sockaddr_storage gsr_group; /* group address */
218 + struct __kernel_sockaddr_storage gsr_source; /* source address */
221 +struct group_filter {
222 + __u32 gf_interface; /* interface index */
223 + struct __kernel_sockaddr_storage gf_group; /* multicast address */
224 + __u32 gf_fmode; /* filter mode */
225 + __u32 gf_numsrc; /* number of sources */
226 + struct __kernel_sockaddr_storage gf_slist[1]; /* interface index */
229 +#define GROUP_FILTER_SIZE(numsrc) \
230 + (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \
231 + + (numsrc) * sizeof(struct __kernel_sockaddr_storage))
234 +#if __UAPI_DEF_IN_PKTINFO
237 + struct in_addr ipi_spec_dst;
238 + struct in_addr ipi_addr;
242 +/* Structure describing an Internet (IP) socket address. */
243 +#if __UAPI_DEF_SOCKADDR_IN
244 +#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
245 +struct sockaddr_in {
246 + __kernel_sa_family_t sin_family; /* Address family */
247 + __be16 sin_port; /* Port number */
248 + struct in_addr sin_addr; /* Internet address */
250 + /* Pad to size of `struct sockaddr'. */
251 + unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) -
252 + sizeof(unsigned short int) - sizeof(struct in_addr)];
254 +#define sin_zero __pad /* for BSD UNIX comp. -FvK */
257 +#if __UAPI_DEF_IN_CLASS
259 + * Definitions of the bits in an Internet address integer.
260 + * On subnets, host and network parts are found according
261 + * to the subnet mask, not these masks.
263 +#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
264 +#define IN_CLASSA_NET 0xff000000
265 +#define IN_CLASSA_NSHIFT 24
266 +#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
267 +#define IN_CLASSA_MAX 128
269 +#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
270 +#define IN_CLASSB_NET 0xffff0000
271 +#define IN_CLASSB_NSHIFT 16
272 +#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
273 +#define IN_CLASSB_MAX 65536
275 +#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000)
276 +#define IN_CLASSC_NET 0xffffff00
277 +#define IN_CLASSC_NSHIFT 8
278 +#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
280 +#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
281 +#define IN_MULTICAST(a) IN_CLASSD(a)
282 +#define IN_MULTICAST_NET 0xF0000000
284 +#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
285 +#define IN_BADCLASS(a) IN_EXPERIMENTAL((a))
287 +/* Address to accept any incoming messages. */
288 +#define INADDR_ANY ((unsigned long int) 0x00000000)
290 +/* Address to send to all hosts. */
291 +#define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
293 +/* Address indicating an error return. */
294 +#define INADDR_NONE ((unsigned long int) 0xffffffff)
296 +/* Network number for local host loopback. */
297 +#define IN_LOOPBACKNET 127
299 +/* Address to loopback in software to local host. */
300 +#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */
301 +#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000)
303 +/* Defines for Multicast INADDR */
304 +#define INADDR_UNSPEC_GROUP 0xe0000000U /* 224.0.0.0 */
305 +#define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */
306 +#define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */
307 +#define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */
310 +/* <asm/byteorder.h> contains the htonl type stuff.. */
311 +#include <asm/byteorder.h>
314 +#endif /* _LINUX_IN_H */
316 +++ b/include/linux-private/linux/in6.h
319 + * Types and definitions for AF_INET6
320 + * Linux INET6 implementation
323 + * Pedro Roque <roque@di.fc.ul.pt>
326 + * IPv6 Program Interfaces for BSD Systems
327 + * <draft-ietf-ipngwg-bsd-api-05.txt>
329 + * Advanced Sockets API for IPv6
330 + * <draft-stevens-advanced-api-00.txt>
332 + * This program is free software; you can redistribute it and/or
333 + * modify it under the terms of the GNU General Public License
334 + * as published by the Free Software Foundation; either version
335 + * 2 of the License, or (at your option) any later version.
338 +#ifndef _LINUX_IN6_H
339 +#define _LINUX_IN6_H
341 +#include <linux/types.h>
342 +#include <linux/libc-compat.h>
345 + * IPv6 address structure
348 +#if __UAPI_DEF_IN6_ADDR
352 +#if __UAPI_DEF_IN6_ADDR_ALT
353 + __be16 u6_addr16[8];
354 + __be32 u6_addr32[4];
357 +#define s6_addr in6_u.u6_addr8
358 +#if __UAPI_DEF_IN6_ADDR_ALT
359 +#define s6_addr16 in6_u.u6_addr16
360 +#define s6_addr32 in6_u.u6_addr32
363 +#endif /* __UAPI_DEF_IN6_ADDR */
365 +#if __UAPI_DEF_SOCKADDR_IN6
366 +struct sockaddr_in6 {
367 + unsigned short int sin6_family; /* AF_INET6 */
368 + __be16 sin6_port; /* Transport layer port # */
369 + __be32 sin6_flowinfo; /* IPv6 flow information */
370 + struct in6_addr sin6_addr; /* IPv6 address */
371 + __u32 sin6_scope_id; /* scope id (new in RFC2553) */
373 +#endif /* __UAPI_DEF_SOCKADDR_IN6 */
375 +#if __UAPI_DEF_IPV6_MREQ
377 + /* IPv6 multicast address of group */
378 + struct in6_addr ipv6mr_multiaddr;
380 + /* local IPv6 address of interface */
381 + int ipv6mr_ifindex;
383 +#endif /* __UAPI_DEF_IVP6_MREQ */
385 +#define ipv6mr_acaddr ipv6mr_multiaddr
387 +struct in6_flowlabel_req {
388 + struct in6_addr flr_dst;
396 + /* Options in format of IPV6_PKTOPTIONS */
399 +#define IPV6_FL_A_GET 0
400 +#define IPV6_FL_A_PUT 1
401 +#define IPV6_FL_A_RENEW 2
403 +#define IPV6_FL_F_CREATE 1
404 +#define IPV6_FL_F_EXCL 2
405 +#define IPV6_FL_F_REFLECT 4
406 +#define IPV6_FL_F_REMOTE 8
408 +#define IPV6_FL_S_NONE 0
409 +#define IPV6_FL_S_EXCL 1
410 +#define IPV6_FL_S_PROCESS 2
411 +#define IPV6_FL_S_USER 3
412 +#define IPV6_FL_S_ANY 255
416 + * Bitmask constant declarations to help applications select out the
417 + * flow label and priority fields.
419 + * Note that this are in host byte order while the flowinfo field of
420 + * sockaddr_in6 is in network byte order.
423 +#define IPV6_FLOWINFO_FLOWLABEL 0x000fffff
424 +#define IPV6_FLOWINFO_PRIORITY 0x0ff00000
426 +/* These definitions are obsolete */
427 +#define IPV6_PRIORITY_UNCHARACTERIZED 0x0000
428 +#define IPV6_PRIORITY_FILLER 0x0100
429 +#define IPV6_PRIORITY_UNATTENDED 0x0200
430 +#define IPV6_PRIORITY_RESERVED1 0x0300
431 +#define IPV6_PRIORITY_BULK 0x0400
432 +#define IPV6_PRIORITY_RESERVED2 0x0500
433 +#define IPV6_PRIORITY_INTERACTIVE 0x0600
434 +#define IPV6_PRIORITY_CONTROL 0x0700
435 +#define IPV6_PRIORITY_8 0x0800
436 +#define IPV6_PRIORITY_9 0x0900
437 +#define IPV6_PRIORITY_10 0x0a00
438 +#define IPV6_PRIORITY_11 0x0b00
439 +#define IPV6_PRIORITY_12 0x0c00
440 +#define IPV6_PRIORITY_13 0x0d00
441 +#define IPV6_PRIORITY_14 0x0e00
442 +#define IPV6_PRIORITY_15 0x0f00
445 + * IPV6 extension headers
447 +#if __UAPI_DEF_IPPROTO_V6
448 +#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
449 +#define IPPROTO_ROUTING 43 /* IPv6 routing header */
450 +#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
451 +#define IPPROTO_ICMPV6 58 /* ICMPv6 */
452 +#define IPPROTO_NONE 59 /* IPv6 no next header */
453 +#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
454 +#define IPPROTO_MH 135 /* IPv6 mobility header */
455 +#endif /* __UAPI_DEF_IPPROTO_V6 */
458 + * IPv6 TLV options.
460 +#define IPV6_TLV_PAD1 0
461 +#define IPV6_TLV_PADN 1
462 +#define IPV6_TLV_ROUTERALERT 5
463 +#define IPV6_TLV_JUMBO 194
464 +#define IPV6_TLV_HAO 201 /* home address option */
467 + * IPV6 socket options
469 +#if __UAPI_DEF_IPV6_OPTIONS
470 +#define IPV6_ADDRFORM 1
471 +#define IPV6_2292PKTINFO 2
472 +#define IPV6_2292HOPOPTS 3
473 +#define IPV6_2292DSTOPTS 4
474 +#define IPV6_2292RTHDR 5
475 +#define IPV6_2292PKTOPTIONS 6
476 +#define IPV6_CHECKSUM 7
477 +#define IPV6_2292HOPLIMIT 8
478 +#define IPV6_NEXTHOP 9
479 +#define IPV6_AUTHHDR 10 /* obsolete */
480 +#define IPV6_FLOWINFO 11
482 +#define IPV6_UNICAST_HOPS 16
483 +#define IPV6_MULTICAST_IF 17
484 +#define IPV6_MULTICAST_HOPS 18
485 +#define IPV6_MULTICAST_LOOP 19
486 +#define IPV6_ADD_MEMBERSHIP 20
487 +#define IPV6_DROP_MEMBERSHIP 21
488 +#define IPV6_ROUTER_ALERT 22
489 +#define IPV6_MTU_DISCOVER 23
491 +#define IPV6_RECVERR 25
492 +#define IPV6_V6ONLY 26
493 +#define IPV6_JOIN_ANYCAST 27
494 +#define IPV6_LEAVE_ANYCAST 28
496 +/* IPV6_MTU_DISCOVER values */
497 +#define IPV6_PMTUDISC_DONT 0
498 +#define IPV6_PMTUDISC_WANT 1
499 +#define IPV6_PMTUDISC_DO 2
500 +#define IPV6_PMTUDISC_PROBE 3
501 +/* same as IPV6_PMTUDISC_PROBE, provided for symetry with IPv4
502 + * also see comments on IP_PMTUDISC_INTERFACE
504 +#define IPV6_PMTUDISC_INTERFACE 4
505 +/* weaker version of IPV6_PMTUDISC_INTERFACE, which allows packets to
506 + * get fragmented if they exceed the interface mtu
508 +#define IPV6_PMTUDISC_OMIT 5
511 +#define IPV6_FLOWLABEL_MGR 32
512 +#define IPV6_FLOWINFO_SEND 33
514 +#define IPV6_IPSEC_POLICY 34
515 +#define IPV6_XFRM_POLICY 35
520 + * Following socket options are shared between IPv4 and IPv6.
522 + * MCAST_JOIN_GROUP 42
523 + * MCAST_BLOCK_SOURCE 43
524 + * MCAST_UNBLOCK_SOURCE 44
525 + * MCAST_LEAVE_GROUP 45
526 + * MCAST_JOIN_SOURCE_GROUP 46
527 + * MCAST_LEAVE_SOURCE_GROUP 47
528 + * MCAST_MSFILTER 48
532 + * Advanced API (RFC3542) (1)
534 + * Note: IPV6_RECVRTHDRDSTOPTS does not exist. see net/ipv6/datagram.c.
537 +#define IPV6_RECVPKTINFO 49
538 +#define IPV6_PKTINFO 50
539 +#define IPV6_RECVHOPLIMIT 51
540 +#define IPV6_HOPLIMIT 52
541 +#define IPV6_RECVHOPOPTS 53
542 +#define IPV6_HOPOPTS 54
543 +#define IPV6_RTHDRDSTOPTS 55
544 +#define IPV6_RECVRTHDR 56
545 +#define IPV6_RTHDR 57
546 +#define IPV6_RECVDSTOPTS 58
547 +#define IPV6_DSTOPTS 59
548 +#define IPV6_RECVPATHMTU 60
549 +#define IPV6_PATHMTU 61
550 +#define IPV6_DONTFRAG 62
552 +#define IPV6_USE_MIN_MTU 63
558 + * Following socket options are used in ip6_tables;
559 + * see include/linux/netfilter_ipv6/ip6_tables.h.
561 + * IP6T_SO_SET_REPLACE / IP6T_SO_GET_INFO 64
562 + * IP6T_SO_SET_ADD_COUNTERS / IP6T_SO_GET_ENTRIES 65
566 + * Advanced API (RFC3542) (2)
568 +#define IPV6_RECVTCLASS 66
569 +#define IPV6_TCLASS 67
574 + * Following socket options are used in ip6_tables;
575 + * see include/linux/netfilter_ipv6/ip6_tables.h.
577 + * IP6T_SO_GET_REVISION_MATCH 68
578 + * IP6T_SO_GET_REVISION_TARGET 69
579 + * IP6T_SO_ORIGINAL_DST 80
582 +#define IPV6_AUTOFLOWLABEL 70
583 +/* RFC5014: Source address selection */
584 +#define IPV6_ADDR_PREFERENCES 72
586 +#define IPV6_PREFER_SRC_TMP 0x0001
587 +#define IPV6_PREFER_SRC_PUBLIC 0x0002
588 +#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
589 +#define IPV6_PREFER_SRC_COA 0x0004
590 +#define IPV6_PREFER_SRC_HOME 0x0400
591 +#define IPV6_PREFER_SRC_CGA 0x0008
592 +#define IPV6_PREFER_SRC_NONCGA 0x0800
594 +/* RFC5082: Generalized Ttl Security Mechanism */
595 +#define IPV6_MINHOPCOUNT 73
597 +#define IPV6_ORIGDSTADDR 74
598 +#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR
599 +#define IPV6_TRANSPARENT 75
600 +#define IPV6_UNICAST_IF 76
603 + * Multicast Routing:
604 + * see include/uapi/linux/mroute6.h.
610 +#endif /* _LINUX_IN6_H */
612 +++ b/include/linux-private/linux/libc-compat.h
615 + * Compatibility interface for userspace libc header coordination:
617 + * Define compatibility macros that are used to control the inclusion or
618 + * exclusion of UAPI structures and definitions in coordination with another
619 + * userspace C library.
621 + * This header is intended to solve the problem of UAPI definitions that
622 + * conflict with userspace definitions. If a UAPI header has such conflicting
623 + * definitions then the solution is as follows:
625 + * * Synchronize the UAPI header and the libc headers so either one can be
626 + * used and such that the ABI is preserved. If this is not possible then
627 + * no simple compatibility interface exists (you need to write translating
628 + * wrappers and rename things) and you can't use this interface.
630 + * Then follow this process:
632 + * (a) Include libc-compat.h in the UAPI header.
633 + * e.g. #include <linux/libc-compat.h>
634 + * This include must be as early as possible.
636 + * (b) In libc-compat.h add enough code to detect that the comflicting
637 + * userspace libc header has been included first.
639 + * (c) If the userspace libc header has been included first define a set of
640 + * guard macros of the form __UAPI_DEF_FOO and set their values to 1, else
641 + * set their values to 0.
643 + * (d) Back in the UAPI header with the conflicting definitions, guard the
644 + * definitions with:
645 + * #if __UAPI_DEF_FOO
649 + * This fixes the situation where the linux headers are included *after* the
650 + * libc headers. To fix the problem with the inclusion in the other order the
651 + * userspace libc headers must be fixed like this:
653 + * * For all definitions that conflict with kernel definitions wrap those
654 + * defines in the following:
655 + * #if !__UAPI_DEF_FOO
659 + * This prevents the redefinition of a construct already defined by the kernel.
661 +#ifndef _LIBC_COMPAT_H
662 +#define _LIBC_COMPAT_H
664 +/* We have included glibc headers... */
665 +#if defined(__GLIBC__)
667 +/* Coordinate with glibc netinet/in.h header. */
668 +#if defined(_NETINET_IN_H)
670 +/* GLIBC headers included first so don't define anything
671 + * that would already be defined. */
672 +#define __UAPI_DEF_IN_ADDR 0
673 +#define __UAPI_DEF_IN_IPPROTO 0
674 +#define __UAPI_DEF_IN_PKTINFO 0
675 +#define __UAPI_DEF_IP_MREQ 0
676 +#define __UAPI_DEF_SOCKADDR_IN 0
677 +#define __UAPI_DEF_IN_CLASS 0
679 +#define __UAPI_DEF_IN6_ADDR 0
680 +/* The exception is the in6_addr macros which must be defined
681 + * if the glibc code didn't define them. This guard matches
682 + * the guard in glibc/inet/netinet/in.h which defines the
683 + * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */
684 +#if defined(__USE_MISC) || defined (__USE_GNU)
685 +#define __UAPI_DEF_IN6_ADDR_ALT 0
687 +#define __UAPI_DEF_IN6_ADDR_ALT 1
689 +#define __UAPI_DEF_SOCKADDR_IN6 0
690 +#define __UAPI_DEF_IPV6_MREQ 0
691 +#define __UAPI_DEF_IPPROTO_V6 0
692 +#define __UAPI_DEF_IPV6_OPTIONS 0
693 +#define __UAPI_DEF_IN6_PKTINFO 0
694 +#define __UAPI_DEF_IP6_MTUINFO 0
698 +/* Linux headers included first, and we must define everything
699 + * we need. The expectation is that glibc will check the
700 + * __UAPI_DEF_* defines and adjust appropriately. */
701 +#define __UAPI_DEF_IN_ADDR 1
702 +#define __UAPI_DEF_IN_IPPROTO 1
703 +#define __UAPI_DEF_IN_PKTINFO 1
704 +#define __UAPI_DEF_IP_MREQ 1
705 +#define __UAPI_DEF_SOCKADDR_IN 1
706 +#define __UAPI_DEF_IN_CLASS 1
708 +#define __UAPI_DEF_IN6_ADDR 1
709 +/* We unconditionally define the in6_addr macros and glibc must
711 +#define __UAPI_DEF_IN6_ADDR_ALT 1
712 +#define __UAPI_DEF_SOCKADDR_IN6 1
713 +#define __UAPI_DEF_IPV6_MREQ 1
714 +#define __UAPI_DEF_IPPROTO_V6 1
715 +#define __UAPI_DEF_IPV6_OPTIONS 1
716 +#define __UAPI_DEF_IN6_PKTINFO 1
717 +#define __UAPI_DEF_IP6_MTUINFO 1
719 +#endif /* _NETINET_IN_H */
721 +/* Definitions for xattr.h */
722 +#if defined(_SYS_XATTR_H)
723 +#define __UAPI_DEF_XATTR 0
725 +#define __UAPI_DEF_XATTR 1
728 +/* If we did not see any headers from any supported C libraries,
729 + * or we are being included in the kernel, then define everything
731 +#else /* !defined(__GLIBC__) */
733 +/* Definitions for in.h */
734 +#define __UAPI_DEF_IN_ADDR 1
735 +#define __UAPI_DEF_IN_IPPROTO 1
736 +#define __UAPI_DEF_IN_PKTINFO 1
737 +#define __UAPI_DEF_IP_MREQ 1
738 +#define __UAPI_DEF_SOCKADDR_IN 1
739 +#define __UAPI_DEF_IN_CLASS 1
741 +/* Definitions for in6.h */
742 +#define __UAPI_DEF_IN6_ADDR 1
743 +#define __UAPI_DEF_IN6_ADDR_ALT 1
744 +#define __UAPI_DEF_SOCKADDR_IN6 1
745 +#define __UAPI_DEF_IPV6_MREQ 1
746 +#define __UAPI_DEF_IPPROTO_V6 1
747 +#define __UAPI_DEF_IPV6_OPTIONS 1
748 +#define __UAPI_DEF_IN6_PKTINFO 1
749 +#define __UAPI_DEF_IP6_MTUINFO 1
751 +/* Definitions for xattr.h */
752 +#define __UAPI_DEF_XATTR 1
754 +#endif /* __GLIBC__ */
756 +#endif /* _LIBC_COMPAT_H */