git: 37cf0da23dbd - main - security/fragrouter: fix build on BPF-less jails

From: Juraj Lutter <otis_at_FreeBSD.org>
Date: Fri, 11 Nov 2022 20:33:49 UTC
The branch main has been updated by otis:

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

commit 37cf0da23dbd0c1d91602d25e831a7dc0dde1224
Author:     Robert Clausecker <fuz@fuz.su>
AuthorDate: 2022-11-11 20:32:38 +0000
Commit:     Juraj Lutter <otis@FreeBSD.org>
CommitDate: 2022-11-11 20:32:38 +0000

    security/fragrouter: fix build on BPF-less jails
    
    Such jails don't have /dev/bpf0, making a crucial configure test fail.
    Fix the configure test to make the build succeed (e.g. on armv7).
    
    And while here, also assume MAINTAINER.
    
    PR:             267646
---
 security/fragrouter/Makefile                              |  5 ++++-
 security/fragrouter/files/patch-Libnet-0.99b__configure   | 15 ++++++++++++---
 .../fragrouter/files/patch-Libnet-0.99b_src_version.c     |  9 +++++++++
 security/fragrouter/files/patch-attack.c                  | 10 ++++++++++
 security/fragrouter/files/patch-fragrouter.c              | 13 +++++++++++++
 security/fragrouter/files/patch-list.c                    | 10 ++++++++++
 6 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/security/fragrouter/Makefile b/security/fragrouter/Makefile
index 98bec33da963..b9fed3f5c3f7 100644
--- a/security/fragrouter/Makefile
+++ b/security/fragrouter/Makefile
@@ -1,13 +1,16 @@
 PORTNAME=	fragrouter
 PORTVERSION=	1.6
+PORTREVISION=	1
 CATEGORIES=	security
 MASTER_SITES=	http://monkey.org/~dugsong/ \
+		http://fuz.su/~fuz/distfiles/fragrouter/ \
 		LOCAL/ohauer
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	fuz@fuz.su
 COMMENT=	Tool for testing network IDS implementations
 
 GNU_CONFIGURE=	yes
+CFLAGS+=	-Wno-pointer-sign
 
 PLIST_FILES=	sbin/fragrouter \
 		man/man8/fragrouter.8.gz
diff --git a/security/fragrouter/files/patch-Libnet-0.99b__configure b/security/fragrouter/files/patch-Libnet-0.99b__configure
index 9ff3b3166c8c..e1beb14d0aed 100644
--- a/security/fragrouter/files/patch-Libnet-0.99b__configure
+++ b/security/fragrouter/files/patch-Libnet-0.99b__configure
@@ -1,6 +1,6 @@
---- Libnet-0.99b/configure.orig	Mon Jul 26 08:08:51 1999
-+++ Libnet-0.99b/configure	Sat Jan  8 01:00:45 2000
-@@ -884,10 +884,6 @@
+--- Libnet-0.99b/configure.orig	1999-07-26 15:08:51 UTC
++++ Libnet-0.99b/configure
+@@ -884,10 +884,6 @@ fi
  
  
  
@@ -11,3 +11,12 @@
  
  # Check whether --with-pf_packet or --without-pf_packet was given.
  if test "${with_pf_packet+set}" = set; then
+@@ -1192,7 +1188,7 @@ fi
+ echo $ac_n "checking low-level packet interface type""... $ac_c" 1>&6
+ echo "configure:1194: checking low-level packet interface type" >&5
+ 
+-if test -r /dev/bpf0 ; then
++if test -r /usr/include/net/bpf.h ; then
+     LL_INT_TYPE=bpf
+     echo "$ac_t""found bpf" 1>&6
+ elif test -r /usr/include/net/pfilt.h ; then
diff --git a/security/fragrouter/files/patch-Libnet-0.99b_src_version.c b/security/fragrouter/files/patch-Libnet-0.99b_src_version.c
new file mode 100644
index 000000000000..55ef79298c35
--- /dev/null
+++ b/security/fragrouter/files/patch-Libnet-0.99b_src_version.c
@@ -0,0 +1,9 @@
+--- Libnet-0.99b/src/version.c.orig	2022-11-08 17:22:34 UTC
++++ Libnet-0.99b/src/version.c
+@@ -44,5 +44,5 @@ __print_vers(void)
+     /*
+      *  We don't check for error cos we really don't care.
+      */
+-    write(STDOUT_FILENO, banner, sizeof(banner - 1));
++    write(STDOUT_FILENO, banner, sizeof(banner) - 1);
+ }
diff --git a/security/fragrouter/files/patch-attack.c b/security/fragrouter/files/patch-attack.c
new file mode 100644
index 000000000000..dcfa07bb5218
--- /dev/null
+++ b/security/fragrouter/files/patch-attack.c
@@ -0,0 +1,10 @@
+--- attack.c.orig	2022-11-08 17:21:47 UTC
++++ attack.c
+@@ -40,6 +40,7 @@
+ 
+ #ifdef STDC_HEADERS
+ #include <stdio.h>
++#include <string.h>
+ #endif
+ #include <pcap.h>
+ #include "attack.h"
diff --git a/security/fragrouter/files/patch-fragrouter.c b/security/fragrouter/files/patch-fragrouter.c
new file mode 100644
index 000000000000..173cac0f2c04
--- /dev/null
+++ b/security/fragrouter/files/patch-fragrouter.c
@@ -0,0 +1,13 @@
+--- fragrouter.c.orig	2022-11-08 17:15:14 UTC
++++ fragrouter.c
+@@ -104,8 +104,8 @@ usage(void)
+ int
+ main(int argc, char *argv[])
+ {
+-  char c, ebuf[BUFSIZ], hops[BUFSIZ], *dev = NULL;
+-  int num = 0, type = -1, hopptr = 4;
++  char ebuf[BUFSIZ], hops[BUFSIZ], *dev = NULL;
++  int c, num = 0, type = -1, hopptr = 4;
+   attack_handler attack;
+ 
+   hops[0] = '\0';
diff --git a/security/fragrouter/files/patch-list.c b/security/fragrouter/files/patch-list.c
new file mode 100644
index 000000000000..636963b37431
--- /dev/null
+++ b/security/fragrouter/files/patch-list.c
@@ -0,0 +1,10 @@
+--- list.c.orig	2022-11-08 17:16:08 UTC
++++ list.c
+@@ -40,6 +40,7 @@
+ 
+ #ifdef STDC_HEADERS
+ #include <stdlib.h>
++#include <string.h>
+ #endif
+ 
+ #include "list.h"