git: 4d98b01b6fff - main - net/wackamole: Fix build on armv7

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Tue, 16 Aug 2022 14:52:09 UTC
The branch main has been updated by eduardo:

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

commit 4d98b01b6fff7b4c1dd36d5f0849ed6dc1f3eb9e
Author:     Robert Clausecker <fuz@fuz.su>
AuthorDate: 2022-08-16 14:48:13 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2022-08-16 14:51:50 +0000

    net/wackamole: Fix build on armv7
    
     Jails may not have a bpf(4) device, but can still build with BPF.
    
     - fix the configure test for BPF detection
     - define LICENSE
     - fix two obvious bugs in the code
    
    PR:             265561
    Approved by:    maintainer timeout, >2 weeks
    MFH:            2022Q3
---
 net/wackamole/Makefile                    |  7 +++++++
 net/wackamole/files/patch-alarm.c         |  8 ++++----
 net/wackamole/files/patch-arpcache.c      | 11 +++++++++++
 net/wackamole/files/patch-config_gram.y   |  6 +++---
 net/wackamole/files/patch-configuration.c |  6 +++---
 net/wackamole/files/patch-configure       | 11 +++++++++++
 net/wackamole/files/patch-defines.h       | 11 +++++------
 net/wackamole/files/patch-ife-bpf.c       | 11 +++++++++++
 net/wackamole/files/patch-wackamole.c     |  8 ++++----
 9 files changed, 59 insertions(+), 20 deletions(-)

diff --git a/net/wackamole/Makefile b/net/wackamole/Makefile
index c5a8877dc3f5..8ba8cf5907e8 100644
--- a/net/wackamole/Makefile
+++ b/net/wackamole/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	wackamole
 PORTVERSION=	2.1.5
+PORTREVISION=	1
 CATEGORIES=	net
 MASTER_SITES=	https://BSDforge.com/projects/source/net/wackamole/ \
 		http://mirrors.omniti.com/wackamole/
@@ -7,6 +8,12 @@ MASTER_SITES=	https://BSDforge.com/projects/source/net/wackamole/ \
 MAINTAINER=	portmaster@bsdforge.com
 COMMENT=	Peer-to-peer high availability cluster
 
+# same as the net/spread license really
+LICENSE=	CNDS_OPEN-SOURCE_LICENSE
+LICENSE_NAME=	CNDS Open-Source License
+LICENSE_FILE=	${WRKSRC}/license.txt
+LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
+
 LIB_DEPENDS=	libspread.so:net/spread
 
 USES=		tar:xz
diff --git a/net/wackamole/files/patch-alarm.c b/net/wackamole/files/patch-alarm.c
index 7034c83282d1..010ad1ec45cd 100644
--- a/net/wackamole/files/patch-alarm.c
+++ b/net/wackamole/files/patch-alarm.c
@@ -1,6 +1,6 @@
---- alarm.c.orig	2014-05-06 16:24:44.652074671 -0700
-+++ alarm.c	2014-05-06 16:26:49.173062394 -0700
-@@ -93,7 +93,7 @@
+--- alarm.c.orig	2005-03-30 19:56:58 UTC
++++ alarm.c
+@@ -93,7 +93,7 @@ void wack_alarm( int32 mask, char *message, ...)
  	  timestamp[length] = ' ';
  #ifdef HAVE_SYSLOG_H
  	  if(syslog_flag)
@@ -9,7 +9,7 @@
  	  else
  #endif
  	    fwrite(timestamp, length+1, sizeof(char), stdout);
-@@ -105,7 +105,7 @@
+@@ -105,7 +105,7 @@ void wack_alarm( int32 mask, char *message, ...)
  	int len = strlen(message)+100;
  	s = malloc(len);/*estimation*/
  	vsnprintf(s,len,message, ap);
diff --git a/net/wackamole/files/patch-arpcache.c b/net/wackamole/files/patch-arpcache.c
new file mode 100644
index 000000000000..edc12dff7f1f
--- /dev/null
+++ b/net/wackamole/files/patch-arpcache.c
@@ -0,0 +1,11 @@
+--- arpcache.c.orig	2022-08-01 22:18:16 UTC
++++ arpcache.c
+@@ -153,7 +153,7 @@ void sample_arp_cache() {
+     h = arpcache_private[count].mac;
+     wack_alarm(ARPING, "Adding: (private) %s [%02x:%02x:%02x:%02x:%02x:%02x]",
+                inet_ntoa(sa->sin_addr),
+-               *(h++), *(h++), *(h++), *(h++), *(h++), *(h++));
++               h[0], h[1], h[2], h[3], h[4], h[5]);
+     count++;
+   }
+   arpcache_private[count].ip = 0;
diff --git a/net/wackamole/files/patch-config_gram.y b/net/wackamole/files/patch-config_gram.y
index d7ac0bce019c..fbb911e9a63e 100644
--- a/net/wackamole/files/patch-config_gram.y
+++ b/net/wackamole/files/patch-config_gram.y
@@ -1,6 +1,6 @@
---- config_gram.y.orig	2014-05-06 16:30:17.040722949 -0700
-+++ config_gram.y	2014-05-06 16:32:22.614815187 -0700
-@@ -106,7 +106,7 @@
+--- config_gram.y.orig	2005-11-14 17:17:53 UTC
++++ config_gram.y
+@@ -106,7 +106,7 @@ Setting		:	W_SPREAD W_EQUALS W_STRING
  			  SPIT("Setting Group: %s\n", Spread_group); }
  		|	W_LOG     W_EQUALS W_STRING
  		|	W_CONTROL W_EQUALS W_STRING
