mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-10 21:22:20 +03:00
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
This commit is contained in:
committed by
Facebook Github Bot
parent
2bd01800f3
commit
e3b792e7f1
@@ -129,30 +129,7 @@ void happyEyeballsSetUpSocket(
|
|||||||
socket.bind(folly::SocketAddress("::", 0));
|
socket.bind(folly::SocketAddress("::", 0));
|
||||||
}
|
}
|
||||||
if (transportSettings.turnoffPMTUD) {
|
if (transportSettings.turnoffPMTUD) {
|
||||||
// TODO: Clean this up or move this into AsyncUDPSocket once we have a
|
socket.setDFAndTurnOffPMTU();
|
||||||
// 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
|
|
||||||
} else {
|
} else {
|
||||||
socket.dontFragment(true);
|
socket.dontFragment(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ void QuicServerWorker::bind(const folly::SocketAddress& address) {
|
|||||||
DCHECK(!supportedVersions_.empty());
|
DCHECK(!supportedVersions_.empty());
|
||||||
CHECK(socket_);
|
CHECK(socket_);
|
||||||
socket_->bind(address);
|
socket_->bind(address);
|
||||||
socket_->dontFragment(true);
|
socket_->setDFAndTurnOffPMTU();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuicServerWorker::setTransportSettingsOverrideFn(
|
void QuicServerWorker::setTransportSettingsOverrideFn(
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class QuicSharedUDPSocketFactory : public QuicUDPSocketFactory {
|
|||||||
sock->setFD(
|
sock->setFD(
|
||||||
folly::NetworkSocket::fromFd(fd),
|
folly::NetworkSocket::fromFd(fd),
|
||||||
folly::AsyncUDPSocket::FDOwnership::SHARED);
|
folly::AsyncUDPSocket::FDOwnership::SHARED);
|
||||||
sock->dontFragment(true);
|
sock->setDFAndTurnOffPMTU();
|
||||||
}
|
}
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class SimpleQuicServerWorkerTest : public Test {
|
|||||||
folly::test::MockAsyncUDPSocket* rawSocket_{nullptr};
|
folly::test::MockAsyncUDPSocket* rawSocket_{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(SimpleQuicServerWorkerTest, DontFragment) {
|
TEST_F(SimpleQuicServerWorkerTest, TurnOffPMTU) {
|
||||||
auto sock = std::make_unique<folly::test::MockAsyncUDPSocket>(&eventbase_);
|
auto sock = std::make_unique<folly::test::MockAsyncUDPSocket>(&eventbase_);
|
||||||
rawSocket_ = sock.get();
|
rawSocket_ = sock.get();
|
||||||
DCHECK(sock->getEventBase());
|
DCHECK(sock->getEventBase());
|
||||||
@@ -79,7 +79,7 @@ TEST_F(SimpleQuicServerWorkerTest, DontFragment) {
|
|||||||
folly::SocketAddress addr("::1", 0);
|
folly::SocketAddress addr("::1", 0);
|
||||||
// We check versions in bind()
|
// We check versions in bind()
|
||||||
worker_->setSupportedVersions({QuicVersion::MVFST});
|
worker_->setSupportedVersions({QuicVersion::MVFST});
|
||||||
EXPECT_CALL(*rawSocket_, dontFragment(true)).Times(1);
|
EXPECT_CALL(*rawSocket_, setDFAndTurnOffPMTU()).Times(1);
|
||||||
worker_->bind(addr);
|
worker_->bind(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user