logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: b1154e287d7f21cad585f991f28c45f07705b993
parent 075e37159d9081c2b9191a647a00acfbeabebb1c
Author: Michael Forney <mforney@mforney.org>
Date:   Sun, 11 Aug 2019 04:03:35 +0000

hostap: Fix some portability issues

Diffstat:

M.gitmodules1+
Mpkg/hostap/gen.lua4++--
Apkg/hostap/patch/0001-eloop-Prevent-stray-semicolons-in-struct-specifier.patch52++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/hostap/patch/0002-Avoid-statement-expressions-for-get_aligned_le.patch47+++++++++++++++++++++++++++++++++++++++++++++++
Apkg/hostap/patch/0003-Avoid-unnecessary-VLA.patch25+++++++++++++++++++++++++
Apkg/hostap/patch/0004-Prevent-reference-to-undefined-symbol-with-CONFIG_NO.patch33+++++++++++++++++++++++++++++++++
Mpkg/hostap/ver2+-
7 files changed, 161 insertions(+), 3 deletions(-)

diff --git a/.gitmodules b/.gitmodules @@ -78,6 +78,7 @@ [submodule "pkg/hostap/src"] path = pkg/hostap/src url = git://w1.fi/hostap.git + ignore = all [submodule "pkg/ii/src"] path = pkg/ii/src url = git://git.suckless.org/ii diff --git a/pkg/hostap/gen.lua b/pkg/hostap/gen.lua @@ -11,7 +11,7 @@ pkg.deps = { 'pkg/libnl/headers', } -lib('libcommon.a', 'src/utils/(common.c eloop.c os_unix.c wpa_debug.c)') +lib('libcommon.a', 'src/utils/(common.c eloop.c os_unix.c wpabuf.c wpa_debug.c)') exe('bin/wpa_supplicant', [[ src/ap/( @@ -53,7 +53,7 @@ exe('bin/wpa_supplicant', [[ wpa.c wpa_ie.c ) - src/utils/(bitfield.c radiotap.c wpabuf.c) + src/utils/(bitfield.c radiotap.c) wpa_supplicant/( blacklist.c bss.c diff --git a/pkg/hostap/patch/0001-eloop-Prevent-stray-semicolons-in-struct-specifier.patch b/pkg/hostap/patch/0001-eloop-Prevent-stray-semicolons-in-struct-specifier.patch @@ -0,0 +1,52 @@ +From f36da3297eeb6b2363bcede62a72f567cd971617 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sun, 11 Aug 2019 03:18:22 +0000 +Subject: [PATCH] eloop: Prevent stray semicolons in struct specifier + +--- + src/utils/eloop.c | 8 ++++---- + src/utils/trace.h | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/utils/eloop.c b/src/utils/eloop.c +index bb375be10..b82853308 100644 +--- a/src/utils/eloop.c ++++ b/src/utils/eloop.c +@@ -44,8 +44,8 @@ struct eloop_sock { + void *eloop_data; + void *user_data; + eloop_sock_handler handler; +- WPA_TRACE_REF(eloop); +- WPA_TRACE_REF(user); ++ WPA_TRACE_REF(eloop) ++ WPA_TRACE_REF(user) + WPA_TRACE_INFO + }; + +@@ -55,8 +55,8 @@ struct eloop_timeout { + void *eloop_data; + void *user_data; + eloop_timeout_handler handler; +- WPA_TRACE_REF(eloop); +- WPA_TRACE_REF(user); ++ WPA_TRACE_REF(eloop) ++ WPA_TRACE_REF(user) + WPA_TRACE_INFO + }; + +diff --git a/src/utils/trace.h b/src/utils/trace.h +index d1636de07..43bc03f1e 100644 +--- a/src/utils/trace.h ++++ b/src/utils/trace.h +@@ -23,7 +23,7 @@ struct wpa_trace_ref { + const void *addr; + WPA_TRACE_INFO + }; +-#define WPA_TRACE_REF(name) struct wpa_trace_ref wpa_trace_ref_##name ++#define WPA_TRACE_REF(name) struct wpa_trace_ref wpa_trace_ref_##name; + + #define wpa_trace_dump(title, ptr) \ + wpa_trace_dump_func((title), (ptr)->btrace, (ptr)->btrace_num) +-- +2.22.0 + diff --git a/pkg/hostap/patch/0002-Avoid-statement-expressions-for-get_aligned_le.patch b/pkg/hostap/patch/0002-Avoid-statement-expressions-for-get_aligned_le.patch @@ -0,0 +1,47 @@ +From 9698f90ccec779f7812a9aa550a6b77feefb52e3 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sun, 11 Aug 2019 03:41:23 +0000 +Subject: [PATCH] Avoid statement expressions for get_aligned_le* + +--- + src/utils/platform.h | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/src/utils/platform.h b/src/utils/platform.h +index 813987eb6..1aa9dc069 100644 +--- a/src/utils/platform.h ++++ b/src/utils/platform.h +@@ -4,18 +4,18 @@ + #include "includes.h" + #include "common.h" + +-#define le16_to_cpu le_to_host16 +-#define le32_to_cpu le_to_host32 ++static inline u16 get_unaligned_le16(void *p) ++{ ++ u16 v; ++ memcpy(&v, p, sizeof(v)); ++ return le_to_host16(v); ++} + +-#define get_unaligned(p) \ +-({ \ +- struct packed_dummy_struct { \ +- typeof(*(p)) __val; \ +- } __attribute__((packed)) *__ptr = (void *) (p); \ +- \ +- __ptr->__val; \ +-}) +-#define get_unaligned_le16(p) le16_to_cpu(get_unaligned((le16 *)(p))) +-#define get_unaligned_le32(p) le32_to_cpu(get_unaligned((le32 *)(p))) ++static inline u32 get_unaligned_le32(void *p) ++{ ++ u32 v; ++ memcpy(&v, p, sizeof(v)); ++ return le_to_host32(v); ++} + + #endif /* PLATFORM_H */ +-- +2.22.0 + diff --git a/pkg/hostap/patch/0003-Avoid-unnecessary-VLA.patch b/pkg/hostap/patch/0003-Avoid-unnecessary-VLA.patch @@ -0,0 +1,25 @@ +From 936dcefafa77e985a9e8dd2b6f5ef96df16d4c03 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sun, 11 Aug 2019 03:44:24 +0000 +Subject: [PATCH] Avoid unnecessary VLA + +--- + src/utils/os_unix.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c +index 800c50772..447dae31b 100644 +--- a/src/utils/os_unix.c ++++ b/src/utils/os_unix.c +@@ -801,7 +801,7 @@ int os_exec(const char *program, const char *arg, int wait_completion) + + if (pid == 0) { + /* run the external command in the child process */ +- const int MAX_ARG = 30; ++ enum { MAX_ARG = 30 }; + char *_program, *_arg, *pos; + char *argv[MAX_ARG + 1]; + int i; +-- +2.22.0 + diff --git a/pkg/hostap/patch/0004-Prevent-reference-to-undefined-symbol-with-CONFIG_NO.patch b/pkg/hostap/patch/0004-Prevent-reference-to-undefined-symbol-with-CONFIG_NO.patch @@ -0,0 +1,33 @@ +From 5fba603af060a3fd3f0436213527b4b2b74cbd0d Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sun, 11 Aug 2019 04:00:13 +0000 +Subject: [PATCH] Prevent reference to undefined symbol with CONFIG_NO_RADIUS + +--- + src/radius/radius.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/radius/radius.h b/src/radius/radius.h +index 630c0f9d0..dd013c415 100644 +--- a/src/radius/radius.h ++++ b/src/radius/radius.h +@@ -296,6 +296,7 @@ char * radius_msg_get_tunnel_password(struct radius_msg *msg, int *keylen, + const u8 *secret, size_t secret_len, + struct radius_msg *sent_msg, size_t n); + ++#ifndef CONFIG_NO_RADIUS + static inline int radius_msg_add_attr_int32(struct radius_msg *msg, u8 type, + u32 value) + { +@@ -315,6 +316,8 @@ static inline int radius_msg_get_attr_int32(struct radius_msg *msg, u8 type, + *value = ntohl(val); + return 0; + } ++#endif /* CONFIG_NO_RADIUS */ ++ + int radius_msg_get_attr_ptr(struct radius_msg *msg, u8 type, u8 **buf, + size_t *len, const u8 *start); + int radius_msg_count_attr(struct radius_msg *msg, u8 type, int min_len); +-- +2.22.0 + diff --git a/pkg/hostap/ver b/pkg/hostap/ver @@ -1 +1 @@ -2.8 r0 +2.8 r1