]>
Commit | Line | Data |
---|---|---|
bb330e25 AF |
1 | # |
2 | # Based on the commit: | |
3 | # | |
4 | # commit 6c82a2f8d7c8e21e39237225c819f182ae438db3 | |
5 | # Author: Carlos O'Donell <carlos@redhat.com> | |
6 | # Date: Fri Sep 6 01:02:30 2013 -0400 | |
7 | # | |
8 | # Coordinate IPv6 definitions for Linux and glibc | |
9 | # | |
10 | # This change synchronizes the glibc headers with the Linux kernel | |
11 | # headers and arranges to coordinate the definition of structures | |
12 | # already defined the Linux kernel UAPI headers. | |
13 | # | |
14 | # It is now safe to include glibc's netinet/in.h or Linux's linux/in6.h | |
15 | # in any order in a userspace application and you will get the same | |
16 | # ABI. The ABI is guaranteed by UAPI and glibc. | |
17 | # | |
18 | # 2013-09-05 Carlos O'Donell <carlos@redhat.com> | |
19 | # Cong Wang <amwang@redhat.com> | |
20 | # | |
21 | # * sysdeps/unix/sysv/linux/bits/in.h | |
22 | # [_UAPI_LINUX_IN6_H]: Define __USE_KERNEL_IPV6_DEFS. | |
23 | # * inet/netinet/in.h: Move in_addr definition and bits/in.h inclusion | |
24 | # before __USE_KERNEL_IPV6_DEFS uses. | |
25 | # * inet/netinet/in.h [!__USE_KERNEL_IPV6_DEFS]: Define IPPROTO_MH, and | |
26 | # IPPROTO_BEETPH. | |
27 | # [__USE_KERNEL_IPV6_DEFS]: Don't define any of IPPROTO_*, in6_addr, | |
28 | # sockaddr_in6, or ipv6_mreq. | |
29 | # | |
30 | diff -urN glibc-2.12-2-gc4ccff1/inet/netinet/in.h glibc-2.12-2-gc4ccff1.mod/inet/netinet/in.h | |
31 | --- glibc-2.12-2-gc4ccff1/inet/netinet/in.h 2010-05-04 07:27:23.000000000 -0400 | |
32 | +++ glibc-2.12-2-gc4ccff1.mod/inet/netinet/in.h 2015-02-18 13:06:56.436802873 -0500 | |
33 | @@ -28,13 +28,21 @@ | |
34 | ||
35 | __BEGIN_DECLS | |
36 | ||
37 | +/* Internet address. */ | |
38 | +typedef uint32_t in_addr_t; | |
39 | +struct in_addr | |
40 | + { | |
41 | + in_addr_t s_addr; | |
42 | + }; | |
43 | + | |
44 | +/* Get system-specific definitions. */ | |
45 | +#include <bits/in.h> | |
46 | + | |
47 | /* Standard well-defined IP protocols. */ | |
48 | enum | |
49 | { | |
50 | IPPROTO_IP = 0, /* Dummy protocol for TCP. */ | |
51 | #define IPPROTO_IP IPPROTO_IP | |
52 | - IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */ | |
53 | -#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS | |
54 | IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */ | |
55 | #define IPPROTO_ICMP IPPROTO_ICMP | |
56 | IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */ | |
57 | @@ -57,10 +65,6 @@ | |
58 | #define IPPROTO_DCCP IPPROTO_DCCP | |
59 | IPPROTO_IPV6 = 41, /* IPv6 header. */ | |
60 | #define IPPROTO_IPV6 IPPROTO_IPV6 | |
61 | - IPPROTO_ROUTING = 43, /* IPv6 routing header. */ | |
62 | -#define IPPROTO_ROUTING IPPROTO_ROUTING | |
63 | - IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */ | |
64 | -#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT | |
65 | IPPROTO_RSVP = 46, /* Reservation Protocol. */ | |
66 | #define IPPROTO_RSVP IPPROTO_RSVP | |
67 | IPPROTO_GRE = 47, /* General Routing Encapsulation. */ | |
68 | @@ -69,14 +73,10 @@ | |
69 | #define IPPROTO_ESP IPPROTO_ESP | |
70 | IPPROTO_AH = 51, /* authentication header. */ | |
71 | #define IPPROTO_AH IPPROTO_AH | |
72 | - IPPROTO_ICMPV6 = 58, /* ICMPv6. */ | |
73 | -#define IPPROTO_ICMPV6 IPPROTO_ICMPV6 | |
74 | - IPPROTO_NONE = 59, /* IPv6 no next header. */ | |
75 | -#define IPPROTO_NONE IPPROTO_NONE | |
76 | - IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */ | |
77 | -#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS | |
78 | IPPROTO_MTP = 92, /* Multicast Transport Protocol. */ | |
79 | #define IPPROTO_MTP IPPROTO_MTP | |
80 | + IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET. */ | |
81 | +#define IPPROTO_BEETPH IPPROTO_BEETPH | |
82 | IPPROTO_ENCAP = 98, /* Encapsulation Header. */ | |
83 | #define IPPROTO_ENCAP IPPROTO_ENCAP | |
84 | IPPROTO_PIM = 103, /* Protocol Independent Multicast. */ | |
85 | @@ -92,6 +92,28 @@ | |
86 | IPPROTO_MAX | |
87 | }; | |
88 | ||
89 | +/* If __USER_KERNEL_IPV6_DEFS is defined then the user has included the kernel | |
90 | + network headers first and we should use those ABI-identical definitions | |
91 | + instead of our own. */ | |
92 | +#ifndef __USE_KERNEL_IPV6_DEFS | |
93 | +enum | |
94 | + { | |
95 | + IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */ | |
96 | +#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS | |
97 | + IPPROTO_ROUTING = 43, /* IPv6 routing header. */ | |
98 | +#define IPPROTO_ROUTING IPPROTO_ROUTING | |
99 | + IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */ | |
100 | +#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT | |
101 | + IPPROTO_ICMPV6 = 58, /* ICMPv6. */ | |
102 | +#define IPPROTO_ICMPV6 IPPROTO_ICMPV6 | |
103 | + IPPROTO_NONE = 59, /* IPv6 no next header. */ | |
104 | +#define IPPROTO_NONE IPPROTO_NONE | |
105 | + IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */ | |
106 | +#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS | |
107 | + IPPROTO_MH = 135, /* IPv6 mobility header. */ | |
108 | +#define IPPROTO_MH IPPROTO_MH | |
109 | + }; | |
110 | +#endif /* !__USE_KERNEL_IPV6_DEFS */ | |
111 | ||
112 | /* Type to represent a port. */ | |
113 | typedef uint16_t in_port_t; | |
114 | @@ -136,15 +158,6 @@ | |
115 | IPPORT_USERRESERVED = 5000 | |
116 | }; | |
117 | ||
118 | - | |
119 | -/* Internet address. */ | |
120 | -typedef uint32_t in_addr_t; | |
121 | -struct in_addr | |
122 | - { | |
123 | - in_addr_t s_addr; | |
124 | - }; | |
125 | - | |
126 | - | |
127 | /* Definitions of the bits in an Internet address integer. | |
128 | ||
129 | On subnets, host and network parts are found according to | |
130 | @@ -193,7 +206,7 @@ | |
131 | #define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */ | |
132 | #define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */ | |
133 | ||
134 | - | |
135 | +#ifndef __USE_KERNEL_IPV6_DEFS | |
136 | /* IPv6 address */ | |
137 | struct in6_addr | |
138 | { | |
139 | @@ -211,6 +224,7 @@ | |
140 | # define s6_addr32 __in6_u.__u6_addr32 | |
141 | #endif | |
142 | }; | |
143 | +#endif /* !__USE_KERNEL_IPV6_DEFS */ | |
144 | ||
145 | extern const struct in6_addr in6addr_any; /* :: */ | |
146 | extern const struct in6_addr in6addr_loopback; /* ::1 */ | |
147 | @@ -235,6 +249,7 @@ | |
148 | sizeof (struct in_addr)]; | |
149 | }; | |
150 | ||
151 | +#ifndef __USE_KERNEL_IPV6_DEFS | |
152 | /* Ditto, for IPv6. */ | |
153 | struct sockaddr_in6 | |
154 | { | |
155 | @@ -244,7 +259,7 @@ | |
156 | struct in6_addr sin6_addr; /* IPv6 address */ | |
157 | uint32_t sin6_scope_id; /* IPv6 scope-id */ | |
158 | }; | |
159 | - | |
160 | +#endif /* !__USE_KERNEL_IPV6_DEFS */ | |
161 | ||
162 | #if defined __USE_MISC || defined __USE_GNU | |
163 | /* IPv4 multicast request. */ | |
164 | @@ -270,7 +285,7 @@ | |
165 | }; | |
166 | #endif | |
167 | ||
168 | - | |
169 | +#ifndef __USE_KERNEL_IPV6_DEFS | |
170 | /* Likewise, for IPv6. */ | |
171 | struct ipv6_mreq | |
172 | { | |
173 | @@ -280,7 +295,7 @@ | |
174 | /* local interface */ | |
175 | unsigned int ipv6mr_interface; | |
176 | }; | |
177 | - | |
178 | +#endif /* !__USE_KERNEL_IPV6_DEFS */ | |
179 | ||
180 | #if defined __USE_MISC || defined __USE_GNU | |
181 | /* Multicast group request. */ | |
182 | @@ -351,10 +366,6 @@ | |
183 | * sizeof (struct sockaddr_storage))) | |
184 | #endif | |
185 | ||
186 | - | |
187 | -/* Get system-specific definitions. */ | |
188 | -#include <bits/in.h> | |
189 | - | |
190 | /* Functions to convert between host and network byte order. | |
191 | ||
192 | Please note that these functions normally take `unsigned long int' or | |
193 | diff -urN glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/bits/in.h glibc-2.12-2-gc4ccff1.mod/sysdeps/unix/sysv/linux/bits/in.h | |
194 | --- glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/bits/in.h 2015-02-18 13:04:15.547734092 -0500 | |
195 | +++ glibc-2.12-2-gc4ccff1.mod/sysdeps/unix/sysv/linux/bits/in.h 2015-02-18 13:06:56.436802873 -0500 | |
196 | @@ -22,6 +22,18 @@ | |
197 | # error "Never use <bits/in.h> directly; include <netinet/in.h> instead." | |
198 | #endif | |
199 | ||
200 | +/* If the application has already included linux/in6.h from a linux-based | |
201 | + kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the | |
202 | + defines), sockaddr_in6, or ipv6_mreq. The ABI used by the linux-kernel and | |
203 | + glibc match exactly. Neither the linux kernel nor glibc should break this | |
204 | + ABI without coordination. */ | |
205 | +#ifdef _UAPI_LINUX_IN6_H | |
206 | +/* This is not quite the same API since the kernel always defines s6_addr16 and | |
207 | + s6_addr32. This is not a violation of POSIX since POSIX says "at least the | |
208 | + following member" and that holds true. */ | |
209 | +# define __USE_KERNEL_IPV6_DEFS | |
210 | +#endif | |
211 | + | |
212 | /* Options for use with `getsockopt' and `setsockopt' at the IP level. | |
213 | The first word in the comment at the right is the data type used; | |
214 | "bool" means a boolean value stored in an `int'. */ |