From a77616ddf8fce7215106cf8786d0830da7963d59 Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Mon, 15 Jun 2026 11:32:32 +0300 Subject: [PATCH 1/3] Extend support to aarch64 and riscv64 --- netwatch/src/interfaces/bsd/freebsd.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/netwatch/src/interfaces/bsd/freebsd.rs b/netwatch/src/interfaces/bsd/freebsd.rs index 6be6d523..79578f21 100644 --- a/netwatch/src/interfaces/bsd/freebsd.rs +++ b/netwatch/src/interfaces/bsd/freebsd.rs @@ -203,9 +203,17 @@ mod arm { } // Hardcoded based on the generated values here: https://cs.opensource.google/go/x/net/+/master:route/zsys_freebsd_arm.go -#[cfg(target_arch = "aarch64")] +#[cfg(any( + target_arch = "aarch64", + target_arch = "powerpc64", + target_arch = "riscv64" +))] pub use self::arm64::*; -#[cfg(target_arch = "aarch64")] +#[cfg(any( + target_arch = "aarch64", + target_arch = "powerpc64", + target_arch = "riscv64" +))] mod arm64 { pub const SIZEOF_IF_MSGHDRL_FREE_BSD10: usize = 0xb0; pub const SIZEOF_IFA_MSGHDR_FREE_BSD10: usize = 0x14; From cbed3d2e069c9001303a6dc0f62d3c384e514b7d Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Mon, 15 Jun 2026 11:35:55 +0300 Subject: [PATCH 2/3] Rename module from arm64 to lp64, since it is no longer just for arm64 but for several architectures that have the lp64 data model. https://archive.opengroup.org/public/tech/aspen/lp64_wp.htm --- netwatch/src/interfaces/bsd/freebsd.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netwatch/src/interfaces/bsd/freebsd.rs b/netwatch/src/interfaces/bsd/freebsd.rs index 79578f21..600ddb46 100644 --- a/netwatch/src/interfaces/bsd/freebsd.rs +++ b/netwatch/src/interfaces/bsd/freebsd.rs @@ -208,13 +208,13 @@ mod arm { target_arch = "powerpc64", target_arch = "riscv64" ))] -pub use self::arm64::*; +pub use self::lp64::*; #[cfg(any( target_arch = "aarch64", target_arch = "powerpc64", target_arch = "riscv64" ))] -mod arm64 { +mod lp64 { pub const SIZEOF_IF_MSGHDRL_FREE_BSD10: usize = 0xb0; pub const SIZEOF_IFA_MSGHDR_FREE_BSD10: usize = 0x14; pub const SIZEOF_IFA_MSGHDRL_FREE_BSD10: usize = 0xb0; From 3bd8da84ab9e99fa78efb3d86d757006ad82e13c Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Mon, 15 Jun 2026 12:03:15 +0300 Subject: [PATCH 3/3] Unify amd64 module into lp64 amd64 was exactly the same code as what used to be arm64 and is now lp64. We can cover it with lp64. If we ever need to differentiate again we can split it up again without breaking the public API. --- netwatch/src/interfaces/bsd/freebsd.rs | 58 +++----------------------- 1 file changed, 5 insertions(+), 53 deletions(-) diff --git a/netwatch/src/interfaces/bsd/freebsd.rs b/netwatch/src/interfaces/bsd/freebsd.rs index 600ddb46..950ab7da 100644 --- a/netwatch/src/interfaces/bsd/freebsd.rs +++ b/netwatch/src/interfaces/bsd/freebsd.rs @@ -43,58 +43,6 @@ pub const RTM_DELMADDR: c_int = 0x10; pub const RTM_IFANNOUNCE: c_int = 0x11; pub const RTM_IEEE80211: c_int = 0x12; -// Hardcoded based on the generated values here: https://cs.opensource.google/go/x/net/+/master:route/zsys_freebsd_amd64.go -#[cfg(target_arch = "x86_64")] -pub use self::amd64::*; -#[cfg(target_arch = "x86_64")] -mod amd64 { - pub const SIZEOF_IF_MSGHDRL_FREE_BSD10: usize = 0xb0; - pub const SIZEOF_IFA_MSGHDR_FREE_BSD10: usize = 0x14; - pub const SIZEOF_IFA_MSGHDRL_FREE_BSD10: usize = 0xb0; - pub const SIZEOF_IFMA_MSGHDR_FREE_BSD10: usize = 0x10; - pub const SIZEOF_IF_ANNOUNCEMSGHDR_FREE_BSD10: usize = 0x18; - - pub const SIZEOF_RT_MSGHDR_FREE_BSD10: usize = 0x98; - pub const SIZEOF_RT_METRICS_FREE_BSD10: usize = 0x70; - - pub const SIZEOF_IF_MSGHDR_FREE_BSD7: usize = 0xa8; - pub const SIZEOF_IF_MSGHDR_FREE_BSD8: usize = 0xa8; - pub const SIZEOF_IF_MSGHDR_FREE_BSD9: usize = 0xa8; - pub const SIZEOF_IF_MSGHDR_FREE_BSD10: usize = 0xa8; - pub const SIZEOF_IF_MSGHDR_FREE_BSD11: usize = 0xa8; - - pub const SIZEOF_IF_DATA_FREE_BSD7: usize = 0x98; - pub const SIZEOF_IF_DATA_FREE_BSD8: usize = 0x98; - pub const SIZEOF_IF_DATA_FREE_BSD9: usize = 0x98; - pub const SIZEOF_IF_DATA_FREE_BSD10: usize = 0x98; - pub const SIZEOF_IF_DATA_FREE_BSD11: usize = 0x98; - - pub const SIZEOF_IF_MSGHDRL_FREE_BSD10_EMU: usize = 0xb0; - pub const SIZEOF_IFA_MSGHDR_FREE_BSD10_EMU: usize = 0x14; - pub const SIZEOF_IFA_MSGHDRL_FREE_BSD10_EMU: usize = 0xb0; - pub const SIZEOF_IFMA_MSGHDR_FREE_BSD10_EMU: usize = 0x10; - pub const SIZEOF_IF_ANNOUNCEMSGHDR_FREE_BSD10_EMU: usize = 0x18; - - pub const SIZEOF_RT_MSGHDR_FREE_BSD10_EMU: usize = 0x98; - pub const SIZEOF_RT_METRICS_FREE_BSD10_EMU: usize = 0x70; - - pub const SIZEOF_IF_MSGHDR_FREE_BSD7_EMU: usize = 0xa8; - pub const SIZEOF_IF_MSGHDR_FREE_BSD8_EMU: usize = 0xa8; - pub const SIZEOF_IF_MSGHDR_FREE_BSD9_EMU: usize = 0xa8; - pub const SIZEOF_IF_MSGHDR_FREE_BSD10_EMU: usize = 0xa8; - pub const SIZEOF_IF_MSGHDR_FREE_BSD11_EMU: usize = 0xa8; - - pub const SIZEOF_IF_DATA_FREE_BSD7_EMU: usize = 0x98; - pub const SIZEOF_IF_DATA_FREE_BSD8_EMU: usize = 0x98; - pub const SIZEOF_IF_DATA_FREE_BSD9_EMU: usize = 0x98; - pub const SIZEOF_IF_DATA_FREE_BSD10_EMU: usize = 0x98; - pub const SIZEOF_IF_DATA_FREE_BSD11_EMU: usize = 0x98; - - pub const SIZEOF_SOCKADDR_STORAGE: usize = 0x80; - pub const SIZEOF_SOCKADDR_INET: usize = 0x10; - pub const SIZEOF_SOCKADDR_INET6: usize = 0x1c; -} - // Hardcoded based on the generated values here: https://cs.opensource.google/go/x/net/+/master:route/zsys_freebsd_386.go #[cfg(target_arch = "x86")] pub use self::i686::*; @@ -202,14 +150,18 @@ mod arm { pub const SIZEOF_SOCKADDR_INET6: usize = 0x1c; } -// Hardcoded based on the generated values here: https://cs.opensource.google/go/x/net/+/master:route/zsys_freebsd_arm.go +// Hardcoded based on the generated values here: https://cs.opensource.google/go/x/net/+/master:route/zsys_freebsd_amd64.go +// These sizes are identical across all LP64 targets, so the same values apply to +// x86_64, aarch64, powerpc64 and riscv64. #[cfg(any( + target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64", target_arch = "riscv64" ))] pub use self::lp64::*; #[cfg(any( + target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64", target_arch = "riscv64"