git: 17a45735bde9 - main - net/wireguard-kmod: Chase udp_tun_func_t typedef change in FreeBSD 14-current (bb77f0)

From: Bernhard Froehlich <decke_at_FreeBSD.org>
Date: Wed, 21 Dec 2022 14:01:25 UTC
The branch main has been updated by decke:

URL: https://cgit.FreeBSD.org/ports/commit/?id=17a45735bde9d35b8bbdf2c72145573d8b8abf09

commit 17a45735bde9d35b8bbdf2c72145573d8b8abf09
Author:     Bernhard Froehlich <decke@FreeBSD.org>
AuthorDate: 2022-12-21 14:00:26 +0000
Commit:     Bernhard Froehlich <decke@FreeBSD.org>
CommitDate: 2022-12-21 14:00:26 +0000

    net/wireguard-kmod: Chase udp_tun_func_t typedef change in FreeBSD 14-current (bb77f0)
    
    PR:             266914
    Submitted by:   Stefan Haller <stefan+freebsd@stha.de>,
                    Guido Falsi <madpilot@FreeBSD.org>
---
 net/wireguard-kmod/Makefile             |  1 +
 net/wireguard-kmod/files/patch-if__wg.c | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/net/wireguard-kmod/Makefile b/net/wireguard-kmod/Makefile
index 86f803881f82..178ef6bc3e10 100644
--- a/net/wireguard-kmod/Makefile
+++ b/net/wireguard-kmod/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	wireguard-kmod
 PORTVERSION=	0.0.20220615
+PORTREVISION=	1
 CATEGORIES=	net net-vpn
 MASTER_SITES=	https://git.zx2c4.com/wireguard-freebsd/snapshot/
 DISTNAME=	wireguard-freebsd-${PORTVERSION}
diff --git a/net/wireguard-kmod/files/patch-if__wg.c b/net/wireguard-kmod/files/patch-if__wg.c
new file mode 100644
index 000000000000..283bbfc7615b
--- /dev/null
+++ b/net/wireguard-kmod/files/patch-if__wg.c
@@ -0,0 +1,32 @@
+Chase udp_tun_func_t typedef change in FreeBSD 14-current (bb77f0)
+
+Submitted by:	Stefan Haller <stefan+freebsd@stha.de>,
+		Guido Falsi <madpilot@FreeBSD.org>
+Obtained from:	https://bugs.freebsd.org/266914
+Link:		https://freshbsd.org/freebsd/src/commit/bb77f0c2049311f0661c2493838d81a5a66c449c
+--- if_wg.c.orig	2022-06-15 14:11:06 UTC
++++ if_wg.c
+@@ -693,7 +693,11 @@ wg_socket_init(struct wg_softc *sc, in_port_t port)
+ 	if (rc)
+ 		goto out;
+ 
++#if __FreeBSD_version >= 1400067
++	rc = udp_set_kernel_tunneling(so4, wg_input, NULL, sc);
++#else
+ 	rc = udp_set_kernel_tunneling(so4, (udp_tun_func_t)wg_input, NULL, sc);
++#endif
+ 	/*
+ 	 * udp_set_kernel_tunneling can only fail if there is already a tunneling function set.
+ 	 * This should never happen with a new socket.
+@@ -704,7 +708,11 @@ wg_socket_init(struct wg_softc *sc, in_port_t port)
+ 	rc = socreate(AF_INET6, &so6, SOCK_DGRAM, IPPROTO_UDP, cred, td);
+ 	if (rc)
+ 		goto out;
++#if __FreeBSD_version >= 1400067
++	rc = udp_set_kernel_tunneling(so6, wg_input, NULL, sc);
++#else
+ 	rc = udp_set_kernel_tunneling(so6, (udp_tun_func_t)wg_input, NULL, sc);
++#endif
+ 	MPASS(rc == 0);
+ #endif
+