drop version negotiation packets in the server

This commit is contained in:
Marten Seemann
2020-10-07 17:35:57 +07:00
parent 350a3dbef8
commit 48d25fe95b
2 changed files with 29 additions and 0 deletions

View File

@@ -321,6 +321,13 @@ func (s *baseServer) handlePacket(p *receivedPacket) {
}
func (s *baseServer) handlePacketImpl(p *receivedPacket) bool /* is the buffer still in use? */ {
if wire.IsVersionNegotiationPacket(p.data) {
s.logger.Debugf("Dropping Version Negotiation packet.")
if s.config.Tracer != nil {
s.config.Tracer.DroppedPacket(p.remoteAddr, logging.PacketTypeVersionNegotiation, p.Size(), logging.PacketDropUnexpectedPacket)
}
return false
}
// If we're creating a new session, the packet will be passed to the session.
// The header will then be parsed again.
hdr, _, _, err := wire.ParsePacket(p.data, s.config.ConnectionIDLength)