NAME

  tst_inet6_opt_finish_do - Updated total length taking into account the final padding of the extension header


PURPOSE

  To check that inet6_opt_finish() can updated total length taking
  into account the final padding of the extension header.


SYNOPSIS

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


TEST PROCEDURE

  1. Calculate the needed buffer size
  2. Check A: Function inet6_opt_init() return a valid buffer size
  3. Updated total length taking into account the final padding
  4. Check B: Initializes the option by inserting a Pad1 or PadN
     option
  5. Updated total length taking into account the final padding
  6. Check C: Initializes the option by inserting a Pad1 option
  7. Updated total length which not need padding
  8. Check D: Not any padding is inserted to extension header
  9. Updated total length with bad offset paramter
  10.Check E: Function inet6_opt_finish() return -1


NOTE

  None


REFERENCE

  RFC 3542
  10.3.  inet6_opt_finish
      int inet6_opt_finish(void *extbuf, socklen_t extlen, int offset);
    Offset should be the length returned by inet6_opt_init() or
    inet6_opt_append().  This function returns the updated total length
    taking into account the final padding of the extension header to make
    it a multiple of 8 bytes.  If extbuf is not NULL the function also
    initializes the option by inserting a Pad1 or PadN option of the
    proper length.
    If the necessary pad does not fit in the extension header buffer the
    function returns -1.