Fix for issue #3. For ifaddrs that represent an interface, we store the interface index as well. We handle all interface ifaddrs first (so they will be the first n items in the result list). Then when handling the addresses, we can look through the ifaddrs already in the result list to find the interface with the matching index.
I guess it is technically OK if there is no matching interface for an address.