-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement the 3x amplification limit #2536
Conversation
3bc2e98
to
5248e4f
Compare
func (p *packetPacker) packCoalescedPacket(buffer *packetBuffer, maxPacketSize protocol.ByteCount) (*coalescedPacket, error) { | ||
maxPacketSize = utils.MinByteCount(maxPacketSize, p.maxPacketSize) | ||
if p.perspective == protocol.PerspectiveClient { | ||
maxPacketSize = protocol.MinInitialPacketSize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So as client we're always ignoring the parameter? Should we make that clearer, e.g. maxPacketSizeForServer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only for coalesced packet sent by the client. This doesn't apply for normal packets.
@@ -1427,7 +1428,7 @@ func (s *session) sendPacket() (bool, error) { | |||
|
|||
if !s.handshakeConfirmed { | |||
now := time.Now() | |||
packet, err := s.packer.PackCoalescedPacket(protocol.MaxByteCount) | |||
packet, err := s.packer.PackCoalescedPacket(s.sentPacketHandler.AmplificationWindow()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a risk for busy-looping here, if we exit the send loop when it's time to send an ACK? Or is this the same as if we're congestion limited, and we'll deal with that gracefully?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be handled the same way as being congestion limited.
5248e4f
to
fae5068
Compare
This will trigger the amplification protection.
fae5068
to
e33f7d0
Compare
Codecov Report
@@ Coverage Diff @@
## master #2536 +/- ##
==========================================
+ Coverage 86.19% 86.22% +0.03%
==========================================
Files 122 122
Lines 9583 9603 +20
==========================================
+ Hits 8260 8280 +20
Misses 985 985
Partials 338 338
Continue to review full report at Codecov.
|
Fixes #1862.