Added parsing of CONNECTION_CLOSE2 frame (0x1D).

The difference is that error code refers to application namespace, i.e.
quic error names cannot be used to convert it to string.
This commit is contained in:
Vladimir Homutov 2020-03-20 14:50:05 +03:00
parent 4096676897
commit 6565860bd8
2 changed files with 22 additions and 12 deletions

View File

@ -622,6 +622,7 @@ ngx_quic_parse_frame(ngx_quic_header_t *pkt, u_char *start, u_char *end,
break;
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,
@ -640,18 +641,27 @@ ngx_quic_parse_frame(ngx_quic_header_t *pkt, u_char *start, u_char *end,
return NGX_ERROR;
}
if (f->u.close.error_code >= NGX_QUIC_ERR_LAST) {
ngx_log_error(NGX_LOG_ERR, pkt->log, 0,
"unkown error code: %ui, truncated",
f->u.close.error_code);
f->u.close.error_code = NGX_QUIC_ERR_LAST - 1;
}
if (f->type == NGX_QUIC_FT_CONNECTION_CLOSE) {
ngx_log_debug4(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
"CONN.CLOSE: { %s (0x%xi) type=0x%xi reason='%V'}",
ngx_quic_error_text(f->u.close.error_code),
f->u.close.error_code, f->u.close.frame_type,
&f->u.close.reason);
if (f->u.close.error_code >= NGX_QUIC_ERR_LAST) {
ngx_log_error(NGX_LOG_ERR, pkt->log, 0,
"unkown error code: %ui, truncated",
f->u.close.error_code);
f->u.close.error_code = NGX_QUIC_ERR_LAST - 1;
}
ngx_log_debug4(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
"CONN.CLOSE: { %s (0x%xi) type=0x%xi reason='%V'}",
ngx_quic_error_text(f->u.close.error_code),
f->u.close.error_code, f->u.close.frame_type,
&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);
}
break;

View File

@ -47,7 +47,7 @@
#define NGX_QUIC_FT_PATH_CHALLENGE 0x1A
#define NGX_QUIC_FT_PATH_RESPONSE 0x1B
#define NGX_QUIC_FT_CONNECTION_CLOSE 0x1C
#define NGX_QUIC_FT_CONNECTION_CLOSE2 0x1D // XXX
#define NGX_QUIC_FT_CONNECTION_CLOSE2 0x1D
#define NGX_QUIC_FT_HANDSHAKE_DONE 0x1E
/* 22.4. QUIC Transport Error Codes Registry */