NAME

  tst_inet6_opt_init_init - Initializes the extension header to have the correct length field


PURPOSE

  To check that inet6_opt_init_calc() can be used to initializes
  the extension header to have the correct length field.


SYNOPSIS

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


TEST PROCEDURE

  1. Calculate the needed buffer size if extlen is 0
  2. Check A: Should return -1 and extension header is not changed
  3. Calculate the needed buffer size if extlen is not multiple of 8
  4. Check B: Should return -1 and extension header is not changed
  5. Calculate the needed buffer size if extlen is multiple of 8
  6. Check C: Should return 2 and extension header has been changed
 
=head1 NOTE
  Length of the extension header in 8-octet units, not including the
  first 8 octets. [RFC 2460]


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.)