readIfReqIfIndex function

int readIfReqIfIndex(
  1. Pointer<Uint8> ifreq
)

Read the ifr_ifindex field from an ifreq populated by ioctl(SIOCGIFINDEX). The field sits at byte offset 16 (immediately after ifr_name[16]), little-endian on Linux/x86 + arm64.

Implementation

int readIfReqIfIndex(Pointer<Uint8> ifreq) {
  final view = ifreq.asTypedList(kIfReqSize);
  return (view[16]) |
      (view[17] << 8) |
      (view[18] << 16) |
      (view[19] << 24);
}