Commit Graph

4 Commits

Author SHA1 Message Date
Kristof Provost
36dcd97de3 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
2020-04-23 21:16:51 +00:00
Pedro F. Giffuni
9b10f59a10 SPDX: mostly fixes to previous changes.
Introduce the recently approved BSD-1-Clause and replace 0BSD which
never did fit well our use cases.
2017-12-13 16:13:17 +00:00
Marcel Moolenaar
cf0d539f8b Use the LLINDEX macro to access the link-level I/F index. This makes
it possible to work with a different type for the sdl_index field --
it only requires a recompile.

Obtained from:	Juniper Networks, Inc.
2012-05-19 02:39:43 +00:00
Hajimu UMEMOTO
8071d8d70d Use BSDi derived if_nametoindex(), if_indextoname(), if_nameindex()
and if_freenameindex().

Obtained from:	KAME
MFC after:	2 weeks
2002-07-15 19:58:56 +00:00