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