only accept a single Retry packet for a connection

This commit is contained in:
Marten Seemann
2018-06-12 16:14:56 +02:00
parent 7e6921b29e
commit 3601f06aed
2 changed files with 27 additions and 1 deletions

View File

@@ -24,6 +24,8 @@ type client struct {
conn connection
hostname string
receivedRetry bool
versionNegotiated bool // has the server accepted our version
receivedVersionNegotiationPacket bool
negotiatedVersions []protocol.VersionNumber // the list of versions from the version negotiation packet
@@ -370,7 +372,14 @@ func (c *client) handleIETFQUICPacket(hdr *wire.Header, packetData []byte, remot
return fmt.Errorf("received a packet with an unexpected connection ID (%s, expected %s)", hdr.DestConnectionID, c.srcConnID)
}
if hdr.IsLongHeader {
if hdr.Type != protocol.PacketTypeRetry && hdr.Type != protocol.PacketTypeHandshake {
switch hdr.Type {
case protocol.PacketTypeRetry:
if c.receivedRetry {
return nil
}
c.receivedRetry = true
case protocol.PacketTypeHandshake:
default:
return fmt.Errorf("Received unsupported packet type: %s", hdr.Type)
}
if protocol.ByteCount(len(packetData)) < hdr.PayloadLen {