don't assume interface indices are consecutive

Instead of assuming the interface numbers are consecutive, assume the link and address entries are sorted in the same way.