diff --git a/net/wackamole/files/patch-configuration.c b/net/wackamole/files/patch-configuration.c
index e58e93d66ff0..e7d30955a605 100644
--- a/net/wackamole/files/patch-configuration.c
+++ b/net/wackamole/files/patch-configuration.c
@@ -1,6 +1,6 @@
---- configuration.c.orig	2014-05-06 16:35:08.783140770 -0700
-+++ configuration.c	2014-05-06 16:35:58.734348535 -0700
-@@ -43,7 +43,7 @@
+--- configuration.c.orig	2003-01-08 05:58:19 UTC
++++ configuration.c
+@@ -43,7 +43,7 @@ void    Get_conf(const char *File_name, member *My)
    char    my_local_host_name[255];
    static const size_t  my_local_host_name_len=255;
    struct  hostent         *hent;
diff --git a/net/wackamole/files/patch-configure b/net/wackamole/files/patch-configure
new file mode 100644
index 000000000000..a0b6f1e88416
--- /dev/null
+++ b/net/wackamole/files/patch-configure
@@ -0,0 +1,11 @@
+--- configure.orig	2022-08-01 22:15:30 UTC
++++ configure
+@@ -8991,7 +8991,7 @@ echo "${ECHO_T}no" >&6; }
+ if test "x$IFE_OBJ" = "x" ; then
+   { echo "$as_me:$LINENO: checking for BPF" >&5
+ echo $ECHO_N "checking for BPF... $ECHO_C" >&6; }
+-  if test -c "/dev/bpf0" ; then
++  if test -f /usr/include/net/bpf.h ; then
+ 	{ echo "$as_me:$LINENO: result: yes" >&5
+ echo "${ECHO_T}yes" >&6; }
+ 
diff --git a/net/wackamole/files/patch-defines.h b/net/wackamole/files/patch-defines.h
index 84da09f03e28..08a59a9c948c 100644
--- a/net/wackamole/files/patch-defines.h
+++ b/net/wackamole/files/patch-defines.h
@@ -1,5 +1,5 @@
---- defines.h.orig	2014-05-06 16:38:13.055354417 -0700
-+++ defines.h	2014-05-06 16:42:19.536056294 -0700
+--- defines.h.orig	2005-03-30 19:56:58 UTC
++++ defines.h
 @@ -13,6 +13,9 @@
  #ifdef HAVE_STRINGS_H
  #include <strings.h>
@@ -10,7 +10,7 @@
  #ifdef HAVE_ERRNO_H
  #include <errno.h>
  #endif
-@@ -59,12 +62,12 @@
+@@ -59,11 +62,11 @@
  #ifdef HAVE_NET_ROUTE_H
  #include <net/route.h>
  #endif
@@ -19,10 +19,9 @@
 -#endif
  #ifdef HAVE_NET_BPF_H
  #include <net/bpf.h>
- #endif
++#endif
 +#ifdef HAVE_PCAP_H
 +#include <pcap.h>
-+#endif
+ #endif
  #ifdef HAVE_NET_ETHERNET_H
  #include <net/ethernet.h>
- #endif
diff --git a/net/wackamole/files/patch-ife-bpf.c b/net/wackamole/files/patch-ife-bpf.c
new file mode 100644
index 000000000000..7c736a320c74
--- /dev/null
+++ b/net/wackamole/files/patch-ife-bpf.c
@@ -0,0 +1,11 @@
+--- ife-bpf.c.orig	2022-08-01 22:25:04 UTC
++++ ife-bpf.c
+@@ -58,7 +58,7 @@ if_send_spoof_request(char *dev,
+   static unsigned char my_mac[ETH_ALEN];
+   static unsigned char bc_mac[ETH_ALEN] =
+                 {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+-  memset(&ifr, sizeof(struct ifreq), 0);
++  memset(&ifr, 0, sizeof(struct ifreq));
+   strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+   if (ioctl(_if_bpf, BIOCSETIF, (caddr_t)&ifr) < 0) {
+      perror("ioctl (BIOCSETIF)");
diff --git a/net/wackamole/files/patch-wackamole.c b/net/wackamole/files/patch-wackamole.c
index 6fb6fee7c057..8b3771b38fe3 100644
--- a/net/wackamole/files/patch-wackamole.c
+++ b/net/wackamole/files/patch-wackamole.c
@@ -1,6 +1,6 @@
---- wackamole.c.orig	2014-05-06 16:45:39.558907243 -0700
-+++ wackamole.c	2014-05-06 16:47:57.679302712 -0700
-@@ -911,7 +911,7 @@
+--- wackamole.c.orig	2014-05-06 22:24:08 UTC
++++ wackamole.c
+@@ -911,7 +911,7 @@ static  void    Acquire( entry *VE )
        wack_alarm(PRINT, "%d %s", __LINE__, if_error());
      else {
        char buffer[16];
@@ -9,7 +9,7 @@
        wack_alarm(PRINT, "  UP: %s:%s/%s",
  		iface.ifname,buffer,inet_ntoa(iface.netmask));
      }
-@@ -954,7 +954,7 @@
+@@ -954,7 +954,7 @@ static  void    Release( entry *VE )
        }
      } else {
        char buffer[16];