interfaces: Fix the legacy ioctl() support
Found various bugs when reviewing the legacy ioctl() support to iterate addresses. This is sadly used by Android before API version 24.
Found various bugs when reviewing the legacy ioctl() support to iterate addresses. This is sadly used by Android before API version 24.