From a8a24a2bc24417bb5ccd6553b6dfc717b9acc94b Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 19 Apr 2023 14:50:29 +0200 Subject: [PATCH] add missing tracing for dropped 0-RTT packets (#3762) --- packet_handler_map.go | 3 +++ packet_handler_map_test.go | 1 + 2 files changed, 4 insertions(+) diff --git a/packet_handler_map.go b/packet_handler_map.go index e2bc913c..2039e26f 100644 --- a/packet_handler_map.go +++ b/packet_handler_map.go @@ -417,6 +417,9 @@ func (h *packetHandlerMap) handlePacket(p *receivedPacket) { } if wire.Is0RTTPacket(p.data) { if h.numZeroRTTEntries >= protocol.Max0RTTQueues { + if h.tracer != nil { + h.tracer.DroppedPacket(p.remoteAddr, logging.PacketType0RTT, p.Size(), logging.PacketDropDOSPrevention) + } return } h.numZeroRTTEntries++ diff --git a/packet_handler_map_test.go b/packet_handler_map_test.go index 637ebb92..0ffede97 100644 --- a/packet_handler_map_test.go +++ b/packet_handler_map_test.go @@ -323,6 +323,7 @@ var _ = Describe("Packet Handler Map", func() { } // We're already storing the maximum number of queues. This packet will be dropped. connID := protocol.ParseConnectionID([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9}) + tracer.EXPECT().DroppedPacket(gomock.Any(), logging.PacketType0RTT, gomock.Any(), logging.PacketDropDOSPrevention) handler.handlePacket(&receivedPacket{data: getPacketWithPacketType(connID, protocol.PacketType0RTT, 1)}) // Don't EXPECT any handlePacket() calls. conn := NewMockPacketHandler(mockCtrl)