diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-03-28 18:44:44 -0700 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2017-04-25 15:55:35 -0400 |
commit | 2fee586153323fa42d55438e5a8be72f253d1a31 (patch) | |
tree | 5356dad2193354fb488d7dbab7cc9e807980946d /meta-networking/recipes-protocols | |
parent | b57ae5a2bdd25b9ead53561d36160b087ca56565 (diff) | |
download | meta-openembedded-2fee586153323fa42d55438e5a8be72f253d1a31.tar.gz |
openl2tp: Fix build with musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking/recipes-protocols')
7 files changed, 208 insertions, 1 deletions
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 000000000..d1ee3c591 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-Use-1-instead-of-WAIT_ANY.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | From 1f8d336a5cd88b87e15596d05980f6fe77a0f226 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 28 Mar 2017 11:28:41 -0700 | ||
4 | Subject: [PATCH 1/4] Use -1 instead of WAIT_ANY | ||
5 | |||
6 | WAIT_ANY is not supported by POSIX and some C libraries | ||
7 | e.g. musl do not define this. | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | usl/usl_pid.c | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/usl/usl_pid.c b/usl/usl_pid.c | ||
15 | index 103458b..9819473 100644 | ||
16 | --- a/usl/usl_pid.c | ||
17 | +++ b/usl/usl_pid.c | ||
18 | @@ -78,7 +78,7 @@ int usl_pid_reap_children(int waitfor) | ||
19 | |||
20 | /* Wait for processes in our process group. */ | ||
21 | |||
22 | - while (((pid = waitpid(WAIT_ANY, &status, (waitfor ? 0: WNOHANG))) != -1) && (pid != 0)) { | ||
23 | + while (((pid = waitpid(-1, &status, (waitfor ? 0: WNOHANG))) != -1) && (pid != 0)) { | ||
24 | have_callback = 0; | ||
25 | usl_list_for_each(walk, tmp, &usl_child_list) { | ||
26 | child = usl_list_entry(walk, struct usl_pid_child, list); | ||
27 | -- | ||
28 | 2.12.1 | ||
29 | |||
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 000000000..c50f68e65 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0001-l2tp_api-Included-needed-headers.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From 25dce20a75bc84ae9e4ec640590cef0c12750789 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 28 Mar 2017 17:48:13 -0700 | ||
4 | Subject: [PATCH 1/2] l2tp_api: Included needed headers | ||
5 | |||
6 | These are flagged by musl | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | l2tp_api.c | 7 +++++-- | ||
11 | 1 file changed, 5 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/l2tp_api.c b/l2tp_api.c | ||
14 | index d16f80e..9d6f60a 100644 | ||
15 | --- a/l2tp_api.c | ||
16 | +++ b/l2tp_api.c | ||
17 | @@ -22,9 +22,12 @@ | ||
18 | * Each module implements the required RPC xxx_1_svc() callbacks which | ||
19 | * are called directly by the RPC library. | ||
20 | */ | ||
21 | - | ||
22 | +#define _GNU_SOURCE | ||
23 | +#include <sys/types.h> | ||
24 | +#include <rpc/types.h> | ||
25 | +#include <rpc/xdr.h> | ||
26 | #include <rpc/pmap_clnt.h> | ||
27 | -#include <net/ethernet.h> | ||
28 | +//#include <netinet/in.h> | ||
29 | |||
30 | #include "usl.h" | ||
31 | |||
32 | -- | ||
33 | 2.12.1 | ||
34 | |||
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 000000000..9df32658a --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-cli-include-fcntl.h-for-O_CREAT-define.patch | |||
@@ -0,0 +1,25 @@ | |||
1 | From 2d633f4c18ff3cb52234449fd86a0a63b55d669b Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 28 Mar 2017 11:31:55 -0700 | ||
4 | Subject: [PATCH 2/4] cli: include fcntl.h for O_CREAT define | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | cli/cli_readline.c | 1 + | ||
9 | 1 file changed, 1 insertion(+) | ||
10 | |||
11 | diff --git a/cli/cli_readline.c b/cli/cli_readline.c | ||
12 | index 097ed6a..127136c 100644 | ||
13 | --- a/cli/cli_readline.c | ||
14 | +++ b/cli/cli_readline.c | ||
15 | @@ -24,6 +24,7 @@ | ||
16 | #include <sys/file.h> | ||
17 | #include <sys/stat.h> | ||
18 | #include <sys/errno.h> | ||
19 | +#include <fcntl.h> | ||
20 | #include <signal.h> | ||
21 | |||
22 | #include <readline/readline.h> | ||
23 | -- | ||
24 | 2.12.1 | ||
25 | |||
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 000000000..3f8bcaa48 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0002-user-ipv6-structures.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From a41cbeee3cf660663a9baac80545050a8d960898 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 28 Mar 2017 18:09:58 -0700 | ||
4 | Subject: [PATCH 2/2] user ipv6 structures | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | l2tp_api.c | 8 +++++--- | ||
9 | 1 file changed, 5 insertions(+), 3 deletions(-) | ||
10 | |||
11 | diff --git a/l2tp_api.c b/l2tp_api.c | ||
12 | index 9d6f60a..f0946fd 100644 | ||
13 | --- a/l2tp_api.c | ||
14 | +++ b/l2tp_api.c | ||
15 | @@ -450,10 +450,12 @@ int l2tp_api_rpc_check_request(SVCXPRT *xprt) | ||
16 | * non-loopback interface, reject the request. | ||
17 | */ | ||
18 | if ((!l2tp_opt_remote_rpc) && | ||
19 | - ((xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) && | ||
20 | - (xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_ANY)))) { | ||
21 | + ((xprt->xp_raddr.sin6_addr.s6_addr != htonl(INADDR_LOOPBACK)) && | ||
22 | + (xprt->xp_raddr.sin6_addr.s6_addr != htonl(INADDR_ANY)))) { | ||
23 | + char straddr[INET6_ADDRSTRLEN]; | ||
24 | + inet_ntop(AF_INET6, &xprt->xp_raddr.sin6_addr, straddr, sizeof(straddr)); | ||
25 | if (l2tp_opt_trace_flags & L2TP_DEBUG_API) { | ||
26 | - l2tp_log(LOG_ERR, "Rejecting RPC request from %s", inet_ntoa(xprt->xp_raddr.sin_addr)); | ||
27 | + l2tp_log(LOG_ERR, "Rejecting RPC request from %s", straddr); | ||
28 | } | ||
29 | svcerr_auth(xprt, AUTH_TOOWEAK); | ||
30 | return -EPERM; | ||
31 | -- | ||
32 | 2.12.1 | ||
33 | |||
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 000000000..e05be1bbb --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From 74fe72583472bcc3c89a52839cac2ebbad6c8a74 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 28 Mar 2017 11:34:52 -0700 | ||
4 | Subject: [PATCH 3/4] cli: Define _GNU_SOURCE for getting sighandler_t | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | cli/cli_readline.c | 4 ++-- | ||
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
10 | |||
11 | diff --git a/cli/cli_readline.c b/cli/cli_readline.c | ||
12 | index 127136c..931779b 100644 | ||
13 | --- a/cli/cli_readline.c | ||
14 | +++ b/cli/cli_readline.c | ||
15 | @@ -17,7 +17,7 @@ | ||
16 | * Boston, MA 02110-1301 USA | ||
17 | * | ||
18 | *****************************************************************************/ | ||
19 | - | ||
20 | +#define _GNU_SOURCE | ||
21 | #include <stdio.h> | ||
22 | #include <unistd.h> | ||
23 | #include <sys/types.h> | ||
24 | @@ -634,7 +634,7 @@ static void cli_rl_uninstall_signal_handlers(void) | ||
25 | |||
26 | static int cli_rl_install_signal_handlers(void) | ||
27 | { | ||
28 | - __sighandler_t handler; | ||
29 | + sighandler_t handler; | ||
30 | |||
31 | rl_catch_signals = 0; | ||
32 | rl_clear_signals(); | ||
33 | -- | ||
34 | 2.12.1 | ||
35 | |||
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 000000000..0fcba6546 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/0004-Adjust-for-linux-kernel-headers-assumptions-on-glibc.patch | |||
@@ -0,0 +1,36 @@ | |||
1 | From ede4ae8e25f9fb746a6f4e076d0ef029938d2880 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 28 Mar 2017 11:46:56 -0700 | ||
4 | Subject: [PATCH 4/4] Adjust for linux-kernel headers assumptions on glibc | ||
5 | |||
6 | Fixes build issues e.g. | ||
7 | |||
8 | 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: | ||
9 | /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 | ||
10 | IFF_LOWER_UP = 1<<16, /* __volatile__ */ | ||
11 | ^ | ||
12 | |||
13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
14 | --- | ||
15 | plugins/ppp_unix.c | 5 +++++ | ||
16 | 1 file changed, 5 insertions(+) | ||
17 | |||
18 | diff --git a/plugins/ppp_unix.c b/plugins/ppp_unix.c | ||
19 | index 869066f..5c1e44f 100644 | ||
20 | --- a/plugins/ppp_unix.c | ||
21 | +++ b/plugins/ppp_unix.c | ||
22 | @@ -21,6 +21,11 @@ | ||
23 | * Plugin to use the standard UNIX pppd | ||
24 | */ | ||
25 | |||
26 | +/* hack to make sure kernel headers understand that libc (musl) | ||
27 | + * does define IFF_LOWER_UP et al. | ||
28 | + */ | ||
29 | +#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0 | ||
30 | + | ||
31 | #include <unistd.h> | ||
32 | #include <fcntl.h> | ||
33 | #include <sys/types.h> | ||
34 | -- | ||
35 | 2.12.1 | ||
36 | |||
diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb b/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb index 67118d8d6..e1670b3ae 100644 --- a/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb | |||
@@ -16,14 +16,28 @@ SRC_URI = "ftp://ftp.openl2tp.org/releases/${BP}/${BP}.tar.gz \ | |||
16 | file://openl2tp-simplify-gcc-warning-hack.patch \ | 16 | file://openl2tp-simplify-gcc-warning-hack.patch \ |
17 | file://Makefile-obey-LDFLAGS.patch \ | 17 | file://Makefile-obey-LDFLAGS.patch \ |
18 | file://0001-test-pppd_dummy.c-Fix-return-value.patch \ | 18 | file://0001-test-pppd_dummy.c-Fix-return-value.patch \ |
19 | file://0001-Use-1-instead-of-WAIT_ANY.patch \ | ||
20 | file://0002-cli-include-fcntl.h-for-O_CREAT-define.patch \ | ||
21 | file://0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch \ | ||
22 | file://0001-l2tp_api-Included-needed-headers.patch \ | ||
23 | " | ||
24 | |||
25 | SRC_URI_append_libc-musl = "\ | ||
26 | file://0004-Adjust-for-linux-kernel-headers-assumptions-on-glibc.patch \ | ||
27 | file://0002-user-ipv6-structures.patch \ | ||
19 | " | 28 | " |
20 | SRC_URI[md5sum] = "e3d08dedfb9e6a9a1e24f6766f6dadd0" | 29 | SRC_URI[md5sum] = "e3d08dedfb9e6a9a1e24f6766f6dadd0" |
21 | SRC_URI[sha256sum] = "1c97704d4b963a87fbc0e741668d4530933991515ae9ab0dffd11b5444f4860f" | 30 | SRC_URI[sha256sum] = "1c97704d4b963a87fbc0e741668d4530933991515ae9ab0dffd11b5444f4860f" |
22 | 31 | ||
23 | inherit autotools-brokensep pkgconfig | 32 | inherit autotools-brokensep pkgconfig |
24 | 33 | ||
34 | DEPENDS_append_libc-musl = " libtirpc" | ||
35 | CPPFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc" | ||
36 | CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc" | ||
37 | LDFLAGS_append_libc-musl = " -ltirpc" | ||
38 | |||
25 | PARALLEL_MAKE = "" | 39 | PARALLEL_MAKE = "" |
26 | EXTRA_OEMAKE = 'CFLAGS="${CFLAGS} -Wno-unused-but-set-variable"' | 40 | EXTRA_OEMAKE = 'CFLAGS="${CFLAGS} -Wno-unused-but-set-variable" CPPFLAGS="${CPPFLAGS}" OPT_CFLAGS="${CFLAGS}"' |
27 | 41 | ||
28 | do_compile_prepend() { | 42 | do_compile_prepend() { |
29 | sed -i -e "s:SYS_LIBDIR=.*:SYS_LIBDIR=${libdir}:g" \ | 43 | sed -i -e "s:SYS_LIBDIR=.*:SYS_LIBDIR=${libdir}:g" \ |
@@ -34,5 +48,6 @@ do_compile_prepend() { | |||
34 | -e 's:$(CROSS_COMPILE)nm:${NM}:g' \ | 48 | -e 's:$(CROSS_COMPILE)nm:${NM}:g' \ |
35 | -e 's:$(CROSS_COMPILE)strip:${STRIP}:g' \ | 49 | -e 's:$(CROSS_COMPILE)strip:${STRIP}:g' \ |
36 | -e 's:$(CROSS_COMPILE)install:install:g' \ | 50 | -e 's:$(CROSS_COMPILE)install:install:g' \ |
51 | -e 's:CPPFLAGS-y:CPPFLAGS:g' \ | ||
37 | ${S}/Makefile | 52 | ${S}/Makefile |
38 | } | 53 | } |