net: sync some IP headers with glibc
Solution: ========= - Synchronize linux's `include/uapi/linux/in6.h' with glibc's `inet/netinet/in.h'. - Synchronize glibc's `inet/netinet/in.h with linux's `include/uapi/linux/in6.h'. - Allow including the headers in either other. - First header included defines the structures and macros. Details: ======== The kernel promises not to break the UAPI ABI so I don't see why we can't just have the two userspace headers coordinate? If you include the kernel headers first you get those, and if you include the glibc headers first you get those, and the following patch arranges a coordination and synchronization between the two. Let's handle `include/uapi/linux/in6.h' from linux, and `inet/netinet/in.h' from glibc and ensure they compile in any order and preserve the required ABI. These two patches pass the following compile tests: cat >> test1.c <<EOF int main (void) { return 0; } EOF gcc -c test1.c cat >> test2.c <<EOF int main (void) { return 0; } EOF gcc -c test2.c One wrinkle is that the kernel has a different name for one of the members in ipv6_mreq. In the kernel patch we create a macro to cover the uses of the old name, and while that's not entirely clean it's one of the best solutions (aside from an anonymous union which has other issues). I've reviewed the code and it looks to me like the ABI is assured and everything matches on both sides. Notes: - You want netinet/in.h to include bits/in.h as early as possible, but it needs in_addr so define in_addr early. - You want bits/in.h included as early as possible so you can use the linux specific code to define __USE_KERNEL_DEFS based on the _UAPI_* macro definition and use those to cull in.h. - glibc was missing IPPROTO_MH, added here. Compile tested and inspected. Reported-by: Thomas Backlund <tmb@mageia.org> Cc: Thomas Backlund <tmb@mageia.org> Cc: libc-alpha@sourceware.org Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Cc: David S. Miller <davem@davemloft.net> Tested-by: Cong Wang <amwang@redhat.com> Signed-off-by: Carlos O'Donell <carlos@redhat.com> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
42a5a5c128
commit
cfd280c912
@@ -24,30 +24,53 @@
|
||||
/* Standard well-defined IP protocols. */
|
||||
enum {
|
||||
IPPROTO_IP = 0, /* Dummy protocol for TCP */
|
||||
#define IPPROTO_IP IPPROTO_IP
|
||||
IPPROTO_ICMP = 1, /* Internet Control Message Protocol */
|
||||
#define IPPROTO_ICMP IPPROTO_ICMP
|
||||
IPPROTO_IGMP = 2, /* Internet Group Management Protocol */
|
||||
#define IPPROTO_IGMP IPPROTO_IGMP
|
||||
IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */
|
||||
#define IPPROTO_IPIP IPPROTO_IPIP
|
||||
IPPROTO_TCP = 6, /* Transmission Control Protocol */
|
||||
#define IPPROTO_TCP IPPROTO_TCP
|
||||
IPPROTO_EGP = 8, /* Exterior Gateway Protocol */
|
||||
#define IPPROTO_EGP IPPROTO_EGP
|
||||
IPPROTO_PUP = 12, /* PUP protocol */
|
||||
#define IPPROTO_PUP IPPROTO_PUP
|
||||
IPPROTO_UDP = 17, /* User Datagram Protocol */
|
||||
#define IPPROTO_UDP IPPROTO_UDP
|
||||
IPPROTO_IDP = 22, /* XNS IDP protocol */
|
||||
#define IPPROTO_IDP IPPROTO_IDP
|
||||
IPPROTO_TP = 29, /* SO Transport Protocol Class 4 */
|
||||
#define IPPROTO_TP IPPROTO_TP
|
||||
IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */
|
||||
IPPROTO_RSVP = 46, /* RSVP protocol */
|
||||
#define IPPROTO_DCCP IPPROTO_DCCP
|
||||
IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */
|
||||
#define IPPROTO_IPV6 IPPROTO_IPV6
|
||||
IPPROTO_RSVP = 46, /* RSVP Protocol */
|
||||
#define IPPROTO_RSVP IPPROTO_RSVP
|
||||
IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */
|
||||
|
||||
IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */
|
||||
|
||||
IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
|
||||
IPPROTO_AH = 51, /* Authentication Header protocol */
|
||||
IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */
|
||||
IPPROTO_PIM = 103, /* Protocol Independent Multicast */
|
||||
|
||||
IPPROTO_COMP = 108, /* Compression Header protocol */
|
||||
IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
|
||||
#define IPPROTO_GRE IPPROTO_GRE
|
||||
IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
|
||||
#define IPPROTO_ESP IPPROTO_ESP
|
||||
IPPROTO_AH = 51, /* Authentication Header protocol */
|
||||
#define IPPROTO_AH IPPROTO_AH
|
||||
IPPROTO_MTP = 92, /* Multicast Transport Protocol */
|
||||
#define IPPROTO_MTP IPPROTO_MTP
|
||||
IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */
|
||||
#define IPPROTO_BEETPH IPPROTO_BEETPH
|
||||
IPPROTO_ENCAP = 98, /* Encapsulation Header */
|
||||
#define IPPROTO_ENCAP IPPROTO_ENCAP
|
||||
IPPROTO_PIM = 103, /* Protocol Independent Multicast */
|
||||
#define IPPROTO_PIM IPPROTO_PIM
|
||||
IPPROTO_COMP = 108, /* Compression Header Protocol */
|
||||
#define IPPROTO_COMP IPPROTO_COMP
|
||||
IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
|
||||
#define IPPROTO_SCTP IPPROTO_SCTP
|
||||
IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */
|
||||
|
||||
IPPROTO_RAW = 255, /* Raw IP packets */
|
||||
#define IPPROTO_UDPLITE IPPROTO_UDPLITE
|
||||
IPPROTO_RAW = 255, /* Raw IP packets */
|
||||
#define IPPROTO_RAW IPPROTO_RAW
|
||||
IPPROTO_MAX
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user