blob: 29873cf7b59cd9d0b8d005562ed4a1b6c2a272bc [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
Brad Bishop316dfdd2018-06-25 12:45:53 -040019--- a/usr/include/net/if.h
20+++ b/usr/include/net/if.h
21@@ -1,6 +1,17 @@
22 #ifndef _NET_IF_H
23 #define _NET_IF_H
24
25+#ifndef __GLIBC__
26+#include <linux/libc-compat.h>
27+#undef __UAPI_DEF_IF_IFREQ
28+#define __UAPI_DEF_IF_IFREQ 1
29+#undef __UAPI_DEF_IF_IFNAMSIZ
30+#define __UAPI_DEF_IF_IFNAMSIZ 1
31+#undef __UAPI_DEF_IF_IFMAP
32+#define __UAPI_DEF_IF_IFMAP 1
33+#undef __UAPI_DEF_IF_NET_DEVICE_FLAGS
34+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
35+#endif
36 #include <sys/socket.h>
37 #include <sys/types.h>
38 #include <linux/if.h>
Brad Bishop316dfdd2018-06-25 12:45:53 -040039--- a/usr/include/netinet/in.h
40+++ b/usr/include/netinet/in.h
Brad Bishop6e60e8b2018-02-01 10:27:11 -050041@@ -5,6 +5,42 @@
42 #ifndef _NETINET_IN_H
43 #define _NETINET_IN_H
44
45+#ifndef __GLIBC__
46+#include <linux/libc-compat.h>
47+
48+#undef __UAPI_DEF_IN_ADDR
49+#undef __UAPI_DEF_IN_IPPROTO
50+#undef __UAPI_DEF_IN_PKTINFO
51+#undef __UAPI_DEF_IP_MREQ
52+#undef __UAPI_DEF_SOCKADDR_IN
53+#undef __UAPI_DEF_IN_CLASS
54+#undef __UAPI_DEF_IN6_ADDR
55+#undef __UAPI_DEF_IN6_ADDR_ALT
56+#undef __UAPI_DEF_SOCKADDR_IN6
57+#undef __UAPI_DEF_IPV6_MREQ
58+#undef __UAPI_DEF_IPPROTO_V6
59+#undef __UAPI_DEF_IPV6_OPTIONS
60+#undef __UAPI_DEF_IN6_PKTINFO
61+#undef __UAPI_DEF_IP6_MTUINFO
62+#undef __UAPI_DEF_IF_IFREQ
63+
64+#define __UAPI_DEF_IN_ADDR 1
65+#define __UAPI_DEF_IN_IPPROTO 1
66+#define __UAPI_DEF_IN_PKTINFO 1
67+#define __UAPI_DEF_IP_MREQ 1
68+#define __UAPI_DEF_SOCKADDR_IN 1
69+#define __UAPI_DEF_IN_CLASS 1
70+#define __UAPI_DEF_IN6_ADDR 1
71+#define __UAPI_DEF_IN6_ADDR_ALT 1
72+#define __UAPI_DEF_SOCKADDR_IN6 1
73+#define __UAPI_DEF_IPV6_MREQ 1
74+#define __UAPI_DEF_IPPROTO_V6 1
75+#define __UAPI_DEF_IPV6_OPTIONS 1
76+#define __UAPI_DEF_IN6_PKTINFO 1
77+#define __UAPI_DEF_IP6_MTUINFO 1
78+#define __UAPI_DEF_IF_IFREQ 1
79+#endif
80+
Patrick Williams92b42cb2022-09-03 06:53:57 -050081 #include <sys/types.h>
Brad Bishop6e60e8b2018-02-01 10:27:11 -050082 #include <klibc/extern.h>
83 #include <stdint.h>