Skip to content

Commit de6b1f9

Browse files
committed
LocalIP (Linux): fix network prefix detection when the value is greater than 24
1 parent 7743167 commit de6b1f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/detection/localip/localip_linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
8484
inet_ntop(AF_INET, &ipv4->sin_addr, addressBuffer, INET_ADDRSTRLEN);
8585

8686
struct sockaddr_in* netmask = (struct sockaddr_in*) ifa->ifa_netmask;
87-
int cidr = __builtin_popcount(inet_netof(netmask->sin_addr));
87+
int cidr = __builtin_popcount(netmask->sin_addr.s_addr);
8888
if (cidr != 0)
8989
{
9090
size_t len = strlen(addressBuffer);

0 commit comments

Comments
 (0)