aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2020-09-08 13:27:39 +0300
committerSergey Kandaurov <pluknet@nginx.com>2020-09-08 13:27:39 +0300
commit952c6f19898b770906aefeb52dd0eb8a578dd808 (patch)
treecb8391320db9ccfb32be863aafce9a7566defae5 /src
parente43ef3dda9efaa1488c36951b089d77f65c75a79 (diff)
downloadnginx-952c6f19898b770906aefeb52dd0eb8a578dd808.tar.gz
nginx-952c6f19898b770906aefeb52dd0eb8a578dd808.zip
QUIC: update packet length for short packets too.
During long packet header parsing, pkt->len is updated with the Length field value that is used to find next coalesced packets in a datagram. For short packets it still contained the whole QUIC packet size. This change uniforms packet length handling to always contain the total length of the packet number and protected packet payload in pkt->len.
Diffstat (limited to 'src')
-rw-r--r--src/event/ngx_event_quic_protection.c3
-rw-r--r--src/event/ngx_event_quic_transport.c1
2 files changed, 2 insertions, 2 deletions
diff --git a/src/event/ngx_event_quic_protection.c b/src/event/ngx_event_quic_protection.c
index fd11e591e..261f02d7f 100644
--- a/src/event/ngx_event_quic_protection.c
+++ b/src/event/ngx_event_quic_protection.c
@@ -1058,13 +1058,12 @@ ngx_quic_decrypt(ngx_quic_header_t *pkt, ngx_ssl_conn_t *ssl_conn,
/* packet protection */
in.data = p;
+ in.len = pkt->len - pnl;
if (ngx_quic_long_pkt(pkt->flags)) {
- in.len = pkt->len - pnl;
badflags = clearflags & NGX_QUIC_PKT_LONG_RESERVED_BIT;
} else {
- in.len = pkt->data + pkt->len - p;
badflags = clearflags & NGX_QUIC_PKT_SHORT_RESERVED_BIT;
}
diff --git a/src/event/ngx_event_quic_transport.c b/src/event/ngx_event_quic_transport.c
index 36e987f92..1d270a2f2 100644
--- a/src/event/ngx_event_quic_transport.c
+++ b/src/event/ngx_event_quic_transport.c
@@ -511,6 +511,7 @@ ngx_quic_parse_short_header(ngx_quic_header_t *pkt, ngx_str_t *dcid)
}
pkt->raw->pos = p;
+ pkt->len = end - p;
return NGX_OK;
}