NAME

  tst_inet6_opt_init_calc - Calculate the needed buffer size for the empty extension header


PURPOSE

  To check that inet6_opt_init_calc() can be used to calculate the
  needed buffer size for the empty extension header while extbuf is
  NULL.


SYNOPSIS

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


TEST PROCEDURE

  1. Calculate the needed buffer size if extlen is 0
  2. Check A: The needed buffer size is 2
  3. Calculate the needed buffer size if extlen is 8
  4. Check B: The needed buffer size is 2
  5. Calculate the needed buffer size if extlen is 100
  6. Check C: The needed buffer size is 2


NOTE

  None


REFERENCE

  RFC 3542
  10.1.  inet6_opt_init
      int inet6_opt_init(void *extbuf, socklen_t extlen);
    This function returns the number of bytes needed for the empty
    extension header i.e., without any options.  If extbuf is not NULL it
    also initializes the extension header to have the correct length
    field.  In that case if the extlen value is not a positive (i.e.,
    non-zero) multiple of 8 the function fails and returns -1.
    (Note: since the return value on success is based on a "constant"
    parameter, i.e., the empty extension header, an implementation may
    return a constant value.  However, this specification does not
    require the value be constant, and leaves it as implementation
    dependent.  The application should not assume a particular constant
    value as a successful return value of this function.)