Skip to content

Commit 03b537b

Browse files
committed
LocalIP: fix logic error when there is no preferred source address
1 parent f285ccc commit 03b537b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/detection/localip/localip_linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
166166

167167
struct sockaddr_in* ipv4 = (struct sockaddr_in*) ifa->ifa_addr;
168168

169-
bool isDefaultRoute = isDefaultRouteIf && preferredSourceAddr != 0 && ipv4->sin_addr.s_addr == preferredSourceAddr;
169+
bool isDefaultRoute = isDefaultRouteIf && (preferredSourceAddr == 0 || ipv4->sin_addr.s_addr == preferredSourceAddr);
170170
if ((options->showType & FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT) && !isDefaultRoute)
171171
continue;
172172

0 commit comments

Comments
 (0)