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