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>
This commit is contained in:
Bernhard Froehlich 2022-12-21 14:00:26 +00:00
parent ee03c16bf5
commit 17a45735bd
No known key found for this signature in database
GPG Key ID: 4DD88C3F9F3B8333
2 changed files with 33 additions and 0 deletions

View File

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

View File

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