From 2fee586153323fa42d55438e5a8be72f253d1a31 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 28 Mar 2017 18:44:44 -0700 Subject: openl2tp: Fix build with musl Signed-off-by: Khem Raj Signed-off-by: Joe MacDonald --- .../openl2tp/0001-Use-1-instead-of-WAIT_ANY.patch | 29 +++++++++++++++++ .../0001-l2tp_api-Included-needed-headers.patch | 34 ++++++++++++++++++++ ...02-cli-include-fcntl.h-for-O_CREAT-define.patch | 25 +++++++++++++++ .../openl2tp/0002-user-ipv6-structures.patch | 33 ++++++++++++++++++++ ...fine-_GNU_SOURCE-for-getting-sighandler_t.patch | 35 +++++++++++++++++++++ ...linux-kernel-headers-assumptions-on-glibc.patch | 36 ++++++++++++++++++++++ 6 files changed, 192 insertions(+) create mode 100644 meta-networking/recipes-protocols/openl2tp/openl2tp/0001-Use-1-instead-of-WAIT_ANY.patch create mode 100644 meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api-Included-needed-headers.patch create mode 100644 meta-networking/recipes-protocols/openl2tp/openl2tp/0002-cli-include-fcntl.h-for-O_CREAT-define.patch create mode 100644 meta-networking/recipes-protocols/openl2tp/openl2tp/0002-user-ipv6-structures.patch create mode 100644 meta-networking/recipes-protocols/openl2tp/openl2tp/0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch create mode 100644 meta-networking/recipes-protocols/openl2tp/openl2tp/0004-Adjust-for-linux-kernel-headers-assumptions-on-glibc.patch (limited to 'meta-networking/recipes-protocols/openl2tp/openl2tp') diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-Use-1-instead-of-WAIT_ANY.patch b/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-Use-1-instead-of-WAIT_ANY.patch new file mode 100644 index 0000000000..d1ee3c5916 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-Use-1-instead-of-WAIT_ANY.patch @@ -0,0 +1,29 @@ +From 1f8d336a5cd88b87e15596d05980f6fe77a0f226 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 28 Mar 2017 11:28:41 -0700 +Subject: [PATCH 1/4] Use -1 instead of WAIT_ANY + +WAIT_ANY is not supported by POSIX and some C libraries +e.g. musl do not define this. + +Signed-off-by: Khem Raj +--- + usl/usl_pid.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usl/usl_pid.c b/usl/usl_pid.c +index 103458b..9819473 100644 +--- a/usl/usl_pid.c ++++ b/usl/usl_pid.c +@@ -78,7 +78,7 @@ int usl_pid_reap_children(int waitfor) + + /* Wait for processes in our process group. */ + +- while (((pid = waitpid(WAIT_ANY, &status, (waitfor ? 0: WNOHANG))) != -1) && (pid != 0)) { ++ while (((pid = waitpid(-1, &status, (waitfor ? 0: WNOHANG))) != -1) && (pid != 0)) { + have_callback = 0; + usl_list_for_each(walk, tmp, &usl_child_list) { + child = usl_list_entry(walk, struct usl_pid_child, list); +-- +2.12.1 + diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api-Included-needed-headers.patch b/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api-Included-needed-headers.patch new file mode 100644 index 0000000000..c50f68e65d --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api-Included-needed-headers.patch @@ -0,0 +1,34 @@ +From 25dce20a75bc84ae9e4ec640590cef0c12750789 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 28 Mar 2017 17:48:13 -0700 +Subject: [PATCH 1/2] l2tp_api: Included needed headers + +These are flagged by musl + +Signed-off-by: Khem Raj +--- + l2tp_api.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/l2tp_api.c b/l2tp_api.c +index d16f80e..9d6f60a 100644 +--- a/l2tp_api.c ++++ b/l2tp_api.c +@@ -22,9 +22,12 @@ + * Each module implements the required RPC xxx_1_svc() callbacks which + * are called directly by the RPC library. + */ +- ++#define _GNU_SOURCE ++#include ++#include ++#include + #include +-#include ++//#include + + #include "usl.h" + +-- +2.12.1 + diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-cli-include-fcntl.h-for-O_CREAT-define.patch b/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-cli-include-fcntl.h-for-O_CREAT-define.patch new file mode 100644 index 0000000000..9df32658a0 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-cli-include-fcntl.h-for-O_CREAT-define.patch @@ -0,0 +1,25 @@ +From 2d633f4c18ff3cb52234449fd86a0a63b55d669b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 28 Mar 2017 11:31:55 -0700 +Subject: [PATCH 2/4] cli: include fcntl.h for O_CREAT define + +Signed-off-by: Khem Raj +--- + cli/cli_readline.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/cli/cli_readline.c b/cli/cli_readline.c +index 097ed6a..127136c 100644 +--- a/cli/cli_readline.c ++++ b/cli/cli_readline.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + + #include +-- +2.12.1 + diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-user-ipv6-structures.patch b/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-user-ipv6-structures.patch new file mode 100644 index 0000000000..3f8bcaa483 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-user-ipv6-structures.patch @@ -0,0 +1,33 @@ +From a41cbeee3cf660663a9baac80545050a8d960898 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 28 Mar 2017 18:09:58 -0700 +Subject: [PATCH 2/2] user ipv6 structures + +Signed-off-by: Khem Raj +--- + l2tp_api.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/l2tp_api.c b/l2tp_api.c +index 9d6f60a..f0946fd 100644 +--- a/l2tp_api.c ++++ b/l2tp_api.c +@@ -450,10 +450,12 @@ int l2tp_api_rpc_check_request(SVCXPRT *xprt) + * non-loopback interface, reject the request. + */ + if ((!l2tp_opt_remote_rpc) && +- ((xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) && +- (xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_ANY)))) { ++ ((xprt->xp_raddr.sin6_addr.s6_addr != htonl(INADDR_LOOPBACK)) && ++ (xprt->xp_raddr.sin6_addr.s6_addr != htonl(INADDR_ANY)))) { ++ char straddr[INET6_ADDRSTRLEN]; ++ inet_ntop(AF_INET6, &xprt->xp_raddr.sin6_addr, straddr, sizeof(straddr)); + if (l2tp_opt_trace_flags & L2TP_DEBUG_API) { +- l2tp_log(LOG_ERR, "Rejecting RPC request from %s", inet_ntoa(xprt->xp_raddr.sin_addr)); ++ l2tp_log(LOG_ERR, "Rejecting RPC request from %s", straddr); + } + svcerr_auth(xprt, AUTH_TOOWEAK); + return -EPERM; +-- +2.12.1 + diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch b/meta-networking/recipes-protocols/openl2tp/openl2tp/0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch new file mode 100644 index 0000000000..e05be1bbb4 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch @@ -0,0 +1,35 @@ +From 74fe72583472bcc3c89a52839cac2ebbad6c8a74 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 28 Mar 2017 11:34:52 -0700 +Subject: [PATCH 3/4] cli: Define _GNU_SOURCE for getting sighandler_t + +Signed-off-by: Khem Raj +--- + cli/cli_readline.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cli/cli_readline.c b/cli/cli_readline.c +index 127136c..931779b 100644 +--- a/cli/cli_readline.c ++++ b/cli/cli_readline.c +@@ -17,7 +17,7 @@ + * Boston, MA 02110-1301 USA + * + *****************************************************************************/ +- ++#define _GNU_SOURCE + #include + #include + #include +@@ -634,7 +634,7 @@ static void cli_rl_uninstall_signal_handlers(void) + + static int cli_rl_install_signal_handlers(void) + { +- __sighandler_t handler; ++ sighandler_t handler; + + rl_catch_signals = 0; + rl_clear_signals(); +-- +2.12.1 + diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/0004-Adjust-for-linux-kernel-headers-assumptions-on-glibc.patch b/meta-networking/recipes-protocols/openl2tp/openl2tp/0004-Adjust-for-linux-kernel-headers-assumptions-on-glibc.patch new file mode 100644 index 0000000000..0fcba6546a --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0004-Adjust-for-linux-kernel-headers-assumptions-on-glibc.patch @@ -0,0 +1,36 @@ +From ede4ae8e25f9fb746a6f4e076d0ef029938d2880 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 28 Mar 2017 11:46:56 -0700 +Subject: [PATCH 4/4] Adjust for linux-kernel headers assumptions on glibc + +Fixes build issues e.g. + +In file included from /mnt/a/build/tmp-musl/work/cortexa7hf-neon-vfpv4-oe-linux-musleabi/openl2tp/1.8-r0/recipe-sysroot/usr/include/linux/if_pppox.h:24: +/mnt/a/build/tmp-musl/work/cortexa7hf-neon-vfpv4-oe-linux-musleabi/openl2tp/1.8-r0/recipe-sysroot/usr/include/linux/if.h:97:2: error: expected identifier + IFF_LOWER_UP = 1<<16, /* __volatile__ */ + ^ + +Signed-off-by: Khem Raj +--- + plugins/ppp_unix.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/plugins/ppp_unix.c b/plugins/ppp_unix.c +index 869066f..5c1e44f 100644 +--- a/plugins/ppp_unix.c ++++ b/plugins/ppp_unix.c +@@ -21,6 +21,11 @@ + * Plugin to use the standard UNIX pppd + */ + ++/* hack to make sure kernel headers understand that libc (musl) ++ * does define IFF_LOWER_UP et al. ++ */ ++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0 ++ + #include + #include + #include +-- +2.12.1 + -- cgit 1.2.3-korg