Skip to content

Commit a7a8f2f

Browse files
committed
NetIO (BSD): fix compiling
1 parent 5e5c0b4 commit a7a8f2f

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/common/netif/netif_windows.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <iphlpapi.h>
55

6-
bool ffNetifGetDefaultRouteImpl(char* iface/* unsupported */, uint32_t* ifIndex)
6+
bool ffNetifGetDefaultRouteImpl(FF_MAYBE_UNUSED char* iface/* unsupported */, uint32_t* ifIndex)
77
{
88
ULONG size = 0;
99
if (GetIpForwardTable(NULL, &size, TRUE) != ERROR_INSUFFICIENT_BUFFER)

src/detection/netio/netio_bsd.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options)
1717
uint32_t defaultRouteIfIndex = ffNetifGetDefaultRouteIfIndex();
1818

1919
size_t bufSize = 0;
20-
if (sysctl((int[]) { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST2, (options->defaultRouteOnly ? (int) defaultRouteIfIndex : 0) }, 6, NULL, &bufSize, 0, 0) < 0)
21-
return "sysctl({ CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST2, ifIndex }, 6, NULL, &bufSize, 0, 0) failed";
20+
if (sysctl((int[]) { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, (options->defaultRouteOnly ? (int) defaultRouteIfIndex : 0) }, 6, NULL, &bufSize, 0, 0) < 0)
21+
return "sysctl({ CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, ifIndex }, 6, NULL, &bufSize, 0, 0) failed";
2222

23-
FF_AUTO_FREE struct if_msghdr2* buf = (struct if_msghdr2*) malloc(bufSize);
24-
if (sysctl((int[]) { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST2, (options->defaultRouteOnly ? (int) defaultRouteIfIndex : 0) }, 6, buf, &bufSize, 0, 0) < 0)
25-
return "sysctl({ CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST2, ifIndex }, 6, buf, &bufSize, 0, 0) failed";
23+
FF_AUTO_FREE struct if_msghdr* buf = (struct if_msghdr*) malloc(bufSize);
24+
if (sysctl((int[]) { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, (options->defaultRouteOnly ? (int) defaultRouteIfIndex : 0) }, 6, buf, &bufSize, 0, 0) < 0)
25+
return "sysctl({ CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, ifIndex }, 6, buf, &bufSize, 0, 0) failed";
2626

27-
for (struct if_msghdr2* ifm = buf;
28-
ifm < (struct if_msghdr2*) ((uint8_t*) buf + bufSize);
29-
ifm = (struct if_msghdr2*) ((uint8_t*) ifm + ifm->ifm_msglen))
27+
for (struct if_msghdr* ifm = buf;
28+
ifm < (struct if_msghdr*) ((uint8_t*) buf + bufSize);
29+
ifm = (struct if_msghdr*) ((uint8_t*) ifm + ifm->ifm_msglen))
3030
{
31-
if (ifm->ifm_type != RTM_IFINFO2 || !(ifm->ifm_flags & IFF_RUNNING) || (ifm->ifm_flags & IFF_NOARP)) continue;
31+
if (ifm->ifm_type != RTM_IFINFO || !(ifm->ifm_flags & IFF_RUNNING) || (ifm->ifm_flags & IFF_NOARP)) continue;
3232

3333
struct sockaddr_dl* sdl = (struct sockaddr_dl*) (ifm + 1);
3434
assert(sdl->sdl_family == AF_LINK);

src/detection/netio/netio_windows.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options)
3737
return "GetAdaptersAddresses() failed";
3838
}
3939

40-
uint32_t defaultRouteIfIndex = ffNetifGetDefaultRoute();
40+
uint32_t defaultRouteIfIndex = ffNetifGetDefaultRouteIfIndex();
4141

4242
// Iterate through all of the adapters
4343
for (IP_ADAPTER_ADDRESSES* adapter = adapter_addresses; adapter; adapter = adapter->Next)

0 commit comments

Comments
 (0)