set socket option IPV6_MTU_DISCOVER=IP_PMTUDISC_PROBE for linux (#399)

This commit is contained in:
msvoelker 2022-07-26 17:47:31 +02:00 committed by GitHub
parent b46a5b19bb
commit d9b2c37837
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View file

@ -85,6 +85,12 @@ CHECK_SYMBOL_EXISTS(
HAVE_IP_MTU_DISCOVER
)
CHECK_SYMBOL_EXISTS(
IPV6_MTU_DISCOVER
"netinet/in.h"
HAVE_IPV6_MTU_DISCOVER
)
CHECK_SYMBOL_EXISTS(
IP_DONTFRAG
"netinet/in.h"

View file

@ -964,6 +964,13 @@ sport_init_server (struct service_port *sport, struct lsquic_engine *engine,
return -1;
}
}
#if __linux__
else if (AF_INET6 == sa_local->sa_family)
{
int on = IP_PMTUDISC_PROBE;
s = setsockopt(sockfd, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &on, sizeof(on));
}
#endif
}
#endif
@ -1156,6 +1163,13 @@ sport_init_client (struct service_port *sport, struct lsquic_engine *engine,
return -1;
}
}
#if __linux__
else if (AF_INET6 == sa_local->sa_family)
{
int on = IP_PMTUDISC_PROBE;
s = setsockopt(sockfd, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &on, sizeof(on));
}
#endif
}
#endif

View file

@ -9,7 +9,7 @@
#cmakedefine HAVE_REGEX 1
#cmakedefine HAVE_PREADV 1
#define LSQUIC_DONTFRAG_SUPPORTED (HAVE_IP_DONTFRAG || HAVE_IP_MTU_DISCOVER)
#define LSQUIC_DONTFRAG_SUPPORTED (HAVE_IP_DONTFRAG || HAVE_IP_MTU_DISCOVER || HAVE_IPV6_MTU_DISCOVER)
/* TODO: presumably it's the same on FreeBSD, test it.
* See https://github.com/quicwg/base-drafts/wiki/ECN-in-QUIC