8242885: PlainDatagramSocketImpl doesn’t allow for the sending of IPv6 datagrams on macOS with sizes between 65508-65527 bytes

This fix changes the current max size for IPv6 datagrams on macOS from it's current size of 65507, which is the IPv4 limit, to 65527, the actual limit for IPv6 on macOS

Reviewed-by: alanb, dfuchs, vtewari
This commit is contained in:
Patrick Concannon 2020-07-31 12:42:32 +01:00
parent 2dda9965cd
commit 7fd5cb6117
5 changed files with 283 additions and 170 deletions

View file

@ -48,6 +48,11 @@
#endif
#endif // __linux__
#ifdef __APPLE__
#define IPV4_SNDBUF_LIMIT 65507
#define IPV6_SNDBUF_LIMIT 65527
#endif // __APPLE__
#ifndef IPTOS_TOS_MASK
#define IPTOS_TOS_MASK 0x1e
#endif
@ -895,7 +900,7 @@ Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate(JNIEnv *env,
}
#ifdef __APPLE__
arg = 65507;
arg = (domain == AF_INET6) ? IPV6_SNDBUF_LIMIT : IPV4_SNDBUF_LIMIT;
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF,
(char *)&arg, sizeof(arg)) < 0) {
getErrorString(errno, tmpbuf, sizeof(tmpbuf));