mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
packet packer: don't try packing a 0-RTT packet with only an ACK (#3849)
0-RTT packets can't contain ACK frames. This was correctly reflected in the code path for packing a 0-RTT packet, but we would ignore the ACK-only flag when packing the coalesced packet, leading to a full-size 0-RTT packet being sent out when we're only allowed to send an ACK-only packet.
This commit is contained in:
parent
f5516715eb
commit
762d5c2c9c
2 changed files with 7 additions and 1 deletions
|
@ -417,7 +417,7 @@ func (p *packetPacker) PackCoalescedPacket(onlyAck bool, v protocol.VersionNumbe
|
||||||
if oneRTTPayload.length > 0 {
|
if oneRTTPayload.length > 0 {
|
||||||
size += p.shortHeaderPacketLength(connID, oneRTTPacketNumberLen, oneRTTPayload) + protocol.ByteCount(oneRTTSealer.Overhead())
|
size += p.shortHeaderPacketLength(connID, oneRTTPacketNumberLen, oneRTTPayload) + protocol.ByteCount(oneRTTSealer.Overhead())
|
||||||
}
|
}
|
||||||
} else if p.perspective == protocol.PerspectiveClient { // 0-RTT
|
} else if p.perspective == protocol.PerspectiveClient && !onlyAck { // 0-RTT packets can't contain ACK frames
|
||||||
var err error
|
var err error
|
||||||
zeroRTTSealer, err = p.cryptoSetup.Get0RTTSealer()
|
zeroRTTSealer, err = p.cryptoSetup.Get0RTTSealer()
|
||||||
if err != nil && err != handshake.ErrKeysDropped && err != handshake.ErrKeysNotYetAvailable {
|
if err != nil && err != handshake.ErrKeysDropped && err != handshake.ErrKeysNotYetAvailable {
|
||||||
|
|
|
@ -316,6 +316,12 @@ var _ = Describe("Packet packer", func() {
|
||||||
Expect(p.longHdrPackets[0].EncryptionLevel()).To(Equal(protocol.Encryption0RTT))
|
Expect(p.longHdrPackets[0].EncryptionLevel()).To(Equal(protocol.Encryption0RTT))
|
||||||
Expect(p.longHdrPackets[0].frames).To(Equal([]*ackhandler.Frame{cf}))
|
Expect(p.longHdrPackets[0].frames).To(Equal([]*ackhandler.Frame{cf}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("doesn't add an ACK-only 0-RTT packet", func() { // ACK frames cannot be sent in 0-RTT packets
|
||||||
|
p, err := packer.PackCoalescedPacket(true, protocol.Version1)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
Expect(p).To(BeNil())
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
Context("packing CONNECTION_CLOSE", func() {
|
Context("packing CONNECTION_CLOSE", func() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue