Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe640f05 authored by Hansen Kurli's avatar Hansen Kurli
Browse files

Set TCP_MAXSEG to 1220 for better reliability.

Set the maximum segment size for outgoing TCP packets to a suitably low
value of 1220.
In some cases, such as in VPN networks, the TCP MSS value announced
could be too large, causing packets to be lost.

Bug: 246398088
Test: Manual test: Build, flash, boot.
Test: Connect to private dns, confirm announced MSS in tcpdump.
Change-Id: I4b72e27fe283951bc6f2bf44ee0fd802e133f812
parent 37a894be
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -94,6 +94,12 @@ Status DnsTlsSocket::tcpConnect() {
        return Status(err);
    }

    // Set TCP MSS to a suitably low value to be more reliable.
    const int v = 1220;
    if (setsockopt(mSslFd.get(), SOL_TCP, TCP_MAXSEG, &v, sizeof(v)) == -1) {
        LOG(WARNING) << "Failed to set TCP_MAXSEG: " << errno;
    }

    const Status tfo = enableSockopt(mSslFd.get(), SOL_TCP, TCP_FASTOPEN_CONNECT);
    if (!isOk(tfo) && tfo.code() != ENOPROTOOPT) {
        LOG(WARNING) << "Failed to enable TFO: " << tfo.msg();