accept Public Resets without the RSEQ tag

The RSEQ tag is mandatory according to the gQUIC spec, however, Google
doesn't include that tag in its Public Resets.
This commit is contained in:
Marten Seemann
2017-11-08 10:59:23 +07:00
parent e34d83644e
commit bc1ef31531
2 changed files with 12 additions and 11 deletions

View File

@@ -43,14 +43,15 @@ func ParsePublicReset(r *bytes.Reader) (*PublicReset, error) {
return nil, errors.New("wrong public reset tag")
}
rseq, ok := msg.Data[handshake.TagRSEQ]
if !ok {
return nil, errors.New("RSEQ missing")
// The RSEQ tag is mandatory according to the gQUIC wire spec.
// However, Google doesn't send RSEQ in their Public Resets.
// Therefore, we'll treat RSEQ as an optional field.
if rseq, ok := msg.Data[handshake.TagRSEQ]; ok {
if len(rseq) != 8 {
return nil, errors.New("invalid RSEQ tag")
}
pr.RejectedPacketNumber = protocol.PacketNumber(binary.LittleEndian.Uint64(rseq))
}
if len(rseq) != 8 {
return nil, errors.New("invalid RSEQ tag")
}
pr.RejectedPacketNumber = protocol.PacketNumber(binary.LittleEndian.Uint64(rseq))
rnon, ok := msg.Data[handshake.TagRNON]
if !ok {
@@ -60,6 +61,5 @@ func ParsePublicReset(r *bytes.Reader) (*PublicReset, error) {
return nil, errors.New("invalid RNON tag")
}
pr.Nonce = binary.LittleEndian.Uint64(rnon)
return &pr, nil
}