rewrite the proxy to avoid packet reordering

This commit is contained in:
Marten Seemann
2020-06-19 22:57:07 +07:00
parent c956ca4447
commit 0baf16ea4e
3 changed files with 248 additions and 96 deletions

View File

@@ -418,18 +418,15 @@ var _ = Describe("MITM test", func() {
// client connection closes immediately on receiving ack for unsent packet
It("fails when a forged initial packet with ack for unsent packet is sent to client", func() {
clientAddr := clientConn.LocalAddr()
delayCb := func(dir quicproxy.Direction, raw []byte) time.Duration {
if dir == quicproxy.DirectionIncoming {
defer GinkgoRecover()
hdr, _, _, err := wire.ParsePacket(raw, connIDLen)
Expect(err).ToNot(HaveOccurred())
if hdr.Type != protocol.PacketTypeInitial {
return 0
}
sendForgedInitialPacketWithAck(serverConn, clientConn.LocalAddr(), hdr)
sendForgedInitialPacketWithAck(serverConn, clientAddr, hdr)
}
return rtt
}
@@ -439,7 +436,6 @@ var _ = Describe("MITM test", func() {
Expect(err.(*qerr.QuicError).ErrorCode).To(Equal(qerr.ProtocolViolation))
Expect(err.Error()).To(ContainSubstring("Received ACK for an unsent packet"))
})
})
})
}