Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jun 2026 12:09:44 +0000
From:      Robert Clausecker <fuz@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 59b1c90a7f8f - main - security/nebula: fix build on 32 bit platforms
Message-ID:  <6a3e6c08.3e6ed.aa49c9a@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by fuz:

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

commit 59b1c90a7f8f718c7dbe6f097999e0dbb0e8a489
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2026-06-24 11:55:34 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2026-06-26 12:07:56 +0000

    security/nebula: fix build on 32 bit platforms
    
    The structure syscall.Iovec has 32 bit fields on 32 bit platforms,
    64 bit fields on 64 bit platforms.  Go copes poorly with this difference
    (why didn't they just use int?).  Apply a conditional patch to fix the
    build on 32 bit platforms.
    
    Approved by:    portmgr (build fix blanket)
    MFH:            2026Q2
---
 security/nebula/Makefile                           |  9 +++++++-
 .../files/extra-patch-overlay_tun__freebsd.go      | 26 ++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/security/nebula/Makefile b/security/nebula/Makefile
index 0af5e765648d..73c769bc03b7 100644
--- a/security/nebula/Makefile
+++ b/security/nebula/Makefile
@@ -25,6 +25,13 @@ PLIST_FILES=	bin/nebula \
 		bin/nebula-cert \
 		etc/${PORTNAME}/config.yml.example
 
+.include <bsd.port.pre.mk>
+
+# 32 bit architectures
+.if ${ARCH:Marmv?} || ${ARCH} == "i386" || ${ARCH} == "powerpc"
+EXTRA_PATCHES=	${PATCHDIR}/extra-patch-overlay_tun__freebsd.go
+.endif
+
 pre-patch:
 .for m in net term sys
 	${RM} -r ${WRKSRC}/vendor/golang.org/x/$m
@@ -41,4 +48,4 @@ post-install:
 	${INSTALL_DATA} ${WRKSRC}/examples/config.yml \
 		${STAGEDIR}${PREFIX}/etc/${PORTNAME}/config.yml.example
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/security/nebula/files/extra-patch-overlay_tun__freebsd.go b/security/nebula/files/extra-patch-overlay_tun__freebsd.go
new file mode 100644
index 000000000000..af9e388f3046
--- /dev/null
+++ b/security/nebula/files/extra-patch-overlay_tun__freebsd.go
@@ -0,0 +1,26 @@
+The syscall.Iovec struct has differently typed fields depending on the
+word size of the architecture.  This patch fixes the build on 32 bit
+platforms but is incorrect on 64 bit platforms.
+
+See also https://stackoverflow.com/q/79966298/417501
+
+--- overlay/tun_freebsd.go.orig	2026-06-24 11:24:23 UTC
++++ overlay/tun_freebsd.go
+@@ -107,7 +107,7 @@ func (t *tun) Read(to []byte) (int, error) {
+ 
+ 	iovecs := []syscall.Iovec{
+ 		{&head[0], 4},
+-		{&to[0], uint64(len(to))},
++		{&to[0], uint32(len(to))},
+ 	}
+ 
+ 	n, _, errno := syscall.Syscall(syscall.SYS_READV, uintptr(t.devFd), uintptr(unsafe.Pointer(&iovecs[0])), uintptr(2))
+@@ -151,7 +151,7 @@ func (t *tun) Write(from []byte) (int, error) {
+ 	}
+ 	iovecs := []syscall.Iovec{
+ 		{&head[0], 4},
+-		{&from[0], uint64(len(from))},
++		{&from[0], uint32(len(from))},
+ 	}
+ 
+ 	n, _, errno := syscall.Syscall(syscall.SYS_WRITEV, uintptr(t.devFd), uintptr(unsafe.Pointer(&iovecs[0])), uintptr(2))


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a3e6c08.3e6ed.aa49c9a>