tst_inet6_opt_set_val - Inserts data items of various sizes in the data portion of the option
To check that inet6_opt_set_val() can be used to inserts data items of various sizes in the data portion of the option.
./tst_inet6_opt_set_val [-tooloption ...] -tooloption : v6api tool option
1. Calculate the needed buffer size 2. Check A: Function inet6_opt_init() return a valid buffer size 3. Append option to extension header with valid parameters 4. Check B: The value of option type, option length is correct 5. Inserts data items of various sizes 6. Check C: return length is correct and data set correctly
None
RFC 3542
10.4. inet6_opt_set_val
int inet6_opt_set_val(void *databuf, int offset, void *val, socklen_t vallen);
Databuf should be a pointer returned by inet6_opt_append(). This function inserts data items of various sizes in the data portion of the option. Val should point to the data to be inserted. Offset specifies where in the data portion of the option the value should be inserted; the first byte after the option type and length is accessed by specifying an offset of zero.
The caller should ensure that each field is aligned on its natural boundaries as described in Appendix B of [RFC-2460], but the function must not rely on the caller's behavior. Even when the alignment requirement is not satisfied, inet6_opt_set_val should just copy the data as required.
The function returns the offset for the next field (i.e., offset + vallen) which can be used when composing option content with multiple fields.