diff --git a/session.go b/session.go index e9087e4ed..f3a87d63d 100644 --- a/session.go +++ b/session.go @@ -761,6 +761,9 @@ func (s *session) handleSinglePacket(p *receivedPacket, hdr *wire.Header) bool / // The server can change the source connection ID with the first Handshake packet. // After this, all packets with a different source connection have to be ignored. if s.receivedFirstPacket && hdr.IsLongHeader && !hdr.SrcConnectionID.Equal(s.handshakeDestConnID) { + if s.qlogger != nil { + s.qlogger.DroppedPacket(qlog.PacketTypeFromHeader(hdr), protocol.ByteCount(len(p.data)), qlog.PacketDropUnknownConnectionID) + } s.logger.Debugf("Dropping %s packet (%d bytes) with unexpected source connection ID: %s (expected %s)", hdr.PacketType(), len(p.data), hdr.SrcConnectionID, s.handshakeDestConnID) return false } diff --git a/session_test.go b/session_test.go index faa01bda3..1b97a7775 100644 --- a/session_test.go +++ b/session_test.go @@ -769,6 +769,7 @@ var _ = Describe("Session", func() { Expect(sess.handlePacketImpl(p1)).To(BeTrue()) // The next packet has to be ignored, since the source connection ID doesn't match. p2 := getPacket(hdr2, nil) + qlogger.EXPECT().DroppedPacket(qlog.PacketTypeHandshake, protocol.ByteCount(len(p2.data)), qlog.PacketDropUnknownConnectionID) Expect(sess.handlePacketImpl(p2)).To(BeFalse()) }) @@ -2185,6 +2186,7 @@ var _ = Describe("Client Session", func() { qlogger.EXPECT().ReceivedPacket(gomock.Any(), gomock.Any(), gomock.Any()) Expect(sess.handlePacketImpl(getPacket(hdr1, nil))).To(BeTrue()) // The next packet has to be ignored, since the source connection ID doesn't match. + qlogger.EXPECT().DroppedPacket(gomock.Any(), gomock.Any(), gomock.Any()) Expect(sess.handlePacketImpl(getPacket(hdr2, nil))).To(BeFalse()) })