// Iterate through the linked list.
for ( ifa = if_addr_struct; ifa != NULL; ifa = ifa->ifa_next)
{
+ // Skip interfaces without IP addresses
+ if (!ifa->ifa_addr)
+ continue;
+
// Get the address family of the actual address.
address_family = ifa->ifa_addr->sa_family;