MacOS: setsockopt ipv6 return error 22 invalid argument.

With C++ code, I tried to setsockopt for ipv6 TTL by:

int ttl = 8;
ret = setsockopt(skt, IPPROTOIPV6, IPV6UNICASTHOPS, &ttl, (socklent) sizeof(ttl));

I tried every option(such as sizeof(&ttl) still return errno 22, invalid argument.

sizeof(ttl) is 4 in this case.

Is this the right way to set IPV6 outgoing packet TTL? What is wrong here.

Same code for iOS works fine.


MacOS: setsockopt ipv6 return error 22 invalid argument.
 
 
Q