git: 75d90603569e - main - net/ndproxy: fix build on FreeBSD kernel >= 14

From: Olivier Cochard <olivier_at_FreeBSD.org>
Date: Fri, 22 Dec 2023 16:07:40 UTC
The branch main has been updated by olivier:

URL: https://cgit.FreeBSD.org/ports/commit/?id=75d90603569e933e8e92d514f361c1f16557941e

commit 75d90603569e933e8e92d514f361c1f16557941e
Author:     Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2023-12-22 16:03:26 +0000
Commit:     Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2023-12-22 16:03:26 +0000

    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>
---
 net/ndproxy/Makefile              |  2 --
 net/ndproxy/files/patch-ndproxy.c | 45 +++++++++++++++++++++++++++++++++++++++
 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);
+ }