ignore 0-RTT packets

This commit is contained in:
Marten Seemann
2018-12-20 15:23:29 +06:30
parent d6c304610d
commit 74d8a2bd7d
2 changed files with 14 additions and 1 deletions

View File

@@ -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
}

View File

@@ -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,