git: e55dbd67304e - main - net/rayfish: port to other 64-bit platforms

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Sat, 10 Oct 2026 18:16:14 UTC
The branch main has been updated by pkubaj:

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

commit e55dbd67304e77785efce0411b051a421bc03ded
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2026-10-05 09:26:02 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2026-10-10 18:10:03 +0000

    net/rayfish: port to other 64-bit platforms
    
    route_manager-0.2.13: sin_zero: [0i8; 8] against a [c_char; 8] field.
    Fixed with [0; 8].
    
    tun-rs-2.8.9: imports libc::KINFO_FILE_SIZE, which libc defines only
    for x86. Fixed by setting kf_structsize from size_of::<kinfo_file>().
    The size is 1392 on powerpc64le from both the C header and the built
    libc rlib, and the kernel accepts exactly that value.
---
 net/rayfish/Makefile                                 |  6 +++---
 ...crates_route__manager-0.2.13_src_unix__bsd_mod.rs | 11 +++++++++++
 ...rates_tun-rs-2.8.9_src_platform_freebsd_device.rs | 20 ++++++++++++++++++++
 3 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/net/rayfish/Makefile b/net/rayfish/Makefile
index 9018e130123d..794937ad8bd4 100644
--- a/net/rayfish/Makefile
+++ b/net/rayfish/Makefile
@@ -7,11 +7,11 @@ MAINTAINER=	feld@FreeBSD.org
 COMMENT=	P2P mesh VPN powered by Iroh
 WWW=		https://rayfish.xyz
 
-ONLY_FOR_ARCHS=	amd64
-ONLY_FOR_ARCHS_REASON=	route_manager crate only supports target x86_64-unknown-freebsd
-
 LICENSE=	MPL20
 
+NOT_FOR_ARCHS=	armv6 armv7 i386 powerpc powerpcspe
+NOT_FOR_ARCHS_REASON=	route_manager crate ships bindings pregenerated for LP64 targets
+
 USES=		cargo
 
 GROUPS=	rayfish
diff --git a/net/rayfish/files/patch-cargo-crates_route__manager-0.2.13_src_unix__bsd_mod.rs b/net/rayfish/files/patch-cargo-crates_route__manager-0.2.13_src_unix__bsd_mod.rs
new file mode 100644
index 000000000000..c7980ee063e7
--- /dev/null
+++ b/net/rayfish/files/patch-cargo-crates_route__manager-0.2.13_src_unix__bsd_mod.rs
@@ -0,0 +1,11 @@
+--- cargo-crates/route_manager-0.2.13/src/unix_bsd/mod.rs.orig	2006-07-24 01:21:28 UTC
++++ cargo-crates/route_manager-0.2.13/src/unix_bsd/mod.rs
+@@ -627,7 +627,7 @@ impl From<Ipv4Addr> for sockaddr_in {
+             sin_addr: in_addr {
+                 s_addr: u32::from_ne_bytes(ip.octets()),
+             },
+-            sin_zero: [0i8; 8],
++            sin_zero: [0; 8],
+         }
+     }
+ }
diff --git a/net/rayfish/files/patch-cargo-crates_tun-rs-2.8.9_src_platform_freebsd_device.rs b/net/rayfish/files/patch-cargo-crates_tun-rs-2.8.9_src_platform_freebsd_device.rs
new file mode 100644
index 000000000000..27b7d0b2105e
--- /dev/null
+++ b/net/rayfish/files/patch-cargo-crates_tun-rs-2.8.9_src_platform_freebsd_device.rs
@@ -0,0 +1,20 @@
+--- cargo-crates/tun-rs-2.8.9/src/platform/freebsd/device.rs.orig	2006-07-24 01:21:28 UTC
++++ cargo-crates/tun-rs-2.8.9/src/platform/freebsd/device.rs
+@@ -11,7 +11,7 @@ use crate::{
+ use crate::platform::unix::device::{copy_device_name, ctl, ctl_v6};
+ use libc::{
+     self, c_char, c_short, fcntl, ifreq, kinfo_file, AF_LINK, F_KINFO, IFF_RUNNING, IFF_UP,
+-    IFNAMSIZ, KINFO_FILE_SIZE, O_RDWR,
++    IFNAMSIZ, O_RDWR,
+ };
+ use std::io::ErrorKind;
+ use std::os::fd::{IntoRawFd, RawFd};
+@@ -288,7 +288,7 @@ impl DeviceImpl {
+         use std::path::PathBuf;
+         unsafe {
+             let mut path_info: kinfo_file = std::mem::zeroed();
+-            path_info.kf_structsize = KINFO_FILE_SIZE;
++            path_info.kf_structsize = std::mem::size_of::<kinfo_file>() as libc::c_int;
+             if fcntl(tun.as_raw_fd(), F_KINFO, &mut path_info as *mut _) < 0 {
+                 return Err(io::Error::last_os_error());
+             }