Skip to content

Commit

Permalink
BUG/MINOR: quic: fix CONNECTION_CLOSE_APP encoding
Browse files Browse the repository at this point in the history
CONNECTION_CLOSE_APP encoding is broken, which prevents the sending of
every packet with such a frame. This bug was always present in quic
haproxy. However, it was slightly dissimulated by the previous code
which always initialized all frame members to zero, which was sufficient
to ensure CONNECTION_CLOSE_APP encoding was ok. The below patch changes
this behavior by removing this costly initialization step.

  4cf784f
  MINOR: quic: Avoid zeroing frame structures

Now, frames members must always be initialized individually given the
type of frame to used. However, for CONNECTION_CLOSE_APP this was not
done as qc_cc_build_frm() accessed the wrong union member refering to a
CONNECTION_CLOSE instead.

This bug was detected when trying to generate a HTTP/3 error. The
CONNECTION_CLOSE_APP frame encoding failed due to a non-initialized
<reason_phrase_len> which was too big. This was reported by the
following trace :
  "frame building error : qc@0x5555561b86c0 idle_timer_task@0x5555561e5050 flags=0x86038058 CONNECTION_CLOSE_APP"

This must be backported up to 2.6. This is necessary even if above
commit is not as previous code is also buggy, albeit with a different
behavior.
  • Loading branch information
a-denoyelle committed Nov 28, 2023
1 parent d656ac7 commit fe3726c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/quic_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2172,8 +2172,8 @@ static void qc_build_cc_frm(struct quic_conn *qc, struct quic_enc_level *qel,
}
else {
out->type = QUIC_FT_CONNECTION_CLOSE_APP;
out->connection_close.error_code = qc->err.code;
out->connection_close.reason_phrase_len = 0;
out->connection_close_app.error_code = qc->err.code;
out->connection_close_app.reason_phrase_len = 0;
}
}
else {
Expand Down

0 comments on commit fe3726c

Please sign in to comment.