set IP_PMTUDISC_PROBE instead of dontFragment (i.e. PMTUDISC_DO)
Summary:
mvfst will need to handle pmtu in an app specific way. So just set DF bits but
not pmtu.
MODIFY
quic/happyeyeballs/QuicHappyEyeballsFunctions.cpp
quic/happyeyeballs/QuicHappyEyeballsFunctions.cpp
@@ -129,30 +129,7 @@ void happyEyeballsSetUpSocket(
socket.bind(folly::SocketAddress("::", 0));
}
if (transportSettings.turnoffPMTUD) {
- // TODO: Clean this up or move this into AsyncUDPSocket once we have a
- // better idea of how to handle PMTU
-#if defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_PROBE)
- if (socket.address().getFamily() == AF_INET) {
- int v4 = IP_PMTUDISC_PROBE;
- folly::netops::setsockopt(
- socket.getNetworkSocket(),
- IPPROTO_IP,
- IP_MTU_DISCOVER,
- &v4,
- sizeof(v4));
- }
-#endif
-#if defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_PROBE)
- if (socket.address().getFamily() == AF_INET6) {
- int v6 = IPV6_PMTUDISC_PROBE;
- folly::netops::setsockopt(
- socket.getNetworkSocket(),
- IPPROTO_IPV6,
- IPV6_MTU_DISCOVER,
- &v6,
- sizeof(v6));
- }
-#endif
+ socket.setDFAndTurnOffPMTU();
} else {
socket.dontFragment(true);
}

MODIFY
quic/server/QuicServerWorker.cpp
quic/server/QuicServerWorker.cpp
@@ -34,7 +34,7 @@ void QuicServerWorker::bind(const folly::SocketAddress& address) {
DCHECK(!supportedVersions_.empty());
CHECK(socket_);
socket_->bind(address);
- socket_->dontFragment(true);
+ socket_->setDFAndTurnOffPMTU();
}
void QuicServerWorker::setTransportSettingsOverrideFn(

MODIFY
quic/server/QuicSharedUDPSocketFactory.h
quic/server/QuicSharedUDPSocketFactory.h
@@ -24,7 +24,7 @@ class QuicSharedUDPSocketFactory : public QuicUDPSocketFactory {
sock->setFD(
folly::NetworkSocket::fromFd(fd),
folly::AsyncUDPSocket::FDOwnership::SHARED);
- sock->dontFragment(true);
+ sock->setDFAndTurnOffPMTU();
}
return sock;
}

MODIFY
quic/server/test/QuicServerTest.cpp
quic/server/test/QuicServerTest.cpp
@@ -67,7 +67,7 @@ class SimpleQuicServerWorkerTest : public Test {
folly::test::MockAsyncUDPSocket* rawSocket_{nullptr};
};
-TEST_F(SimpleQuicServerWorkerTest, DontFragment) {
+TEST_F(SimpleQuicServerWorkerTest, TurnOffPMTU) {
auto sock = std::make_unique<folly::test::MockAsyncUDPSocket>(&eventbase_);
rawSocket_ = sock.get();
DCHECK(sock->getEventBase());
@@ -79,7 +79,7 @@ TEST_F(SimpleQuicServerWorkerTest, DontFragment) {
folly::SocketAddress addr("::1", 0);
// We check versions in bind()
worker_->setSupportedVersions({QuicVersion::MVFST});
- EXPECT_CALL(*rawSocket_, dontFragment(true)).Times(1);
+ EXPECT_CALL(*rawSocket_, setDFAndTurnOffPMTU()).Times(1);
worker_->bind(addr);
}

set IP_PMTUDISC_PROBE instead of dontFragment (i.e. PMTUDISC_DO)

Summary:
mvfst will need to handle pmtu in an app specific way. So just set DF bits but
not pmtu.

Reviewed By: siyengar

Differential Revision: D17624134

fbshipit-source-id: 14f445bbb6a971efb8a3d550c84c3d4af53f8517