The ifaddrlistx() function is similar to ifaddrlist(), but: * Allows specific address flags to be matched against. * Provides the addresses for a *specific* interface name * a linked-list rather than an array so that information can grow over time without affecting binary compatibility. * Returns the number of items on the linked list on success, or -1 on failure. * Leaves error-handling up to the caller. Specifically: int ifaddrlistx(const char *ifname, uint64_t set, uint64_t clear, ifaddrlistx_t **ifaddrp); * ifname: Interface name to match against. * set: One or more flags that must be set on the address for it to be returned. * clear: Flags that must be clear on the address for it to be returned. * ifaddrp: Upon success, ifaddrlistx() sets *ifaddrp to the head of a dynamically-allocated array of ifaddrlistx structures. The ifaddrlistx structure is defined as: typedef struct ifaddrlistx { struct ifaddrlistx *ia_next; char ia_name[LIFNAMSIZ]; uint64_t ia_flags; struct sockaddr_storage ia_addr; } ifaddrlistx_t; Once done, the caller must free `ifaddrp' by calling ifaddrlistx_free(): void ifaddrlistx_free(ifaddrlistx_t *ifaddrp);