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

42
libc/nt/iphlpapi.h Normal file
View file

@ -0,0 +1,42 @@
#ifndef COSMOPOLITAN_LIBC_NT_IPHLPAPI_H_
#define COSMOPOLITAN_LIBC_NT_IPHLPAPI_H_
#include "libc/nt/struct/ipadapteraddresses.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/* ░░░░
cosmopolitan § new technology » ip helper API
*/
uint32_t GetAdaptersAddresses(
uint32_t Family,
uint32_t Flags,
void * Reserved,
NtIpAdapterAddresses *AdapterAddresses,
uint32_t *SizePointer);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_NT_IPHLPAPI_H_ */