From bedb5eb6c5bbb76873f7080ebb6c7aae32643334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 10 Aug 2025 21:41:47 +0800 Subject: [PATCH] Netif (SunOS): work around a bug that fails to detect default route for IPv4 --- src/common/netif/netif_apple.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/netif/netif_apple.c b/src/common/netif/netif_apple.c index 18100f4e8..c56533062 100644 --- a/src/common/netif/netif_apple.c +++ b/src/common/netif/netif_apple.c @@ -103,7 +103,9 @@ bool ffNetifGetDefaultRouteImplV4(FFNetifDefaultRouteResult* result) while (recv(pfRoute, &rtmsg, sizeof(rtmsg), 0) > 0 && !(rtmsg.hdr.rtm_seq == 1 && rtmsg.hdr.rtm_pid == pid)) ; + #ifndef __sun // On Solaris, the RTF_GATEWAY flag is not set for default routes for some reason if ((rtmsg.hdr.rtm_flags & (RTF_UP | RTF_GATEWAY)) == (RTF_UP | RTF_GATEWAY)) + #endif { struct sockaddr_dl* sdl = (struct sockaddr_dl *)get_rt_address(&rtmsg.hdr, RTA_IFP); if (sdl @@ -174,7 +176,9 @@ bool ffNetifGetDefaultRouteImplV6(FFNetifDefaultRouteResult* result) while (recv(pfRoute, &rtmsg, sizeof(rtmsg), 0) > 0 && !(rtmsg.hdr.rtm_seq == 2 && rtmsg.hdr.rtm_pid == pid)) ; + #ifndef __sun // On Solaris, the RTF_GATEWAY flag is not set for default routes for some reason if ((rtmsg.hdr.rtm_flags & (RTF_UP | RTF_GATEWAY)) == (RTF_UP | RTF_GATEWAY)) + #endif { struct sockaddr_dl* sdl = (struct sockaddr_dl *)get_rt_address(&rtmsg.hdr, RTA_IFP); if (sdl