hnetd: update to latest commit
authorRosen Penev <rosenp@gmail.com>
Wed, 16 Dec 2020 01:58:15 +0000 (17:58 -0800)
committerMoritz Warning <moritzwarning@web.de>
Thu, 17 Dec 2020 06:28:05 +0000 (06:28 +0000)
Fixed compilation with newer libubox.

libubox added a sys/stat.h include, which happens to break compilation.
The reason being __unused is a variable in musl and an attribute here.
Fixed by undefining right before including the headers.

Clean up Makefile for consistency between packages.

Refreshed patches.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
hnetd/Makefile
hnetd/patches/0001-dtls.c-Update-openssl-API-to-1.1.0.patch [deleted file]
hnetd/patches/010-openssl-deprecated.patch
hnetd/patches/020-unused.patch [new file with mode: 0644]

index 2d1b2ccabbe800a80fa4e6f07702940350a078d4..13354679822e92819507fa77454adf7beab573ec 100644 (file)
@@ -7,17 +7,19 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hnetd
-PKG_SOURCE_VERSION:=606d7e904603ad8792ac1a7ba825618df97b5a4e
-PKG_VERSION:=2016-06-28-$(PKG_SOURCE_VERSION)
-PKG_RELEASE:=3
+PKG_SOURCE_DATE:=2018-12-21
+PKG_SOURCE_VERSION:=c43766610ed30194b048bc070a3c433aec731c40
+PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=https://github.com/sbyx/hnetd.git
+PKG_SOURCE_URL:=https://github.com/sbyx/hnetd
+PKG_MIRROR_HASH:=a41baa2e3d7930cc88073b0b3f6e1fa6a4abd9fd663f2577cfde1564fa07f8f2
+
 PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
-PKG_LICENSE:=GPL-2.0
+PKG_LICENSE:=GPL-2.0-only
+PKG_LICENSE_FILES:=LICENSE
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_BUILD_PARALLEL:=1
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/cmake.mk
diff --git a/hnetd/patches/0001-dtls.c-Update-openssl-API-to-1.1.0.patch b/hnetd/patches/0001-dtls.c-Update-openssl-API-to-1.1.0.patch
deleted file mode 100644 (file)
index 36cce7d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-From a9d47c87115bf69c19e9263efb90d5753456f1b9 Mon Sep 17 00:00:00 2001
-From: Eneas U de Queiroz <cote2004-github@yahoo.com>
-Date: Thu, 13 Dec 2018 00:20:57 -0200
-Subject: [PATCH] dtls.c: Update openssl API to 1.1.0
-
-Use shims for compatiblity with previous versions.
-
-Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
----
- src/dtls.c | 20 +++++++++++++++++---
- 1 file changed, 17 insertions(+), 3 deletions(-)
-
-diff --git a/src/dtls.c b/src/dtls.c
-index ed5d408..511f724 100644
---- a/src/dtls.c
-+++ b/src/dtls.c
-@@ -38,6 +38,7 @@
- #include <string.h>
- #include <openssl/crypto.h>
- #include <openssl/err.h>
-+#include <openssl/opensslv.h>
- #include <openssl/ssl.h>
- #include <openssl/rand.h>
- #include <libubox/list.h>
-@@ -168,6 +169,19 @@ static dtls_limits_s _default_limits = {
- static bool _ssl_initialized = false;
-+#if OPENSSL_VERSION_NUMBER < 0x10100000L \
-+ || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
-+static inline void *X509_STORE_get_ex_data(X509_STORE *ctx, int idx)
-+{
-+  return CRYPTO_get_ex_data(&ctx->ex_data, idx);
-+}
-+
-+static inline int X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data)
-+{
-+  return CRYPTO_set_ex_data(&ctx->ex_data, idx, data);
-+}
-+#endif
-+
- static bool _drain_errors()
- {
-   if (!ERR_peek_error())
-@@ -863,7 +877,7 @@ ssize_t dtls_send(dtls d,
- static int _verify_cert_cb(int ok, X509_STORE_CTX *ctx)
- {
--  dtls d = CRYPTO_get_ex_data(&ctx->ctx->ex_data, 0);
-+  dtls d = X509_STORE_get_ex_data(X509_STORE_CTX_get0_store(ctx), 0);
-   if (!d)
-     {
-@@ -916,7 +930,7 @@ bool dtls_set_local_cert(dtls d, const char *certfile, const char *pkfile)
-                      |SSL_VERIFY_FAIL_IF_NO_PEER_CERT
- #endif /* DTLS_OPENSSL */
-                      , _verify_cert_cb);
--  CRYPTO_set_ex_data(&d->ssl_server_ctx->cert_store->ex_data, 0, d);
-+  X509_STORE_set_ex_data(SSL_CTX_get_cert_store(d->ssl_server_ctx), 0, d);
- #ifndef USE_ONE_CONTEXT
-   R1("client cert",
-@@ -928,7 +942,7 @@ bool dtls_set_local_cert(dtls d, const char *certfile, const char *pkfile)
-                      |SSL_VERIFY_PEER_FAIL_IF_NO_PEER_CERT
- #endif /* DTLS_OPENSSL */
-                      , _verify_cert_cb);
--  CRYPTO_set_ex_data(&d->ssl_client_ctx->cert_store->ex_data, 0, d);
-+  X509_STORE_set_ex_data(SSL_CTX_get_cert_store(d->ssl_client_ctx), 0, d);
- #endif /* !USE_ONE_CONTEXT */
-   return true;
index 23bdefb96d29e7c70eb25e5df4dea2b6d1f1c0b9..1bcfbf75c922238652a666af08d9f9407eb4a937 100644 (file)
@@ -31,7 +31,7 @@
    free(d->psk);
    d->psk = malloc(psk_len);
    if (!d->psk)
-@@ -1011,6 +1014,9 @@ bool dtls_set_psk(dtls d, const char *psk, size_t psk_len)
+@@ -1011,6 +1014,9 @@ bool dtls_set_psk(dtls d, const char *ps
    SSL_CTX_set_psk_client_callback(d->ssl_client_ctx, _client_psk);
    SSL_CTX_set_psk_server_callback(d->ssl_server_ctx, _server_psk);
    return true;
diff --git a/hnetd/patches/020-unused.patch b/hnetd/patches/020-unused.patch
new file mode 100644 (file)
index 0000000..28b35a4
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/hnetd.h
++++ b/src/hnetd.h
+@@ -39,6 +39,7 @@
+ #endif /* __APPLE__ */
++#undef __unused
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <time.h>