Skip to content

Commit bedb5eb

Browse files
committed
Netif (SunOS): work around a bug that fails to detect default route for IPv4
1 parent f184f8d commit bedb5eb

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/common/netif/netif_apple.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ bool ffNetifGetDefaultRouteImplV4(FFNetifDefaultRouteResult* result)
103103
while (recv(pfRoute, &rtmsg, sizeof(rtmsg), 0) > 0 && !(rtmsg.hdr.rtm_seq == 1 && rtmsg.hdr.rtm_pid == pid))
104104
;
105105

106+
#ifndef __sun // On Solaris, the RTF_GATEWAY flag is not set for default routes for some reason
106107
if ((rtmsg.hdr.rtm_flags & (RTF_UP | RTF_GATEWAY)) == (RTF_UP | RTF_GATEWAY))
108+
#endif
107109
{
108110
struct sockaddr_dl* sdl = (struct sockaddr_dl *)get_rt_address(&rtmsg.hdr, RTA_IFP);
109111
if (sdl
@@ -174,7 +176,9 @@ bool ffNetifGetDefaultRouteImplV6(FFNetifDefaultRouteResult* result)
174176
while (recv(pfRoute, &rtmsg, sizeof(rtmsg), 0) > 0 && !(rtmsg.hdr.rtm_seq == 2 && rtmsg.hdr.rtm_pid == pid))
175177
;
176178

179+
#ifndef __sun // On Solaris, the RTF_GATEWAY flag is not set for default routes for some reason
177180
if ((rtmsg.hdr.rtm_flags & (RTF_UP | RTF_GATEWAY)) == (RTF_UP | RTF_GATEWAY))
181+
#endif
178182
{
179183
struct sockaddr_dl* sdl = (struct sockaddr_dl *)get_rt_address(&rtmsg.hdr, RTA_IFP);
180184
if (sdl

0 commit comments

Comments
 (0)