Mercurial > hg > nginx
comparison src/event/ngx_event_quic_transport.c @ 8569:a6784cf32c13 quic
QUIC: fixed handling of incorrect packets.
Instead of ignoring, connection was closed. This was broken in d0d3fc0697a0.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 01 Oct 2020 22:20:51 +0300 |
parents | b31c02454539 |
children | b95aa1cb8f98 |
comparison
equal
deleted
inserted
replaced
8568:0875101c08f7 | 8569:a6784cf32c13 |
---|---|
254 ngx_quic_parse_packet(ngx_quic_header_t *pkt) | 254 ngx_quic_parse_packet(ngx_quic_header_t *pkt) |
255 { | 255 { |
256 if (!ngx_quic_long_pkt(pkt->flags)) { | 256 if (!ngx_quic_long_pkt(pkt->flags)) { |
257 pkt->level = ssl_encryption_application; | 257 pkt->level = ssl_encryption_application; |
258 | 258 |
259 return ngx_quic_parse_short_header(pkt, NGX_QUIC_SERVER_CID_LEN); | 259 if (ngx_quic_parse_short_header(pkt, NGX_QUIC_SERVER_CID_LEN) != NGX_OK) |
260 { | |
261 return NGX_DECLINED; | |
262 } | |
263 | |
264 return NGX_OK; | |
260 } | 265 } |
261 | 266 |
262 if (ngx_quic_parse_long_header(pkt) != NGX_OK) { | 267 if (ngx_quic_parse_long_header(pkt) != NGX_OK) { |
263 return NGX_DECLINED; | 268 return NGX_DECLINED; |
264 } | 269 } |
275 return NGX_DECLINED; | 280 return NGX_DECLINED; |
276 } | 281 } |
277 | 282 |
278 pkt->level = ssl_encryption_initial; | 283 pkt->level = ssl_encryption_initial; |
279 | 284 |
280 return ngx_quic_parse_initial_header(pkt); | 285 if (ngx_quic_parse_initial_header(pkt) != NGX_OK) { |
286 return NGX_DECLINED; | |
287 } | |
288 | |
289 return NGX_OK; | |
281 } | 290 } |
282 | 291 |
283 if (ngx_quic_pkt_hs(pkt->flags)) { | 292 if (ngx_quic_pkt_hs(pkt->flags)) { |
284 pkt->level = ssl_encryption_handshake; | 293 pkt->level = ssl_encryption_handshake; |
285 | 294 |
290 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, | 299 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, |
291 "quic unknown long packet type"); | 300 "quic unknown long packet type"); |
292 return NGX_DECLINED; | 301 return NGX_DECLINED; |
293 } | 302 } |
294 | 303 |
295 return ngx_quic_parse_handshake_header(pkt); | 304 if (ngx_quic_parse_handshake_header(pkt) != NGX_OK) { |
305 return NGX_DECLINED; | |
306 } | |
307 | |
308 return NGX_OK; | |
296 } | 309 } |
297 | 310 |
298 | 311 |
299 static ngx_int_t | 312 static ngx_int_t |
300 ngx_quic_parse_long_header(ngx_quic_header_t *pkt) | 313 ngx_quic_parse_long_header(ngx_quic_header_t *pkt) |