NAME

  tst_if_name_index - Return all interface names and indexes


PURPOSE

  To check whether if_nameindex() can return all interface names
  and indexes.


SYNOPSIS

  ./tst_if_name_index [-tooloption ...]
    -tooloption : v6api tool option


TEST PROCEDURE

  1. Get all interface names and indexes
  2. Check whether other interface name and index exists


NOTE

  If argment ifname has not enough space to store the interface name, will
  cause memory leaks.


REFERENCE

  RFC 3493
  4.3 Return All Interface Names and Indexes
    The if_nameindex structure holds the information about a single
    interface and is defined as a result of including the <net/if.h>
    header.
    struct if_nameindex {
      unsigned int   if_index;  /* 1, 2, ... */
      char          *if_name;   /* null terminated name: "le0", ... */
    };
    The final function returns an array of if_nameindex structures, one
    structure per interface.
      #include <net/if.h>
      struct if_nameindex  *if_nameindex(void);
    The end of the array of structures is indicated by a structure with
    an if_index of 0 and an if_name of NULL.  The function returns a NULL
    pointer upon an error, and would set errno to the appropriate value.
    The memory used for this array of structures along with the interface
    names pointed to by the if_name members is obtained dynamically.
    This memory is freed by the next function.