blob: 29873cf7b59cd9d0b8d005562ed4a1b6c2a272bc [file] [log] [blame]
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(+)
--- 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>
--- 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 <sys/types.h>
#include <klibc/extern.h>
#include <stdint.h>