From 5cbd12f8dd68ae0cefdccd981049de8cad10e0a5 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Tue, 4 Aug 2026 15:05:28 +0300 Subject: [PATCH] platform_compat: guard linux/netlink.h and nl function with __linux__ (FreeBSD) --- lib/platform_compat.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/platform_compat.c b/lib/platform_compat.c index d016a715..3c1dc8f8 100644 --- a/lib/platform_compat.c +++ b/lib/platform_compat.c @@ -24,8 +24,10 @@ #include #include #include + #ifdef __linux__ #include #include + #endif #ifndef IFA_F_TEMPORARY #define IFA_F_TEMPORARY 0x01 #endif @@ -114,6 +116,7 @@ int get_interface_ipv6_by_index(uint32_t netif_index, int temporary, uint8_t* ad return found ? 0 : -1; } +#ifdef __linux__ /* get_interface_ipv6_addr_nl — netlink-based IPv6 address lookup with proper IFA_F_* flags * * getifaddrs() ifa_flags contains interface flags (IFF_UP etc.), NOT address flags @@ -194,6 +197,13 @@ int get_interface_ipv6_addr_nl(uint32_t netif_index, int prefer_stable, uint8_t* if (has_fallback) { memcpy(addr_out, fallback, 16); return 0; } return -1; } +#else +int get_interface_ipv6_addr_nl(uint32_t netif_index, int prefer_stable, uint8_t* addr_out) { + (void)netif_index; (void)prefer_stable; + if (addr_out) memset(addr_out, 0, 16); + return -1; +} +#endif uint32_t get_default_route_netif_index(int family) { if (family != AF_INET && family != AF_INET6) return 0;