comparison src/event/ngx_event_quic_protection.c @ 8542:d3489d225f8f quic

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.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 08 Sep 2020 13:27:39 +0300
parents c6b963de0c00
children 9aedab0f0dff
comparison
equal deleted inserted replaced
8541:dcbb58e7ed11 8542:d3489d225f8f
1056 "quic packet number: %uL, len: %xi", pn, pnl); 1056 "quic packet number: %uL, len: %xi", pn, pnl);
1057 1057
1058 /* packet protection */ 1058 /* packet protection */
1059 1059
1060 in.data = p; 1060 in.data = p;
1061 in.len = pkt->len - pnl;
1061 1062
1062 if (ngx_quic_long_pkt(pkt->flags)) { 1063 if (ngx_quic_long_pkt(pkt->flags)) {
1063 in.len = pkt->len - pnl;
1064 badflags = clearflags & NGX_QUIC_PKT_LONG_RESERVED_BIT; 1064 badflags = clearflags & NGX_QUIC_PKT_LONG_RESERVED_BIT;
1065 1065
1066 } else { 1066 } else {
1067 in.len = pkt->data + pkt->len - p;
1068 badflags = clearflags & NGX_QUIC_PKT_SHORT_RESERVED_BIT; 1067 badflags = clearflags & NGX_QUIC_PKT_SHORT_RESERVED_BIT;
1069 } 1068 }
1070 1069
1071 ad.len = p - pkt->data; 1070 ad.len = p - pkt->data;
1072 ad.data = pkt->plaintext; 1071 ad.data = pkt->plaintext;