aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2020-03-20 15:14:00 +0300
committerVladimir Homutov <vl@nginx.com>2020-03-20 15:14:00 +0300
commit1d35d0f31e4fefd7c8381e79d0207fa1e092d550 (patch)
tree164f601d4ada9a35629d6e185c46cafff3b0891a
parent6565860bd852623ecba8e6329310f4810f8c3dc5 (diff)
downloadnginx-1d35d0f31e4fefd7c8381e79d0207fa1e092d550.tar.gz
nginx-1d35d0f31e4fefd7c8381e79d0207fa1e092d550.zip
Fixed parsing of CONNECTION CLOSE2 frames.
The "frame_type" field is not passed in case of 0x1d frame.
-rw-r--r--src/event/ngx_event_quic_transport.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/event/ngx_event_quic_transport.c b/src/event/ngx_event_quic_transport.c
index 23921a04d..2ea80ca7e 100644
--- a/src/event/ngx_event_quic_transport.c
+++ b/src/event/ngx_event_quic_transport.c
@@ -624,12 +624,24 @@ ngx_quic_parse_frame(ngx_quic_header_t *pkt, u_char *start, u_char *end,
case NGX_QUIC_FT_CONNECTION_CLOSE:
case NGX_QUIC_FT_CONNECTION_CLOSE2:
- p = ngx_quic_parse_int_multi(p, end, &f->u.close.error_code,
- &f->u.close.frame_type,
- &f->u.close.reason.len, NULL);
+ p = ngx_quic_parse_int(p, end, &f->u.close.error_code);
if (p == NULL) {
ngx_log_error(NGX_LOG_ERR, pkt->log, 0,
- "failed to parse close connection frame");
+ "failed to parse close connection frame error code");
+ return NGX_ERROR;
+ }
+
+ if (f->type == NGX_QUIC_FT_CONNECTION_CLOSE) {
+ p = ngx_quic_parse_int(p, end, &f->u.close.frame_type);
+ ngx_log_error(NGX_LOG_ERR, pkt->log, 0,
+ "failed to parse close connection frame type");
+ return NGX_ERROR;
+ }
+
+ p = ngx_quic_parse_int(p, end, &f->u.close.reason.len);
+ if (p == NULL) {
+ ngx_log_error(NGX_LOG_ERR, pkt->log, 0,
+ "failed to parse close reason length");
return NGX_ERROR;
}
@@ -657,10 +669,9 @@ ngx_quic_parse_frame(ngx_quic_header_t *pkt, u_char *start, u_char *end,
&f->u.close.reason);
} else {
- ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
- "CONN.CLOSE2: { (0x%xi) type=0x%xi reason '%V'}",
- f->u.close.error_code, f->u.close.frame_type,
- &f->u.close.reason);
+ ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
+ "CONN.CLOSE2: { (0x%xi) reason '%V'}",
+ f->u.close.error_code, &f->u.close.reason);
}
break;