aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch')
-rw-r--r--meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch118
1 files changed, 118 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch b/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch
new file mode 100644
index 0000000000..25f9a4a001
--- /dev/null
+++ b/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch
@@ -0,0 +1,118 @@
+From 0b0f2d5abe27b2c9587f449795f0ae3568fc3e38 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
+Date: Mon, 8 Apr 2019 23:10:43 +0200
+Subject: [PATCH 2/2] Fix build with musl
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The build issues caused by definition conflicts musl vs linux-libc headers
+(error: redefinition of ...) can be reduced to two headers:
+
+1. netinet/if_ether.h <-> linux/if_ether.h: linux-libc header plays well with
+ glibc and musl headers in case libc's variant (netinet/if_ether.h) is
+ included BEFORE linux variant [1]. We add include at two positions:
+ 1. shared/nm-default.h: This is a global which used for networkmanager and
+ is included at the very beginning of all c-files.
+ 2. libnm-core/nm-utils.h: This file makes it into installation and is used
+ by dependent packages as network-manager-applet
+2. net/if_arp. <-> linux/if_ether.h: linux-libc: Unfortunaly these files do
+ not play together in harmony. Therefore the libc variant is included early in
+ shared/nm-default.h and occurances linux/if_arp.h are removed.
+
+Note:
+Be aware that this is still nasty business: We have to trust that musl headers
+define same signatures as linux would do - just because musl-makers consider
+linux-libc headers 'notoriously broken for userspace' [2] (search for
+'error: redefinition of').
+
+[1] http://lists.openembedded.org/pipermail/openembedded-core/2019-March/280440.html
+[2] https://wiki.musl-libc.org/faq.html
+
+Upstream-Status: Pending
+
+Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
+---
+ clients/tui/nmt-device-entry.c | 1 -
+ libnm-core/nm-utils.h | 4 ++++
+ shared/nm-default.h | 3 +++
+ src/devices/nm-device.c | 2 +-
+ src/platform/nm-linux-platform.c | 1 -
+ 5 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/clients/tui/nmt-device-entry.c b/clients/tui/nmt-device-entry.c
+index 43fbbc1..3eae286 100644
+--- a/clients/tui/nmt-device-entry.c
++++ b/clients/tui/nmt-device-entry.c
+@@ -39,7 +39,6 @@
+ #include "nmt-device-entry.h"
+
+ #include <sys/socket.h>
+-#include <linux/if_arp.h>
+
+ #include "nmtui.h"
+
+diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h
+index 2b5baba..8a50131 100644
+--- a/libnm-core/nm-utils.h
++++ b/libnm-core/nm-utils.h
+@@ -25,6 +25,10 @@
+ #error "Only <NetworkManager.h> can be included directly."
+ #endif
+
++/* include as early as possible for musl */
++#include <netinet/if_ether.h>
++/* #include <net/if_arp.h> - uncoment for broken dependents?? */
++
+ #include <glib.h>
+
+ #include <netinet/in.h>
+diff --git a/shared/nm-default.h b/shared/nm-default.h
+index 26d6476..b29e8af 100644
+--- a/shared/nm-default.h
++++ b/shared/nm-default.h
+@@ -211,6 +211,9 @@
+ #endif
+
+ #include <stdlib.h>
++/* include as early as possible for musl */
++#include <netinet/if_ether.h>
++#include <net/if_arp.h>
+
+ /*****************************************************************************/
+
+diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
+index 7514fa7..d305fa5 100644
+--- a/src/devices/nm-device.c
++++ b/src/devices/nm-device.c
+@@ -24,6 +24,7 @@
+ #include "nm-device.h"
+
+ #include <netinet/in.h>
++#include <net/if.h>
+ #include <unistd.h>
+ #include <sys/ioctl.h>
+ #include <signal.h>
+@@ -32,7 +33,6 @@
+ #include <arpa/inet.h>
+ #include <fcntl.h>
+ #include <linux/if_addr.h>
+-#include <linux/if_arp.h>
+ #include <linux/rtnetlink.h>
+ #include <linux/pkt_sched.h>
+
+diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
+index 2f5c75b..d6ca6d9 100644
+--- a/src/platform/nm-linux-platform.c
++++ b/src/platform/nm-linux-platform.c
+@@ -27,7 +27,6 @@
+ #include <fcntl.h>
+ #include <libudev.h>
+ #include <linux/ip.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_link.h>
+ #include <linux/if_tun.h>
+ #include <linux/if_tunnel.h>
+--
+2.20.1
+