Skip to content

Commit 8fdbadf

Browse files
committed
LocalIp: fix --localip-show-loop on macOS
loop on macOS is `lo0`
1 parent 5c43119 commit 8fdbadf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/modules/localip.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#define FF_LOCALIP_NUM_FORMAT_ARGS 1
66

77
#include <string.h>
8+
#include <ctype.h>
89
#include <ifaddrs.h>
910
#include <netinet/in.h>
1011
#include <arpa/inet.h>
@@ -54,7 +55,7 @@ void ffPrintLocalIp(FFinstance* instance)
5455
continue;
5556

5657
// loop back
57-
if (strcmp(ifa->ifa_name, "lo") == 0 && !instance->config.localIpShowLoop)
58+
if (strncmp(ifa->ifa_name, "lo", 2) == 0 && (ifa->ifa_name[2] == '\0' || isdigit(ifa->ifa_name[2])) && !instance->config.localIpShowLoop)
5859
continue;
5960

6061
if (ifa->ifa_addr->sa_family == AF_INET) { // check it is IP4

0 commit comments

Comments
 (0)