core.sys.darwin.ifaddrs

Binding for Mac OSX's <ifaddr.h>, expose network interface addresses

The following functions are present as of Mac OSX 10.15:

  • getifaddrs(3): get interface addresses
  • freeifaddrs(3): deallocates the return value of getifaddrs
  • getifmaddrs(3): get multicast group membership
  • freeifmaddrs(3): deallocates the return value of getifmaddrs

Types 2

structifaddrs
Fields
ifaddrs * ifa_nextNext item in the list
char * ifa_nameName of the interface
uint ifa_flagsFlags from SIOCGIFFLAGS
sockaddr * ifa_addrAddress of interface
sockaddr * ifa_netmaskNetmask of interface
sockaddr * if_dstaddrPoint-to-point destination addresss
void * ifa_dataAddress specific data
structifmaddrs
Fields
ifmaddrs * ifma_nextPointer to next struct
sockaddr * ifma_nameInterface name (AF_LINK)
sockaddr * ifma_addrMulticast address
sockaddr * ifma_lladdrLink-layer translation, if any

Functions 4

fnint getifaddrs(ifaddrs * *)Returns: linked list of ifaddrs structures describing interfaces
fnvoid freeifaddrs(ifaddrs *)Frees the linked list returned by getifaddrs
fnint getifmaddrs(ifmaddrs * *)Stores a reference to a linked list of the multicast memberships on the local machine in the memory referenced by ifmaddrs
fnvoid freeifmaddrs(ifmaddrs *)Frees the list allocated by getifmaddrs