aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Cochard <olivier@FreeBSD.org>2023-12-22 16:03:26 +0000
committerOlivier Cochard <olivier@FreeBSD.org>2023-12-22 16:03:26 +0000
commit75d90603569e933e8e92d514f361c1f16557941e (patch)
treeb6e9971996cb3dd2b8ec3caa88c444038eac9aef
parenteed3524ad2b51919e8a48af9ea93b39fd904c087 (diff)
downloadports-75d90603569e933e8e92d514f361c1f16557941e.tar.gz
ports-75d90603569e933e8e92d514f361c1f16557941e.zip
net/ndproxy: fix build on FreeBSD kernel >= 14
Adding support for pfil version 2 interface. Patch already submitted upstream as pull request: https://github.com/AlexandreFenyo/ndproxy/pull/6 PR: 275884 Reported by: Lorenzo Zolfanelli <dev@zolfa.nl>
-rw-r--r--net/ndproxy/Makefile2
-rw-r--r--net/ndproxy/files/patch-ndproxy.c45
2 files changed, 45 insertions, 2 deletions
diff --git a/net/ndproxy/Makefile b/net/ndproxy/Makefile
index 589a7a91b415..9f28cd533e49 100644
--- a/net/ndproxy/Makefile
+++ b/net/ndproxy/Makefile
@@ -10,8 +10,6 @@ WWW= http://www.fenyo.net/newweb/ndproxy.html
LICENSE= BSD2CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
-BROKEN_FreeBSD_14= Requires defunct pa_func
-
USES= compiler kmod
SUB_FILES= pkg-message
diff --git a/net/ndproxy/files/patch-ndproxy.c b/net/ndproxy/files/patch-ndproxy.c
new file mode 100644
index 000000000000..453283283445
--- /dev/null
+++ b/net/ndproxy/files/patch-ndproxy.c
@@ -0,0 +1,45 @@
+From 9db92ede5e52f50b8a45556c173343f9967c36ad Mon Sep 17 00:00:00 2001
+From: Lorenzo Zolfanelli <dev@zolfa.nl>
+Date: Fri, 22 Dec 2023 13:52:19 +0100
+Subject: [PATCH] fix: compatibility with new PFIL version
+
+Since FreeBSD 14 a new PFIL_VERSION has been introduced with a slight
+different data structure definition for `pfil_hook_args`.
+
+See https://github.com/freebsd/freebsd-src/commit/caf32b260ad46b17a4c1a8ce6383e37ac489f023
+for details of the new PFIL_VERSION implementation.
+
+With this fix is possible to compile against FreeBSD 14 kernel, and the
+pre-processor instruction should assure backwards compatibility.
+--- ndproxy.c.orig 2019-02-19 09:43:44 UTC
++++ ndproxy.c
+@@ -54,7 +54,7 @@ static pfil_hook_t pfh_hook;
+
+ static pfil_hook_t pfh_hook;
+
+-static void register_hook() {
++static void register_hook(void) {
+ struct pfil_hook_args pha;
+ struct pfil_link_args pla;
+
+@@ -66,7 +66,11 @@ static void register_hook() {
+ pha.pa_modname = "ndproxy";
+ pha.pa_ruleset = NULL;
+ pha.pa_rulname = "default-in6";
++#if PFIL_VERSION > 1
++ pha.pa_mbuf_chk = packet;
++#else
+ pha.pa_func = packet;
++#endif
+ pfh_hook = pfil_add_hook(&pha);
+
+ pla.pa_version = PFIL_VERSION;
+@@ -78,7 +82,7 @@ static void register_hook() {
+ hook_added = true;
+ }
+
+-static void unregister_hook() {
++static void unregister_hook(void) {
+ if (!hook_added) return;
+ pfil_remove_hook(pfh_hook);
+ }