-From b4edb4eebbfd35934b8bc6d7ee0e00e76a01596c Mon Sep 17 00:00:00 2001
+From 909a6f10157114e09936d2dd545175d7ed84c0fb Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Thu, 22 Dec 2016 15:26:30 +0200
Subject: [PATCH] Add the musl workaround to the libc-compat.h copy
Upstream status: libc-compat.h is a local copy of a kernel headers. A proper
musl fix must go to the kernel first.
---
- include/linux/libc-compat.h | 4 +++-
+ include/uapi/linux/libc-compat.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
-diff --git a/include/linux/libc-compat.h b/include/linux/libc-compat.h
-index f38571dabd8d..30f0b67c7a12 100644
---- a/include/linux/libc-compat.h
-+++ b/include/linux/libc-compat.h
-@@ -49,10 +49,12 @@
+diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
+index 9ab3ace08e2b..e768459d89f9 100644
+--- a/include/uapi/linux/libc-compat.h
++++ b/include/uapi/linux/libc-compat.h
+@@ -50,10 +50,12 @@
#define _LIBC_COMPAT_H
/* We have included glibc headers... */
/* GLIBC headers included first so don't define anything
* that would already be defined. */
--
-2.11.0
+2.15.0
+++ /dev/null
-From 2ac2f416072d9968a9ea2dd9f48168223a1147b0 Mon Sep 17 00:00:00 2001
-From: Baruch Siach <baruch@tkos.co.il>
-Date: Tue, 18 Jul 2017 14:09:06 +0300
-Subject: [PATCH] Fix build with uClibc-ng
-
-Add a local definition for IPPROTO_MH to fix build with uClibc-ng. As of
-version 1.0.25, the uClibc-ng netinet/in.h header does not provide this
-definition. The kernel provided definition is masked by libc-compat.h. Add
-this local fix until uClibc-ng syncs netinet/in.h with glibc.
-
-This partially reverts upstream commit a9ae195a2169 (xfrm: get #define's from
-linux includes)
-
-Signed-off-by: Baruch Siach <baruch@tkos.co.il>
----
-Upstream status: non upstreamable; local uClibc-ng compatibility fix
----
- ip/xfrm.h | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/ip/xfrm.h b/ip/xfrm.h
-index 54d80ce5e949..50b85550fb45 100644
---- a/ip/xfrm.h
-+++ b/ip/xfrm.h
-@@ -30,6 +30,10 @@
- #include <linux/xfrm.h>
- #include <linux/ipsec.h>
-
-+#ifndef IPPROTO_MH
-+# define IPPROTO_MH 135
-+#endif
-+
- #define XFRMS_RTA(x) ((struct rtattr*)(((char*)(x)) + NLMSG_ALIGN(sizeof(struct xfrm_usersa_info))))
- #define XFRMS_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct xfrm_usersa_info))
-
---
-2.13.2
-
+++ /dev/null
-From 5b55bbe48a29cf6a72cef9f424835f6244e66351 Mon Sep 17 00:00:00 2001
-From: Baruch Siach <baruch@tkos.co.il>
-Date: Tue, 26 Sep 2017 13:45:21 +0300
-Subject: [PATCH] lib: fix multiple strlcpy definition
-
-Some C libraries, like uClibc and musl, provide BSD compatible
-strlcpy(). Add check_strlcpy() to configure, and avoid defining strlcpy
-and strlcat when the C library provides them.
-
-This fixes the following static link error:
-
-.../sysroot/usr/lib/libc.a(strlcpy.os): In function `strlcpy':
-strlcpy.c:(.text+0x0): multiple definition of `strlcpy'
-../lib/libutil.a(utils.o):utils.c:(.text+0x1ddc): first defined here
-collect2: error: ld returned 1 exit status
-
-[baruch: backported from upstream submission to 4.13]
-Signed-off-by: Baruch Siach <baruch@tkos.co.il>
----
-Upstream status: https://patchwork.ozlabs.org/patch/819705/
----
- configure | 24 ++++++++++++++++++++++++
- lib/Makefile | 4 ++++
- lib/utils.c | 2 ++
- 3 files changed, 30 insertions(+)
-
-diff --git a/configure b/configure
-index 88cbdb825689..4964b998059e 100755
---- a/configure
-+++ b/configure
-@@ -325,6 +325,27 @@ EOF
- rm -f $TMPDIR/dbtest.c $TMPDIR/dbtest
- }
-
-+check_strlcpy()
-+{
-+ cat >$TMPDIR/strtest.c <<EOF
-+#include <string.h>
-+int main(int argc, char **argv) {
-+ char dst[10];
-+ strlcpy(dst, "test", sizeof(dst));
-+ return 0;
-+}
-+EOF
-+ $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1
-+ if [ $? -eq 0 ]
-+ then
-+ echo "no"
-+ else
-+ echo "NEED_STRLCPY:=y" >>Config
-+ echo "yes"
-+ fi
-+ rm -f $TMPDIR/strtest.c $TMPDIR/strtest
-+}
-+
- quiet_config()
- {
- cat <<EOF
-@@ -396,6 +417,9 @@ check_mnl
- echo -n "Berkeley DB: "
- check_berkeley_db
-
-+echo -n "need for strlcpy: "
-+check_strlcpy
-+
- echo
- echo -n "docs:"
- check_docs
-diff --git a/lib/Makefile b/lib/Makefile
-index b7b1d5685b94..227c8211786b 100644
---- a/lib/Makefile
-+++ b/lib/Makefile
-@@ -12,6 +12,10 @@ ifeq ($(HAVE_MNL),y)
- CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags)
- endif
-
-+ifeq ($(NEED_STRLCPY),y)
-+ CFLAGS += -DNEED_STRLCPY
-+endif
-+
- CFLAGS += -fPIC
-
- UTILOBJ = utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o \
-diff --git a/lib/utils.c b/lib/utils.c
-index 330ab073c206..f53dacae2e1f 100644
---- a/lib/utils.c
-+++ b/lib/utils.c
-@@ -1231,6 +1231,7 @@ int get_real_family(int rtm_type, int rtm_family)
- return rtm_family;
- }
-
-+#ifdef NEED_STRLCPY
- size_t strlcpy(char *dst, const char *src, size_t size)
- {
- if (size) {
-@@ -1249,3 +1250,4 @@ size_t strlcat(char *dst, const char *src, size_t size)
-
- return dlen + strlcpy(dst + dlen, src, size - dlen);
- }
-+#endif
---
-2.14.2
-