blob: e7a0cce837b3aa705bf1f0cfe327887ce38e3868 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From 57e3a60b23891905733bfea7a1cb78c2377cc524 Mon Sep 17 00:00:00 2001
Brad Bishop6e60e8b2018-02-01 10:27:11 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 9 Jul 2017 15:17:29 -0700
4Subject: [PATCH] Define in_* structs for non-glibc system libs
5
6These defines and structs are required to be coming from
7userspace netinet/in.h, which is being overridden in klibc
8however, libc-compat.h from kernel is only written keeping
9glibc in mind, and does not provide adequate guards for musl
10to infer that these structs should be defined in linux/in.h
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013
Brad Bishop316dfdd2018-06-25 12:45:53 -040014---
15 usr/include/net/if.h | 11 +++++++++++
16 usr/include/netinet/in.h | 36 ++++++++++++++++++++++++++++++++++++
17 2 files changed, 47 insertions(+)
18
19diff --git a/usr/include/net/if.h b/usr/include/net/if.h
20index 116a176..6246b12 100644
21--- a/usr/include/net/if.h
22+++ b/usr/include/net/if.h
23@@ -1,6 +1,17 @@
24 #ifndef _NET_IF_H
25 #define _NET_IF_H
26
27+#ifndef __GLIBC__
28+#include <linux/libc-compat.h>
29+#undef __UAPI_DEF_IF_IFREQ
30+#define __UAPI_DEF_IF_IFREQ 1
31+#undef __UAPI_DEF_IF_IFNAMSIZ
32+#define __UAPI_DEF_IF_IFNAMSIZ 1
33+#undef __UAPI_DEF_IF_IFMAP
34+#define __UAPI_DEF_IF_IFMAP 1
35+#undef __UAPI_DEF_IF_NET_DEVICE_FLAGS
36+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
37+#endif
38 #include <sys/socket.h>
39 #include <sys/types.h>
40 #include <linux/if.h>
41diff --git a/usr/include/netinet/in.h b/usr/include/netinet/in.h
42index 2952bb2..0c95bc9 100644
43--- a/usr/include/netinet/in.h
44+++ b/usr/include/netinet/in.h
Brad Bishop6e60e8b2018-02-01 10:27:11 -050045@@ -5,6 +5,42 @@
46 #ifndef _NETINET_IN_H
47 #define _NETINET_IN_H
48
49+#ifndef __GLIBC__
50+#include <linux/libc-compat.h>
51+
52+#undef __UAPI_DEF_IN_ADDR
53+#undef __UAPI_DEF_IN_IPPROTO
54+#undef __UAPI_DEF_IN_PKTINFO
55+#undef __UAPI_DEF_IP_MREQ
56+#undef __UAPI_DEF_SOCKADDR_IN
57+#undef __UAPI_DEF_IN_CLASS
58+#undef __UAPI_DEF_IN6_ADDR
59+#undef __UAPI_DEF_IN6_ADDR_ALT
60+#undef __UAPI_DEF_SOCKADDR_IN6
61+#undef __UAPI_DEF_IPV6_MREQ
62+#undef __UAPI_DEF_IPPROTO_V6
63+#undef __UAPI_DEF_IPV6_OPTIONS
64+#undef __UAPI_DEF_IN6_PKTINFO
65+#undef __UAPI_DEF_IP6_MTUINFO
66+#undef __UAPI_DEF_IF_IFREQ
67+
68+#define __UAPI_DEF_IN_ADDR 1
69+#define __UAPI_DEF_IN_IPPROTO 1
70+#define __UAPI_DEF_IN_PKTINFO 1
71+#define __UAPI_DEF_IP_MREQ 1
72+#define __UAPI_DEF_SOCKADDR_IN 1
73+#define __UAPI_DEF_IN_CLASS 1
74+#define __UAPI_DEF_IN6_ADDR 1
75+#define __UAPI_DEF_IN6_ADDR_ALT 1
76+#define __UAPI_DEF_SOCKADDR_IN6 1
77+#define __UAPI_DEF_IPV6_MREQ 1
78+#define __UAPI_DEF_IPPROTO_V6 1
79+#define __UAPI_DEF_IPV6_OPTIONS 1
80+#define __UAPI_DEF_IN6_PKTINFO 1
81+#define __UAPI_DEF_IP6_MTUINFO 1
82+#define __UAPI_DEF_IF_IFREQ 1
83+#endif
84+
85 #include <klibc/extern.h>
86 #include <stdint.h>
87 #include <endian.h> /* Must be included *before* <linux/in.h> */