Browse Source

net-mgmt/ipgen: fix build on non-amd64, 15-CURRENT

- 15-CURRENT ditches the CLLADDR macro; replace it with LLADDR
 - cpu_in_cksum.S is mediocre assembly code that only works on amd64.
   Disable its use; the compiler will do just as good of a job.
 - assume we always have atomic_* functions on FreeBSD, even if they
   are not macros (as is the case on armv7)

Approved by:	portmgr (build fix blanket)
MFH:		2025Q2
See also:	D50065
overlay
Robert Clausecker 2 months ago
parent
commit
3adf93fcb4
  1. 1
      net-mgmt/ipgen/Makefile
  2. 23
      net-mgmt/ipgen/files/patch-gen_compat.h
  3. 14
      net-mgmt/ipgen/files/patch-gen_util.c
  4. 15
      net-mgmt/ipgen/files/patch-libpkt-GNUmakefile

1
net-mgmt/ipgen/Makefile

@ -1,5 +1,6 @@
PORTNAME= ipgen
PORTVERSION= 1.30.20240527
PORTREVISION= 1
CATEGORIES= net-mgmt
MAINTAINER= hrs@FreeBSD.org

23
net-mgmt/ipgen/files/patch-gen_compat.h

@ -0,0 +1,23 @@
--- gen/compat.h.orig 2024-05-27 06:59:46 UTC
+++ gen/compat.h
@@ -48,6 +48,7 @@
#define ETHERTYPE_FLOWCONTROL 0x8808
#endif
+#if !defined(__FreeBSD__) || defined(__i386__)
#ifndef atomic_fetchadd_32
#define atomic_fetchadd_32(t, v) __atomic_fetch_add(t, v, __ATOMIC_CONSUME)
#endif
@@ -67,10 +68,11 @@ atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval
bool ret = __atomic_compare_exchange_n(p, &cmpval, newval, false, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
return ret ? 1 : 0;
}
-#endif
+#endif /* !defined(__FreeBSD__) || defined(__i386__) */
#ifndef __unused
#define __unused __attribute__((unused))
+#endif
#endif
#endif /* _COMPAT_H_ */

14
net-mgmt/ipgen/files/patch-gen_util.c

@ -0,0 +1,14 @@
--- gen/util.c.orig 2025-05-05 17:12:32 UTC
+++ gen/util.c
@@ -351,7 +351,11 @@ getiflinkaddr(const char *ifname, struct ether_addr *a
if ((sdl->sdl_type == IFT_ETHER) &&
(sdl->sdl_alen == ETHER_ADDR_LEN)) {
+#ifdef CLLADDR
memcpy(addr, (const struct ether_addr *)CLLADDR(sdl), ETHER_ADDR_LEN);
+#else
+ memcpy(addr, (const struct ether_addr *)LLADDR(sdl), ETHER_ADDR_LEN);
+#endif
found = 1;
break;
}

15
net-mgmt/ipgen/files/patch-libpkt-GNUmakefile

@ -1,6 +1,6 @@
--- libpkt/GNUmakefile.orig 2024-02-29 01:38:00 UTC
--- libpkt/GNUmakefile.orig 2024-05-27 06:59:46 UTC
+++ libpkt/GNUmakefile
@@ -8,7 +8,6 @@ SRCS+= utils.c
@@ -8,16 +8,15 @@ SRCS+= utils.c
SRCS+= ip6pkt.c
SRCS+= utils.c
@ -8,3 +8,14 @@
CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
CFLAGS+= -Wreturn-type -Wswitch -Wshadow
CFLAGS+= -Wcast-qual -Wwrite-strings
CFLAGS+= -Wno-address-of-packed-member
# x86
-CFLAGS+= -DUSE_CPU_IN_CKSUM
+#CFLAGS+= -DUSE_CPU_IN_CKSUM
SRCS+= in_cksum.c
-SRCS+= cpu_in_cksum.S
+#SRCS+= cpu_in_cksum.S
OBJS+= $(patsubst %.S,%.o,$(SRCS:%.c=%.o))

Loading…
Cancel
Save