Add ioctl(SIOCGIFxxx) support (#197)

- SIOCGIFCONFIG: reads and enumerate all the network interfaces
- SIOCGIFADDR: reads network address for a given interface
- SIOCGIFFLAGS: reads network flags for a given interface
- SIOCGIFNETMASK: reads network netmask for a given interface
- SIOCGIFBRDADDR: reads network broadcast address for a given interface
- SIOCGIFDSTADDR: reads peer destination address for a given
  interface (not supported for Windows)

This change defines Linux ABI structs for the above interfaces and adds
polyfills to ensure they behave consistently on XNU and Windows.
This commit is contained in:
fabriziobertocci 2021-06-24 13:53:27 -04:00 committed by GitHub
parent 4d8f884e76
commit fd0eefce17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 1531 additions and 4 deletions

View file

@ -85,6 +85,7 @@
#define kNtSioTranslateHandle 0xC800000Du
#define kNtSioUdpConnreset 0x9800000Cu
#define kNtSioUdpNetreset 0x9800000Fu
#define kNtSioGetInterfaceList 0x4008747fu /* _IOR('t', 127, ULONG) */
#define kNtNspNotifyImmediately 0
#define kNtNspNotifyHwnd 1
@ -311,6 +312,13 @@ struct NtFdSet {
int64_t fd_array[64];
};
struct NtInterfaceInfo {
uint64_t iiFlags;
struct sockaddr_in iiAddress;
struct sockaddr_in iiBroadcastAddress;
struct sockaddr_in iiNetmask;
};
/**
* Winsock2 prototypes.
*