forked from quic-go/quic-go
ignore 0-RTT packets
This commit is contained in:
@@ -477,6 +477,10 @@ func (s *session) handlePacketImpl(p *receivedPacket) bool /* was the packet suc
|
||||
s.logger.Debugf("Dropping packet with unexpected source connection ID: %s (expected %s)", p.hdr.SrcConnectionID, s.destConnID)
|
||||
return false
|
||||
}
|
||||
// drop 0-RTT packets
|
||||
if p.hdr.Type == protocol.PacketType0RTT {
|
||||
return false
|
||||
}
|
||||
|
||||
packet, err := s.unpacker.Unpack(p.hdr, p.data)
|
||||
// if the decryption failed, this might be a packet sent by an attacker
|
||||
@@ -485,7 +489,6 @@ func (s *session) handlePacketImpl(p *receivedPacket) bool /* was the packet suc
|
||||
s.tryQueueingUndecryptablePacket(p)
|
||||
return false
|
||||
}
|
||||
// TODO: don't close the connection when receiving 0-RTT packets
|
||||
s.closeLocal(err)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -508,6 +508,16 @@ var _ = Describe("Session", func() {
|
||||
Expect(sess.handlePacketImpl(&receivedPacket{hdr: &hdr.Header, data: getData(hdr)})).To(BeTrue())
|
||||
})
|
||||
|
||||
It("ignores 0-RTT packets", func() {
|
||||
Expect(sess.handlePacketImpl(&receivedPacket{
|
||||
hdr: &wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketType0RTT,
|
||||
DestConnectionID: sess.srcConnID,
|
||||
},
|
||||
})).To(BeFalse())
|
||||
})
|
||||
|
||||
It("ignores packets with a different source connection ID", func() {
|
||||
hdr := &wire.Header{
|
||||
IsLongHeader: true,
|
||||
|
||||
Reference in New Issue
Block a user