HomeFreeBSD

libc: Shortcut if_indextoname() if index == 0

Description

libc: Shortcut if_indextoname() if index == 0

If the index we're trying to convert is 0 we can avoid a potentially
expensive call to getifaddrs(). No interface has an ifindex of zero, so
we can handle this as an error: set the errno to ENXIO and return NULL.

Submitted by: Nick Rogers
Reviewed by: lutz at donnerhacke.de
MFC after: 2 weeks
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D24524

Details

Provenance
kpAuthored on Apr 23 2020, 9:16 PM
Parents
rG9d433cb875e9: trim(8): candelete() returns wrong results because fd is opened O_WRONLY
Branches
Unknown
Tags
Unknown

Event Timeline