Skip to content
Prev Previous commit
Update comment
  • Loading branch information
simonrozsival committed Sep 30, 2022
commit b49f6f57847700f24383d0100a00ad09f422677e
9 changes: 4 additions & 5 deletions src/native/libs/System.Native/pal_interfaceaddresses.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,10 @@ int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInter
// where we first write out NetworkInterfaceInfo entries immediately followed by
// IpAddressInfo list.
#ifdef TARGET_ANDROID
// Since Android API 30, getifaddrs returns only AF_INET and AF_INET6 addresses and
// we do not get any AF_PACKET addresses and so count == ip4count + ip6count.
// We need to make sure that the memoryBlock is large enough to hold all interfaces
// and (up to `count` entries) all addresses (ip4count + ip6count) without any overlap
// between interfaceList and addressList.
// Since Android API 30, getifaddrs returns only AF_INET and AF_INET6 addresses and we do not
// get any AF_PACKET addresses and so count == ip4count + ip6count. We need to make sure that
// the memoryBlock is large enough to hold all interfaces (up to `count` entries) and all
// addresses (ip4count + ip6count) without any overlap between interfaceList and addressList.
int entriesCount = count + ip4count + ip6count;
#else
int entriesCount = count;
Expand Down