tst_if_index_to_name_bad - Return a NULL pointer if ifindex is not an interface index
To check if ifindex is not an interface index then the function shall return a NULL pointer and set errno to indicate the error.
./tst_if_index_to_name_bad [-tooloption ...] -tooloption : v6api tool option
1. The argument ifindex 0 is not an interface index, shall return a NULL pointer 2. The argument ifindex 10000 is the interface index, shall return a NULL pointer
None
RFC 3493
4.2 Index-to-Name
The second function maps an interface index into its corresponding name.
#include <net/if.h>
char *if_indextoname(unsigned int ifindex, char *ifname);
When this function is called, the ifname argument shall point to a buffer of at least IF_NAMESIZE bytes. The function shall place in this buffer the name of the interface with index ifindex. (IF_NAMESIZE is also defined in <net/if.h> and its value includes a terminating null byte at the end of the interface name.) If ifindex is an interface index, then the function shall return the value supplied in ifname, which points to a buffer now containing the interface name. Otherwise, the function shall return a NULL pointer and set errno to indicate the error. If there is no interface corresponding to the specified index, errno is set to ENXIO. If there was a system error (such as running out of memory), errno would be set to the proper value (e.g., ENOMEM).