From 7400f14322ec8aa82ef1ca7a2fe2a0496663e31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 14 Mar 2025 23:41:09 +0800 Subject: [PATCH] Netif (DragonFly): use code of OpenBSD --- CHANGELOG.md | 2 +- src/common/netif/netif_bsd.c | 6 +++--- src/modules/localip/localip.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f453ed0ba..7deb8440c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ Features: * Improve accuracy of HDR support on Windows 11 24H2 (Display, Windows) * Improve performance of SSID detection on macOS Sequoia (Wifi, macOS, #1597) * Support warp terminal version detection on Windows (Terminal, Windows) -* Support default route detection for OpenBSD (LocalIP, OpenBSD) +* Support default route detection on OpenBSD & DragonFly BSD (LocalIP, OpenBSD / DragonFly) Logo: * Add Common Torizon OS diff --git a/src/common/netif/netif_bsd.c b/src/common/netif/netif_bsd.c index 4e43614f4..f85c39a62 100644 --- a/src/common/netif/netif_bsd.c +++ b/src/common/netif/netif_bsd.c @@ -9,7 +9,7 @@ #include #include -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) || defined(__DragonFly__) #include #endif @@ -19,7 +19,7 @@ # define ROUNDUP(a) ROUNDUP2((a), sizeof(int)) #elif defined(__NetBSD__) # define ROUNDUP(a) ROUNDUP2((a), sizeof(uint64_t)) -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__DragonFly__) # define ROUNDUP(a) ROUNDUP2((a), sizeof(int)) #elif defined(__OpenBSD__) # define ROUNDUP(a) ROUNDUP2((a), sizeof(int)) @@ -52,7 +52,7 @@ get_rt_address(struct rt_msghdr *rtm, int desired) bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex) { - #if defined(__OpenBSD__) + #if defined(__OpenBSD__) || defined(__DragonFly__) int mib[6] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_GATEWAY}; size_t needed; diff --git a/src/modules/localip/localip.c b/src/modules/localip/localip.c index 9ba08f027..2500ab32d 100644 --- a/src/modules/localip/localip.c +++ b/src/modules/localip/localip.c @@ -525,7 +525,7 @@ void ffInitLocalIpOptions(FFLocalIpOptions* options) ffOptionInitModuleArg(&options->moduleArgs, "󰩟"); options->showType = FF_LOCALIP_TYPE_IPV4_BIT | FF_LOCALIP_TYPE_PREFIX_LEN_BIT - #if !__ANDROID__ /*Permission denied*/ && !__DragonFly__ /*Doesn't work*/ + #if !__ANDROID__ /*Permission denied*/ | FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT #endif ;