Browse Source

hnetd: update to latest commit

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>
pull/632/head
Rosen Penev 12 months ago
committed by Moritz Warning
parent
commit
3dd7f27558
  1. 16
      hnetd/Makefile
  2. 71
      hnetd/patches/0001-dtls.c-Update-openssl-API-to-1.1.0.patch
  3. 2
      hnetd/patches/010-openssl-deprecated.patch
  4. 10
      hnetd/patches/020-unused.patch

16
hnetd/Makefile

@ -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

71
hnetd/patches/0001-dtls.c-Update-openssl-API-to-1.1.0.patch

@ -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;

2
hnetd/patches/010-openssl-deprecated.patch

@ -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;

10
hnetd/patches/020-unused.patch

@ -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>
Loading…
Cancel
Save