tst_inet6_opt_find - Parse received option extension headers returning the next option which is the given option type
To check that inet6_opt_find() can be used to parse received option extension headers returning the next option which is the given option type.
./tst_inet6_opt_find [-tooloption ...] -tooloption : v6api tool option
1. Calculate the needed buffer size 2. Check A: Function inet6_opt_init() return a valid buffer size 3. Parse received option extension headers 4. Check B: return value is -1 5. Append option to extension header with valid parameters 6. Check C: The value of option type, option length is correct 7. Inserts data items of various sizes 8. Check D: return length is correct and data set correctly 9. Parse received option extension headers which type is 4 10.Check E: return value is -1 11.Parse received option extension headers which type is 3 12.Check F: return the next option, the length of option is correct
None
RFC 3542
10.6. inet6_opt_find
int inet6_opt_find(void *extbuf, socklen_t extlen, int offset, uint8_t type, socklen_t *lenp, void **databufp);
This function is similar to the previously described inet6_opt_next() function, except this function lets the caller specify the option type to be searched for, instead of always returning the next option in the extension header.
If an option of the specified type is located, the function returns the updated "previous" total length computed by advancing past the option that was returned and past any options that didn't match the type. This returned "previous" length can then be passed to subsequent calls to inet6_opt_find() for finding the next occurrence of the same option type.
If an option of the specified type is not located, the return value is -1. If the option extension header is malformed, the return value is -1.