git: ac47064e4aac - main - net/aoe: fix build on FreeBSD 12

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Wed, 09 Aug 2023 13:04:51 UTC
The branch main has been updated by fuz:

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

commit ac47064e4aac2fedc24270363fbb1b26eaf0b2bd
Author:     Chad Fraleigh <chadf@triularity.org>
AuthorDate: 2023-08-08 16:10:56 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-08-09 13:02:39 +0000

    net/aoe: fix build on FreeBSD 12
    
    Still broken on FreeBSD 13+, but for a different reason now:
    
    aoenet.c:313:22: error: use of undeclared identifier 'ifnet'; did you mean 'ifunit'?
            IFNET_FOREACH(ifp, &ifnet, if_link) {
                                ^~~~~
                                ifunit
    
    PR:             239891
    MFH:            2023Q3
---
 net/aoe/Makefile             | 13 ++++++-----
 net/aoe/files/patch-aoenet.c | 51 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/net/aoe/Makefile b/net/aoe/Makefile
index d31894b2cad7..dc23cddfd980 100644
--- a/net/aoe/Makefile
+++ b/net/aoe/Makefile
@@ -1,23 +1,22 @@
 PORTNAME=	aoe
 PORTVERSION=	1.2.0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	net
-MASTER_SITES=	http://www.son.org/download/
+MASTER_SITES=	https://people.freebsd.org/~sson/aoe/
 DISTNAME=	${PORTNAME}-freebsd-${PORTVERSION}
 
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	FreeBSD driver for ATA over Ethernet (AoE)
 WWW=		http://www.coraid.com/support/freebsd/
 
-DEPRECATED=	Broken in all supported releases for more than an year
-EXPIRATION_DATE=	2023-08-15
+LICENSE=	BSD2CLAUSE
+
 BROKEN_aarch64=		fails to compile: redefinition of frame
 BROKEN_armv6=		fails to compile: implicit declaration of function 'cp15_pmccntr_get' is invalid in C99
 BROKEN_armv7=		fails to compile: redefinition of frame
 BROKEN_sparc64=		fails to compile: redefinition of frame
-BROKEN_FreeBSD_12=	no member named 'tqh_first' in 'struct ifnethead'
-BROKEN_FreeBSD_13=	no member named 'tqh_first' in 'struct ifnethead'
-BROKEN_FreeBSD_14=	no member named 'tqh_first' in 'struct ifnethead'
+BROKEN_FreeBSD_13=	use of undeclared identifier 'ifnet'
+BROKEN_FreeBSD_14=	use of undeclared identifier 'ifnet'
 
 USES=	kmod
 
diff --git a/net/aoe/files/patch-aoenet.c b/net/aoe/files/patch-aoenet.c
index 0fe1fe833a6b..49cdd777a39b 100644
--- a/net/aoe/files/patch-aoenet.c
+++ b/net/aoe/files/patch-aoenet.c
@@ -207,3 +207,54 @@
          	case IFT_ETHER:
          	case IFT_FASTETHER:
          	case IFT_GIGABITETHERNET:
+--- aoenet.c.orig	2019-08-14 20:53:51.415030000 -0700
++++ aoenet.c	2019-08-14 20:58:53.326160000 -0700
+@@ -85,6 +85,12 @@
+ #endif
+ #define IFLISTSZ 1024
+ 
++#if	__FreeBSD_version >= 1200000
++#define	IFNET_FOREACH(v, h, e)	CK_STAILQ_FOREACH(v, h, e)
++#else
++#define	IFNET_FOREACH(v, h, e)	TAILQ_FOREACH(v, h, e)
++#endif
++
+ static char aoe_iflist[IFLISTSZ];
+ 
+ static int sysctl_aoe_iflist(SYSCTL_HANDLER_ARGS);
+@@ -304,7 +310,7 @@
+ 	h->ah_cmd = AOECMD_CFG;
+ 
+ 	IFNET_RLOCK();
+-	TAILQ_FOREACH(ifp, &ifnet, if_link) {
++	IFNET_FOREACH(ifp, &ifnet, if_link) {
+ 		if (!is_aoe_netif(ifp))
+ 			continue;
+ 		memcpy(h->ah_src, IFPADDR(ifp), sizeof(h->ah_src));
+@@ -506,7 +512,7 @@
+ 
+ #ifdef FORCE_NETWORK_HOOK
+ 	IFNET_RLOCK();
+-	TAILQ_FOREACH(ifp, &ifnet, if_link) {
++	IFNET_FOREACH(ifp, &ifnet, if_link) {
+ 		if (!is_aoe_netif(ifp)) {
+ 			if (ifp->if_input == aoe_ether_input)
+ 				ifp->if_input = old_ether_input;
+@@ -531,7 +537,7 @@
+ 	struct ifnet *ifp;
+ 
+ 	IFNET_RLOCK();
+-	TAILQ_FOREACH(ifp, &ifnet, if_link) {
++	IFNET_FOREACH(ifp, &ifnet, if_link) {
+ #if __FreeBSD_version >= 1100030
+         	switch (ifp->if_type) {
+ #else
+@@ -564,7 +570,7 @@
+ 	struct ifnet *ifp;
+ 
+ 	IFNET_RLOCK();
+-	TAILQ_FOREACH(ifp, &ifnet, if_link) {
++	IFNET_FOREACH(ifp, &ifnet, if_link) {
+ #if __FreeBSD_version >= 1100030
+         	switch (ifp->if_type) {
+ #else