git: f8ba180a92c4 - main - net/wireguard-kmod: Fix build on 14-current after udp_tun_func_t() change

From: Bernhard Froehlich <decke_at_FreeBSD.org>
Date: Fri, 06 May 2022 18:37:15 UTC
The branch main has been updated by decke:

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

commit f8ba180a92c464ae9d4c8621c90149a3bcae25b4
Author:     Bernhard Froehlich <decke@FreeBSD.org>
AuthorDate: 2022-05-06 18:36:02 +0000
Commit:     Bernhard Froehlich <decke@FreeBSD.org>
CommitDate: 2022-05-06 18:37:09 +0000

    net/wireguard-kmod: Fix build on 14-current after udp_tun_func_t() change
    
    PR:             263297
    Submitted by:   Trond.Endrestol@ximalas.info
---
 net/wireguard-kmod/Makefile            |  1 +
 net/wireguard-kmod/files/patch-if_wg.c | 84 ++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+)

diff --git a/net/wireguard-kmod/Makefile b/net/wireguard-kmod/Makefile
index ec8eea1632f6..cb3105bb649d 100644
--- a/net/wireguard-kmod/Makefile
+++ b/net/wireguard-kmod/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	wireguard-kmod
 PORTVERSION=	0.0.20211105
+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..6ba4437fc116
--- /dev/null
+++ b/net/wireguard-kmod/files/patch-if_wg.c
@@ -0,0 +1,84 @@
+--- if_wg.c.orig	2021-11-05 14:40:17 UTC
++++ if_wg.c
+@@ -377,7 +377,11 @@ static struct wg_packet *wg_queue_dequeue_parallel(str
+ static int wg_queue_both(struct wg_queue *, struct wg_queue *, struct wg_packet *);
+ static struct wg_packet *wg_queue_dequeue_serial(struct wg_queue *);
+ static struct wg_packet *wg_queue_dequeue_parallel(struct wg_queue *);
++#if __FreeBSD_version >= 1400057
++static bool wg_input(struct mbuf *, int, struct inpcb *, const struct sockaddr *, void *);
++#else
+ static void wg_input(struct mbuf *, int, struct inpcb *, const struct sockaddr *, void *);
++#endif
+ static void wg_peer_send_staged(struct wg_peer *);
+ static int wg_clone_create(struct if_clone *, int, caddr_t);
+ static void wg_qflush(struct ifnet *);
+@@ -1946,9 +1950,15 @@ wg_queue_dequeue_parallel(struct wg_queue *parallel)
+ 	return (pkt);
+ }
+ 
++#if __FreeBSD_version >= 1400057
++static bool
++wg_input(struct mbuf *m, int offset, struct inpcb *inpcb,
++    const struct sockaddr *sa, void *_sc)
++#else
+ static void
+ wg_input(struct mbuf *m, int offset, struct inpcb *inpcb,
+     const struct sockaddr *sa, void *_sc)
++#endif
+ {
+ 	const struct sockaddr_in	*sin;
+ 	const struct sockaddr_in6	*sin6;
+@@ -1965,7 +1975,11 @@ wg_input(struct mbuf *m, int offset, struct inpcb *inp
+ 	m = m_unshare(m, M_NOWAIT);
+ 	if (!m) {
+ 		if_inc_counter(sc->sc_ifp, IFCOUNTER_IQDROPS, 1);
++#if __FreeBSD_version >= 1400057
++		return true;
++#else
+ 		return;
++#endif
+ 	}
+ 
+ 	/* Caller provided us with `sa`, no need for this header. */
+@@ -1974,13 +1988,21 @@ wg_input(struct mbuf *m, int offset, struct inpcb *inp
+ 	/* Pullup enough to read packet type */
+ 	if ((m = m_pullup(m, sizeof(uint32_t))) == NULL) {
+ 		if_inc_counter(sc->sc_ifp, IFCOUNTER_IQDROPS, 1);
++#if __FreeBSD_version >= 1400057
++		return true;
++#else
+ 		return;
++#endif
+ 	}
+ 
+ 	if ((pkt = wg_packet_alloc(m)) == NULL) {
+ 		if_inc_counter(sc->sc_ifp, IFCOUNTER_IQDROPS, 1);
+ 		m_freem(m);
++#if __FreeBSD_version >= 1400057
++		return true;
++#else
+ 		return;
++#endif
+ 	}
+ 
+ 	/* Save send/recv address and port for later. */
+@@ -2027,11 +2049,19 @@ wg_input(struct mbuf *m, int offset, struct inpcb *inp
+ 	} else {
+ 		goto error;
+ 	}
++#if __FreeBSD_version >= 1400057
++	return true;
++#else
+ 	return;
++#endif
+ error:
+ 	if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1);
+ 	wg_packet_free(pkt);
++#if __FreeBSD_version >= 1400057
++	return true;
++#else
+ 	return;
++#endif
+ }
+ 
+ static void