@@ -675,23 +675,27 @@ bool QuicSocket::SendStatelessReset(
675
675
// peer must termination it's initial attempt to
676
676
// establish a connection and start a new attempt.
677
677
//
678
- // TODO(@jasnell): Retry packets will only ever be
679
- // generated by QUIC servers, and only if the QuicSocket
680
- // is configured for explicit path validation. There is
681
- // no way for a client to force a retry packet to be created.
682
- // However, once a client determines that explicit
683
- // path validation is enabled, it could attempt to
684
- // DOS by sending a large number of malicious
685
- // initial packets to intentionally ellicit retry
686
- // packets (It can do so by intentionally sending
687
- // initial packets that ignore the retry token).
688
- // To help mitigate that risk, we should limit the number
689
- // of retries we send to a given remote endpoint.
678
+ // Retry packets will only ever be generated by QUIC servers,
679
+ // and only if the QuicSocket is configured for explicit path
680
+ // validation. There is no way for a client to force a retry
681
+ // packet to be created. However, once a client determines that
682
+ // explicit path validation is enabled, it could attempt to
683
+ // DOS by sending a large number of malicious initial packets
684
+ // to intentionally ellicit retry packets (It can do so by
685
+ // intentionally sending initial packets that ignore the retry
686
+ // token). To help mitigate that risk, we limit the number of
687
+ // retries we send to a given remote endpoint.
690
688
bool QuicSocket::SendRetry (
691
689
const QuicCID& dcid,
692
690
const QuicCID& scid,
693
691
const SocketAddress& local_addr,
694
692
const SocketAddress& remote_addr) {
693
+ auto info = addrLRU_.Upsert (remote_addr);
694
+ // Do not send a retry if the retry count is greater
695
+ // than the retry limit.
696
+ // TODO(@jasnell): Make the retry limit configurable.
697
+ if (++(info->retry_count ) > DEFAULT_MAX_RETRY_LIMIT)
698
+ return true ;
695
699
std::unique_ptr<QuicPacket> packet =
696
700
GenerateRetryPacket (token_secret_, dcid, scid, local_addr, remote_addr);
697
701
return packet ?
0 commit comments