aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2025-01-12 02:02:09 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2025-01-12 02:22:14 +0300
commitb5a2fa52303e6b4261cac0496ccaaeb314e0ea54 (patch)
tree90b8fdeb6e437243d610c812547c3c8f64833071 /contrib/libs
parent2e3581e520a979f41dabfffbe6b18014d04c3e9c (diff)
downloadydb-b5a2fa52303e6b4261cac0496ccaaeb314e0ea54.tar.gz
Update contrib/libs/ngtcp2 to 1.10.0
commit_hash:575ab472e9f49752fd76b8aa5096e6042f4a3782
Diffstat (limited to 'contrib/libs')
-rw-r--r--contrib/libs/ngtcp2/.yandex_meta/devtools.copyrights.report2
-rw-r--r--contrib/libs/ngtcp2/.yandex_meta/devtools.licenses.report2
-rw-r--r--contrib/libs/ngtcp2/.yandex_meta/licenses.list.txt1
-rw-r--r--contrib/libs/ngtcp2/.yandex_meta/override.nix4
-rw-r--r--contrib/libs/ngtcp2/AUTHORS1
-rw-r--r--contrib/libs/ngtcp2/ChangeLog513
-rw-r--r--contrib/libs/ngtcp2/README.rst16
-rw-r--r--contrib/libs/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto.h118
-rw-r--r--contrib/libs/ngtcp2/crypto/shared.c200
-rw-r--r--contrib/libs/ngtcp2/lib/includes/ngtcp2/ngtcp2.h11
-rw-r--r--contrib/libs/ngtcp2/lib/includes/ngtcp2/version.h4
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_acktr.c9
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_acktr.h4
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_balloc.h2
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_bbr.c2
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_conn.c84
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_conn.h10
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_frame_chain.c2
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_frame_chain.h2
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_gaptr.c16
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_ksl.c73
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_ksl.h104
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_macro.h36
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_map.c4
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_pv.h2
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_ringbuf.c16
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_rob.c16
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_rtb.c27
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_rtb.h2
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_strm.c7
-rw-r--r--contrib/libs/ngtcp2/ya.make4
31 files changed, 1114 insertions, 180 deletions
diff --git a/contrib/libs/ngtcp2/.yandex_meta/devtools.copyrights.report b/contrib/libs/ngtcp2/.yandex_meta/devtools.copyrights.report
index 8555efbf89..05464e0456 100644
--- a/contrib/libs/ngtcp2/.yandex_meta/devtools.copyrights.report
+++ b/contrib/libs/ngtcp2/.yandex_meta/devtools.copyrights.report
@@ -127,7 +127,7 @@ BELONGS ya.make
Match type : COPYRIGHT
Files with this license:
COPYING [3:3]
- README.rst [355:355]
+ README.rst [357:357]
lib/includes/ngtcp2/version.h [4:4]
KEEP COPYRIGHT_SERVICE_LABEL 94b9ad611aac02e9c9d2f6105f7ab5f2
diff --git a/contrib/libs/ngtcp2/.yandex_meta/devtools.licenses.report b/contrib/libs/ngtcp2/.yandex_meta/devtools.licenses.report
index 62c23b3fc1..09b80ceac3 100644
--- a/contrib/libs/ngtcp2/.yandex_meta/devtools.licenses.report
+++ b/contrib/libs/ngtcp2/.yandex_meta/devtools.licenses.report
@@ -83,7 +83,7 @@ BELONGS ya.make
Match type : NOTICE
Links : http://opensource.org/licenses/mit-license.php, https://spdx.org/licenses/MIT
Files with this license:
- README.rst [350:353]
+ README.rst [352:355]
KEEP MIT a3a8f7feced3937b87cd090ba748e24b
BELONGS ya.make
diff --git a/contrib/libs/ngtcp2/.yandex_meta/licenses.list.txt b/contrib/libs/ngtcp2/.yandex_meta/licenses.list.txt
index ec8c3e3f37..849335d337 100644
--- a/contrib/libs/ngtcp2/.yandex_meta/licenses.list.txt
+++ b/contrib/libs/ngtcp2/.yandex_meta/licenses.list.txt
@@ -87,6 +87,7 @@ Frédéric Lécaille
Félix Dagenais
Irina Guberman
James M Snell
+Jan Doskočil
Jason Rhinelander
Javier Blazquez
Jay Satiro
diff --git a/contrib/libs/ngtcp2/.yandex_meta/override.nix b/contrib/libs/ngtcp2/.yandex_meta/override.nix
index cc56fbc565..780296e02a 100644
--- a/contrib/libs/ngtcp2/.yandex_meta/override.nix
+++ b/contrib/libs/ngtcp2/.yandex_meta/override.nix
@@ -1,9 +1,9 @@
pkgs: attrs: with pkgs; rec {
- version = "1.8.1";
+ version = "1.10.0";
src = fetchurl {
url = "https://github.com/ngtcp2/ngtcp2/releases/download/v${version}/ngtcp2-${version}.tar.xz";
- hash = "sha256-rIRKees/FT5Mzc/szt9CxXqzUruKuS7IrF00F6ec+xE=";
+ hash = "sha256-T43B1hlXIF0Bw9aqbxyWx7K6wf7qcf2vly2G219kZd8=";
};
patches = [];
diff --git a/contrib/libs/ngtcp2/AUTHORS b/contrib/libs/ngtcp2/AUTHORS
index 7019dbc8e6..c8bc2b5d1b 100644
--- a/contrib/libs/ngtcp2/AUTHORS
+++ b/contrib/libs/ngtcp2/AUTHORS
@@ -18,6 +18,7 @@ Frédéric Lécaille
Félix Dagenais
Irina Guberman
James M Snell
+Jan Doskočil
Jason Rhinelander
Javier Blazquez
Jay Satiro
diff --git a/contrib/libs/ngtcp2/ChangeLog b/contrib/libs/ngtcp2/ChangeLog
index 90501bdbef..1a8639bb50 100644
--- a/contrib/libs/ngtcp2/ChangeLog
+++ b/contrib/libs/ngtcp2/ChangeLog
@@ -1,42 +1,509 @@
-commit 9accf8d7803f874eaf418ec8988a67aa34ed193e
+commit 2372cdee861db68cabcb0e80c92adb535b0ad1b5
Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-10-17
+AuthorDate: 2024-12-19
Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-10-17
+CommitDate: 2024-12-19
Bump package and library versions
-commit 84833ccc39ce7901c7f41d3d05e2d09c3a66e71a
+commit 4a2d66447377e3d68b6c6004a0267d0f03330152
+Merge: 22f7b49f d1eab45e
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-19
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-19
+
+ Merge pull request #1451 from ngtcp2/bump-aws-lc
+
+ Bump aws-lc
+
+commit d1eab45ed3b2fff757aec2fe05239ce1e13953e9
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-12-19
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-12-19
+
+ Bump aws-lc
+
+commit 22f7b49f0aa6a75480192128797d8255c3f0c7cb
+Merge: 7d7f3148 10ef5b3c
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-19
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-19
+
+ Merge pull request #1450 from ngtcp2/bump-picotls
+
+ Bump picotls
+
+commit 10ef5b3ca3275a93416b9d3173ae9d52d510b652
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-12-19
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-12-19
+
+ Bump picotls
+
+commit 7d7f31481bd4640103df242f0dd80e90d5657144
+Merge: 3f80b590 161dc86d
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-19
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-19
+
+ Merge pull request #1449 from ngtcp2/bump-boringssl
+
+ Bump boringssl
+
+commit 161dc86d0197c943cd3b0b0775832d5998050d34
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-12-19
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-12-19
+
+ Bump boringssl
+
+commit 3f80b5908d24a0b3e481e669291b04916e11fdb0
+Merge: e59d0003 6f13abb7
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-18
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-18
+
+ Merge pull request #1448 from ngtcp2/fix-rob-fuzzer
+
+ Fix rob fuzzer
+
+commit 6f13abb7d5cbe31f9273a7ed90ade1e13e4a5f80
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-12-18
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-12-18
+
+ Fix rob fuzzer
+
+commit e59d0003fc9c79a554b88d573aa2b88477a6f6af
+Merge: 60dfbcb5 78eac56d
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-17
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-17
+
+ Merge pull request #1447 from ngtcp2/require-recent-aws-lc
+
+ Require recent version of aws-lc due to X25519MLKEM768 in examples
+
+commit 78eac56da835698120ea336378ff70e2552069fa
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-12-17
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-12-17
+
+ Require recent version of aws-lc due to X25519MLKEM768 in examples
+
+commit 60dfbcb516bfd4d3840a89624f208ed8f1f37b2c
+Merge: d133fb12 d544f8b0
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-17
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-17
+
+ Merge pull request #1446 from ngtcp2/rob-fuzzer
+
+ Add ngtcp2_rob fuzzer
+
+commit d544f8b09fbdf992b5fd73e59d5df3e23ecfae71
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-12-17
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-12-17
+
+ Add ngtcp2_rob fuzzer
+
+commit d133fb12630a4090ee3d957fe09a0435b8bac158
+Merge: 5653db05 2d809d6c
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-16
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-16
+
+ Merge pull request #1445 from ngtcp2/remove-outdated-pmtud-probe-lost-handling
+
+ Remove outdated PMTUD probe packet handling when it is lost
+
+commit 2d809d6c3097dda1dea36f4f7c65a5e88fb4a596
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-12-16
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-12-16
+
+ Remove outdated PMTUD probe packet handling when it is lost
+
+ It seems this is an oversight in
+ cbd6f5815c0c6e8ae8040e1ce255103f3ff3cc6a. This relevant part of code
+ should have been removed in that commit. Because this function is
+ only called when Retry packet is received, and PMTUD packet is not
+ sent in this phase, this extra code should not cause any issue.
+
+commit 5653db05d796dd0b1003caa1ff975a74fa82cc4d
+Merge: 5deca198 1ca7af0e
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-16
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-16
+
+ Merge pull request #1443 from ngtcp2/ksl-fuzzed-data-provider
+
+ Update ksl fuzzer with FuzzedDataProvider
+
+commit 1ca7af0e69524c68611adfdb5c7284223ed4f427
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-12-15
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-12-16
+
+ Update ksl fuzzer with FuzzedDataProvider
+
+commit 5deca198ca3f2ca2925f97a6cb97eb6bdcc59dee
+Merge: 234a7acc 9236c181
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-16
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-16
+
+ Merge pull request #1444 from amirlivneh/fuzz-remote-transport-params
+
+ Fuzz remote transport params in read_write_pkt fuzzer
+
+commit 9236c1810932ab8c1eab251a5c209d91fccffa58
+Author: Your Name <you@example.com>
+AuthorDate: 2024-12-15
+Commit: Your Name <you@example.com>
+CommitDate: 2024-12-15
+
+ Fuzz remote transport params in read_write_pkt fuzzer
+
+commit 234a7acc92350e00e4527103445898986e2d322c
+Merge: dac1cf99 5e1430da
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-06
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-06
+
+ Merge pull request #1441 from ngtcp2/fix-zero-length-stream-retransmit
+
+ Fix assertion error when retransmitting 0 length STREAM frames
+
+commit 5e1430da02ab07b818970b47064861dd80f5dc24
Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-10-12
+AuthorDate: 2024-12-06
Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-10-17
+CommitDate: 2024-12-06
- Add test for ACK padding
+ Fix assertion error when retransmitting 0 length STREAM frames
-commit 29209046dc3cbba4ccad36062dfa54ac34b8ffc3
+commit dac1cf99cc4a1f9a68cf3efcc42e4b09bde0ff04
+Merge: a735587e fce403ec
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-05
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-05
+
+ Merge pull request #1439 from ngtcp2/cleanup-build-files-around-http-parser
+
+ examples: Cleanup build files around http-parser
+
+commit fce403ec6b76fb6ec54ff34a6f95b8892316463a
Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-10-11
+AuthorDate: 2024-12-05
Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-10-17
+CommitDate: 2024-12-05
+
+ examples: Cleanup build files around http-parser
+
+commit a735587e5e75345484b931930a7cfda43fa79d83
+Merge: 67047340 b43b9f83
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-12-04
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-12-04
- Fix minimum packet size computation
+ Merge pull request #1438 from ngtcp2/remove-http-parser-include
- The Connection ID used in minimum packet size computation should be
- Connection ID length that a local endpoint is generated and sends to a
- remote endpoint.
+ examples: Remove unnecessary http-parser include
+
+commit b43b9f83530abc3b40582843dd09cb8f19a9b045
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-12-04
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-12-04
+
+ examples: Remove unnecessary http-parser include
+
+commit 67047340bc3f0cffd3217f8be649405a3927065c
+Merge: 28c4a079 d279e4f1
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-29
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-29
+
+ Merge pull request #1435 from ngtcp2/clang-format
- Merge ngtcp2_ppe_padding_hp_sample to ngtcp2_ppe_padding_size to
- ensure that minimum packet size is always honored.
+ clang-format
-commit 2683ec782e9bdb7a1d6800d611a7a8f87dff8219
+commit d279e4f1bc3b77f0acc26d2d81ef67c0069dc4e8
Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-AuthorDate: 2024-10-11
+AuthorDate: 2024-11-29
Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
-CommitDate: 2024-10-17
+CommitDate: 2024-11-29
+
+ clang-format
+
+commit 28c4a079cdee0fdd3b65283a88377f0bce710820
+Merge: 151c507e 0b53adc6
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-29
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-29
- Do not count PADDING to CWND if it is added to make minimum sized packet
+ Merge pull request #1434 from amirlivneh/fuzz-client
- Otherwise, we ended up cwnd-limited situation, and if ACKs from remote
- is lost frequently, local endpoint is unable to send any ack eliciting
- packet.
+ Exercise client in read_write_pkt fuzzer
+
+commit 0b53adc6da0933f2e1c4fd77d94bc06526bc9370
+Author: Your Name <you@example.com>
+AuthorDate: 2024-11-28
+Commit: Your Name <you@example.com>
+CommitDate: 2024-11-28
+
+ Exercise client in read_write_pkt fuzzer
+
+commit 151c507e84c5f94cd193df5fbb306ad4e9375351
+Merge: 86de7788 1c46200c
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-28
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-28
+
+ Merge pull request #1433 from amirlivneh/fuzz-cc-algo
+
+ Exercise all CC algorithms in read_write_pkt fuzzer
+
+commit 1c46200ca9006955679f60861b3ddbf6ee809c94
+Author: Amir Livneh <alivneh@meta.com>
+AuthorDate: 2024-11-27
+Commit: Amir Livneh <alivneh@meta.com>
+CommitDate: 2024-11-27
+
+ Exercise all CC algorithms in read_write_pkt fuzzer
+
+commit 86de77889af1bb50ebdc73c5d36a6e5b912e9a51
+Merge: a9bd9d6f 45e5a3f4
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-28
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-28
+
+ Merge pull request #1432 from amirlivneh/fuzz-timestamp
+
+ Fuzz timestamp in read_write_pkt fuzzer
+
+commit 45e5a3f4c19a64d8b17a3f2099fee5eba22ca794
+Author: Amir Livneh <alivneh@meta.com>
+AuthorDate: 2024-11-27
+Commit: Amir Livneh <alivneh@meta.com>
+CommitDate: 2024-11-27
+
+ Fuzz timestamp in read_write_pkt fuzzer
+
+commit a9bd9d6f900b67ce8236c8d0e5d9498d95eb952c
+Merge: 5cee9670 efc26eb5
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-27
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-27
+
+ Merge pull request #1431 from amirlivneh/fuzz-different-packets
+
+ Fuzz sequences of different received packets
+
+commit efc26eb5e017ca930df138b9783c3291ed71e7fc
+Author: Amir Livneh <alivneh@meta.com>
+AuthorDate: 2024-11-24
+Commit: Amir Livneh <alivneh@meta.com>
+CommitDate: 2024-11-27
+
+ Fuzz sequences of different received packets
+
+ This increases the coverage of the fuzzer significantly.
+
+commit 5cee96707b9f64cd8bdb41d46aeca9486787fddb
+Merge: 194c1f33 1d2c8d53
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-27
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-27
+
+ Merge pull request #1430 from ngtcp2/avoid-extending-app-limited
+
+ Do not extend app-limited period
+
+commit 1d2c8d53405675bf5cf0c4a47c1d0d8ba7978c88
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-11-27
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-11-27
+
+ Do not extend app-limited period
+
+ Do not extend app-limited period so that it does not severely limit
+ CWND.
+
+commit 194c1f33b5c015f8a462c713476dc82b16c6ee2d
+Merge: 7a64c332 638d3ddd
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-27
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-27
+
+ Merge pull request #1429 from amirlivneh/fuzz-qlog
+
+ Exercise qlog code in fuzzing
+
+commit 7a64c332fb058ee9f3bb07d2518aa48225ff9144
+Merge: 30f0de07 511fd4f2
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-25
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-25
+
+ Merge pull request #1428 from ngtcp2/update-security-policy
+
+ Update security policy
+
+commit 511fd4f2d742cbf7477fb2480a932a711f78ad6f
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-11-25
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-11-25
+
+ Update security policy
+
+commit 30f0de07ebd7de3b37fe4463543e1140892dd638
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-11-25
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-11-25
+
+ Bump library version due to the patch release
+
+commit 2b95f3b59ee1464040a4ed78076a8a8a3e43b368
+Merge: 7875a51c 44b662bd
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-25
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-25
+
+ Merge commit from fork
+
+ Fix heap buffer overflow writing not validated ACK to qlog
+
+commit 44b662bd139c23fee1703bf256c13349e2e624a1
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-11-22
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-11-25
+
+ Fix heap buffer overflow writing not validated ACK to qlog
+
+commit 638d3dddf6324e73f5af6113b04652158a76bb3c
+Author: Amir Livneh <alivneh@meta.com>
+AuthorDate: 2024-11-24
+Commit: Amir Livneh <alivneh@meta.com>
+CommitDate: 2024-11-24
+
+ Exercise qlog code in fuzzing
+
+commit 7875a51c9b62a15d6b335e636e596b45e263d141
+Merge: f86756ec ce779d1c
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-24
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-24
+
+ Merge pull request #1426 from ngtcp2/boringssl-enable-x25519mlkem768
+
+ examples: Enable X25519MLKEM768 for boringssl
+
+commit ce779d1cb987ef18f0eaf8fb55b8e35b0d18b411
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-11-24
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-11-24
+
+ examples: Enable X25519MLKEM768 for boringssl
+
+commit f86756ec2d8c648339633e38bd07e92bbefebf12
+Merge: cbc571e4 e73657a9
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-24
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-24
+
+ Merge pull request #1425 from ngtcp2/client-gso
+
+ example/client: Enable GSO
+
+commit e73657a984d2626b74fd1212784c972a923263a1
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-11-24
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-11-24
+
+ example/client: Enable GSO
+
+commit cbc571e46a435f922802cf979eb4a13088b29b07
+Merge: 2695d8d5 9bdb5083
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-23
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-23
+
+ Merge pull request #1423 from ngtcp2/rename-initial-hashbits
+
+ Rename NGTCP2_INITIAL_TABLE_LENBITS to NGTCP2_INITIAL_HASHBITS
+
+commit 9bdb5083814f57c549cef4959e297752ad75001c
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-11-23
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-11-23
+
+ Rename NGTCP2_INITIAL_TABLE_LENBITS to NGTCP2_INITIAL_HASHBITS
+
+commit 2695d8d5fa60a1cd1f4ef14f007e41af3e99a7e7
+Merge: d6d6ed80 b1d9125d
+Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>
+AuthorDate: 2024-11-22
+Commit: GitHub <noreply@github.com>
+CommitDate: 2024-11-22
+
+ Merge pull request #1422 from ngtcp2/update-doc
+
+ Update doc
+
+commit b1d9125d8fc60be8bf855edd86de1c885621794a
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-11-22
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-11-22
+
+ Update doc
+
+commit d6d6ed80b58a49908b2d6e600b459a17a42d30b2
+Author: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+AuthorDate: 2024-11-19
+Commit: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
+CommitDate: 2024-11-19
+
+ Bump package version
diff --git a/contrib/libs/ngtcp2/README.rst b/contrib/libs/ngtcp2/README.rst
index 5d6990ff25..a3de8f7cb3 100644
--- a/contrib/libs/ngtcp2/README.rst
+++ b/contrib/libs/ngtcp2/README.rst
@@ -61,9 +61,9 @@ directory require at least one of the following TLS backends:
- `quictls
<https://github.com/quictls/openssl/tree/OpenSSL_1_1_1w+quic>`_
- GnuTLS >= 3.7.5
-- BoringSSL (commit 76968bb3d53982560bcf08bcd0ba3e1865fe15cd);
- or aws-lc >= 1.19.0
-- Picotls (commit 89fe56f4d79200a5801a08ed3b6ac8322e01ccd5)
+- BoringSSL (commit c361e279402ec359834b7eaa7d737462d02675e1);
+ or aws-lc >= 1.39.0
+- Picotls (commit 402544bb65b35c3231a8912f25919de7e7922659)
- wolfSSL >= 5.5.0
- LibreSSL >= v3.9.2
@@ -81,7 +81,7 @@ Build with wolfSSL
.. code-block:: shell
- $ git clone --depth 1 -b v5.7.2-stable https://github.com/wolfSSL/wolfssl
+ $ git clone --depth 1 -b v5.7.4-stable https://github.com/wolfSSL/wolfssl
$ cd wolfssl
$ autoreconf -i
$ # For wolfSSL < v5.6.6, append --enable-quic.
@@ -114,7 +114,7 @@ Build with BoringSSL
$ git clone https://boringssl.googlesource.com/boringssl
$ cd boringssl
- $ git checkout 76968bb3d53982560bcf08bcd0ba3e1865fe15cd
+ $ git checkout c361e279402ec359834b7eaa7d737462d02675e1
$ cmake -B build -DCMAKE_POSITION_INDEPENDENT_CODE=ON
$ make -j$(nproc) -C build
$ cd ..
@@ -141,7 +141,7 @@ Build with aws-lc
.. code-block:: shell
- $ git clone --depth 1 -b v1.36.1 https://github.com/aws/aws-lc
+ $ git clone --depth 1 -b v1.41.1 https://github.com/aws/aws-lc
$ cd aws-lc
$ cmake -B build -DDISABLE_GO=ON
$ make -j$(nproc) -C build
@@ -169,8 +169,10 @@ Build with libressl
.. code-block:: shell
- $ git clone --depth 1 -b v3.9.2 https://github.com/libressl/portable.git libressl
+ $ git clone --depth 1 -b v4.0.0 https://github.com/libressl/portable.git libressl
$ cd libressl
+ $ # Workaround autogen.sh failure
+ $ export LIBRESSL_GIT_OPTIONS="-b libressl-v4.0.0"
$ ./autogen.sh
$ ./configure --prefix=$PWD/build
$ make -j$(nproc) install
diff --git a/contrib/libs/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto.h b/contrib/libs/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto.h
index 5b8626191d..68093d18b7 100644
--- a/contrib/libs/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto.h
+++ b/contrib/libs/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto.h
@@ -39,6 +39,37 @@ extern "C" {
#endif /* defined(WIN32) */
/**
+ * @macrosection
+ *
+ * ngtcp2 crypto library error codes
+ */
+
+/**
+ * @macro
+ *
+ * :macro:`NGTCP2_CRYPTO_ERR_INTERNAL` indicates an internal error.
+ */
+#define NGTCP2_CRYPTO_ERR_INTERNAL -201
+
+/**
+ * @macro
+ *
+ * :macro:`NGTCP2_CRYPTO_ERR_UNREADABLE_TOKEN` indicates that a token
+ * is unreadable because it is not correctly formatted; or verifying
+ * the integrity protection failed.
+ */
+#define NGTCP2_CRYPTO_ERR_UNREADABLE_TOKEN -202
+
+/**
+ * @macro
+ *
+ * :macro:`NGTCP2_CRYPTO_ERR_VERIFY_TOKEN` indicates that a token does
+ * not probe the client address; or the token validity has expired; or
+ * it contains invalid Connection ID.
+ */
+#define NGTCP2_CRYPTO_ERR_VERIFY_TOKEN -203
+
+/**
* @function
*
* `ngtcp2_crypto_ctx_tls` initializes |ctx| by extracting negotiated
@@ -550,6 +581,14 @@ NGTCP2_EXTERN int ngtcp2_crypto_generate_stateless_reset_token(
/**
* @macro
*
+ * :macro:`NGTCP2_CRYPTO_TOKEN_MAGIC_RETRY2` is the magic byte for
+ * Retry token generated by `ngtcp2_crypto_generate_retry_token2`.
+ */
+#define NGTCP2_CRYPTO_TOKEN_MAGIC_RETRY2 0xb7
+
+/**
+ * @macro
+ *
* :macro:`NGTCP2_CRYPTO_TOKEN_MAGIC_REGULAR` is the magic byte for a
* token generated by `ngtcp2_crypto_generate_regular_token`.
*/
@@ -569,6 +608,17 @@ NGTCP2_EXTERN int ngtcp2_crypto_generate_stateless_reset_token(
/**
* @macro
*
+ * :macro:`NGTCP2_CRYPTO_MAX_RETRY_TOKENLEN2` is the maximum length of
+ * a token generated by `ngtcp2_crypto_generate_retry_token2`.
+ */
+#define NGTCP2_CRYPTO_MAX_RETRY_TOKENLEN2 \
+ (/* magic = */ 1 + sizeof(ngtcp2_sockaddr_union) + /* cid len = */ 1 + \
+ NGTCP2_MAX_CIDLEN + sizeof(ngtcp2_tstamp) + /* aead tag = */ 16 + \
+ NGTCP2_CRYPTO_TOKEN_RAND_DATALEN)
+
+/**
+ * @macro
+ *
* :macro:`NGTCP2_CRYPTO_MAX_REGULAR_TOKENLEN` is the maximum length
* of a token generated by `ngtcp2_crypto_generate_regular_token`.
*/
@@ -592,6 +642,8 @@ NGTCP2_EXTERN int ngtcp2_crypto_generate_stateless_reset_token(
* is a Destination Connection ID in Initial packet sent by client.
* |ts| is the timestamp when the token is generated.
*
+ * See also `ngtcp2_crypto_generate_retry_token2`.
+ *
* This function returns the length of generated token if it succeeds,
* or -1.
*/
@@ -627,6 +679,72 @@ NGTCP2_EXTERN int ngtcp2_crypto_verify_retry_token(
/**
* @function
*
+ * `ngtcp2_crypto_generate_retry_token2` generates a token in the
+ * buffer pointed by |token| that is sent with Retry packet. The
+ * buffer pointed by |token| must have at least
+ * :macro:`NGTCP2_CRYPTO_MAX_RETRY_TOKENLEN2` bytes long. The
+ * successfully generated token starts with
+ * :macro:`NGTCP2_CRYPTO_TOKEN_MAGIC_RETRY2`. |secret| of length
+ * |secretlen| is a keying material to generate keys to encrypt the
+ * token. |version| is QUIC version. |remote_addr| of length
+ * |remote_addrlen| is an address of client. |retry_scid| is a Source
+ * Connection ID chosen by server, and set in Retry packet. |odcid|
+ * is a Destination Connection ID in Initial packet sent by client.
+ * |ts| is the timestamp when the token is generated.
+ *
+ * Use this function instead of `ngtcp2_crypto_generate_retry_token`
+ * if more detailed error handling is required when verifying the
+ * token. `ngtcp2_crypto_verify_retry_token2` must be used to verify
+ * the token.
+ *
+ * This function returns the length of generated token if it succeeds,
+ * or -1.
+ */
+NGTCP2_EXTERN ngtcp2_ssize ngtcp2_crypto_generate_retry_token2(
+ uint8_t *token, const uint8_t *secret, size_t secretlen, uint32_t version,
+ const ngtcp2_sockaddr *remote_addr, ngtcp2_socklen remote_addrlen,
+ const ngtcp2_cid *retry_scid, const ngtcp2_cid *odcid, ngtcp2_tstamp ts);
+
+/**
+ * @function
+ *
+ * `ngtcp2_crypto_verify_retry_token2` verifies Retry token stored in
+ * the buffer pointed by |token| of length |tokenlen|. |secret| of
+ * length |secretlen| is a keying material to generate keys to decrypt
+ * the token. |version| is QUIC version of the Initial packet that
+ * contains this token. |remote_addr| of length |remote_addrlen| is
+ * an address of client. |dcid| is a Destination Connection ID in
+ * Initial packet sent by client. |timeout| is the period during
+ * which the token is valid. |ts| is the current timestamp. When
+ * validation succeeds, the extracted Destination Connection ID (which
+ * is the Destination Connection ID in Initial packet sent by client
+ * that triggered Retry packet) is stored in the buffer pointed by
+ * |odcid|.
+ *
+ * The token must be generated by
+ * `ngtcp2_crypto_generate_retry_token2`.
+ *
+ * This function returns 0 if it succeeds, or one of the following
+ * negative error codes:
+ *
+ * :macro:`NGTCP2_CRYPTO_ERR_UNREADABLE_TOKEN`
+ * A token is badly formatted; or verifying the integrity
+ * protection failed.
+ * :macro:`NGTCP2_CRYPTO_ERR_VERIFY_TOKEN`
+ * A token does not probe the client address; or the token
+ * validity has expired; or it contains invalid Connection ID.
+ * :macro:`NGTCP2_CRYPTO_ERR_INTERNAL`
+ * Internal error occurred.
+ */
+NGTCP2_EXTERN int ngtcp2_crypto_verify_retry_token2(
+ ngtcp2_cid *odcid, const uint8_t *token, size_t tokenlen,
+ const uint8_t *secret, size_t secretlen, uint32_t version,
+ const ngtcp2_sockaddr *remote_addr, ngtcp2_socklen remote_addrlen,
+ const ngtcp2_cid *dcid, ngtcp2_duration timeout, ngtcp2_tstamp ts);
+
+/**
+ * @function
+ *
* `ngtcp2_crypto_generate_regular_token` generates a token in the
* buffer pointed by |token| that is sent with NEW_TOKEN frame. The
* buffer pointed by |token| must have at least
diff --git a/contrib/libs/ngtcp2/crypto/shared.c b/contrib/libs/ngtcp2/crypto/shared.c
index 6088b80c37..98cd4de7e8 100644
--- a/contrib/libs/ngtcp2/crypto/shared.c
+++ b/contrib/libs/ngtcp2/crypto/shared.c
@@ -1080,6 +1080,206 @@ int ngtcp2_crypto_verify_retry_token(
return 0;
}
+static size_t crypto_generate_retry_token_aad2(uint8_t *dest, uint32_t version,
+ const ngtcp2_cid *retry_scid) {
+ uint8_t *p = dest;
+
+ version = ngtcp2_htonl(version);
+ memcpy(p, &version, sizeof(version));
+ p += sizeof(version);
+ memcpy(p, retry_scid->data, retry_scid->datalen);
+ p += retry_scid->datalen;
+
+ return (size_t)(p - dest);
+}
+
+static const uint8_t retry_token_info_prefix2[] = "retry_token2";
+
+ngtcp2_ssize ngtcp2_crypto_generate_retry_token2(
+ uint8_t *token, const uint8_t *secret, size_t secretlen, uint32_t version,
+ const ngtcp2_sockaddr *remote_addr, ngtcp2_socklen remote_addrlen,
+ const ngtcp2_cid *retry_scid, const ngtcp2_cid *odcid, ngtcp2_tstamp ts) {
+ uint8_t plaintext[sizeof(ngtcp2_sockaddr_union) + /* cid len = */ 1 +
+ NGTCP2_MAX_CIDLEN + sizeof(ngtcp2_tstamp)];
+ uint8_t rand_data[NGTCP2_CRYPTO_TOKEN_RAND_DATALEN];
+ uint8_t key[16];
+ uint8_t iv[12];
+ size_t keylen;
+ size_t ivlen;
+ ngtcp2_crypto_aead aead;
+ ngtcp2_crypto_md md;
+ ngtcp2_crypto_aead_ctx aead_ctx;
+ uint8_t aad[sizeof(version) + NGTCP2_MAX_CIDLEN];
+ size_t aadlen;
+ uint8_t *p = plaintext;
+ ngtcp2_tstamp ts_be = ngtcp2_htonl64(ts);
+ int rv;
+
+ assert((size_t)remote_addrlen <= sizeof(ngtcp2_sockaddr_union));
+
+ memset(plaintext, 0, sizeof(plaintext));
+
+ memcpy(p, remote_addr, (size_t)remote_addrlen);
+ p += sizeof(ngtcp2_sockaddr_union);
+ *p++ = (uint8_t)odcid->datalen;
+ memcpy(p, odcid->data, odcid->datalen);
+ p += NGTCP2_MAX_CIDLEN;
+ memcpy(p, &ts_be, sizeof(ts_be));
+
+ assert((size_t)(p + sizeof(ts_be) - plaintext) == sizeof(plaintext));
+
+ if (ngtcp2_crypto_random(rand_data, sizeof(rand_data)) != 0) {
+ return -1;
+ }
+
+ ngtcp2_crypto_aead_aes_128_gcm(&aead);
+ ngtcp2_crypto_md_sha256(&md);
+
+ keylen = ngtcp2_crypto_aead_keylen(&aead);
+ ivlen = ngtcp2_crypto_aead_noncelen(&aead);
+
+ assert(sizeof(key) == keylen);
+ assert(sizeof(iv) == ivlen);
+
+ if (crypto_derive_token_key(key, keylen, iv, ivlen, &md, secret, secretlen,
+ rand_data, sizeof(rand_data),
+ retry_token_info_prefix2,
+ sizeof(retry_token_info_prefix2) - 1) != 0) {
+ return -1;
+ }
+
+ aadlen = crypto_generate_retry_token_aad2(aad, version, retry_scid);
+
+ p = token;
+ *p++ = NGTCP2_CRYPTO_TOKEN_MAGIC_RETRY2;
+
+ if (ngtcp2_crypto_aead_ctx_encrypt_init(&aead_ctx, &aead, key, ivlen) != 0) {
+ return -1;
+ }
+
+ rv = ngtcp2_crypto_encrypt(p, &aead, &aead_ctx, plaintext, sizeof(plaintext),
+ iv, ivlen, aad, aadlen);
+
+ ngtcp2_crypto_aead_ctx_free(&aead_ctx);
+
+ if (rv != 0) {
+ return -1;
+ }
+
+ p += sizeof(plaintext) + aead.max_overhead;
+ memcpy(p, rand_data, sizeof(rand_data));
+ p += sizeof(rand_data);
+
+ return p - token;
+}
+
+int ngtcp2_crypto_verify_retry_token2(
+ ngtcp2_cid *odcid, const uint8_t *token, size_t tokenlen,
+ const uint8_t *secret, size_t secretlen, uint32_t version,
+ const ngtcp2_sockaddr *remote_addr, ngtcp2_socklen remote_addrlen,
+ const ngtcp2_cid *dcid, ngtcp2_duration timeout, ngtcp2_tstamp ts) {
+ uint8_t plaintext[sizeof(ngtcp2_sockaddr_union) + /* cid len = */ 1 +
+ NGTCP2_MAX_CIDLEN + sizeof(ngtcp2_tstamp)];
+ uint8_t key[16];
+ uint8_t iv[12];
+ size_t keylen;
+ size_t ivlen;
+ ngtcp2_crypto_aead_ctx aead_ctx;
+ ngtcp2_crypto_aead aead;
+ ngtcp2_crypto_md md;
+ uint8_t aad[sizeof(version) + NGTCP2_MAX_CIDLEN];
+ size_t aadlen;
+ const uint8_t *rand_data;
+ const uint8_t *ciphertext;
+ size_t ciphertextlen;
+ size_t cil;
+ int rv;
+ ngtcp2_tstamp gen_ts;
+ ngtcp2_sockaddr_union addr;
+ size_t addrlen;
+ uint8_t *p;
+
+ assert((size_t)remote_addrlen <= sizeof(ngtcp2_sockaddr_union));
+
+ if (tokenlen != NGTCP2_CRYPTO_MAX_RETRY_TOKENLEN2 ||
+ token[0] != NGTCP2_CRYPTO_TOKEN_MAGIC_RETRY2) {
+ return NGTCP2_CRYPTO_ERR_UNREADABLE_TOKEN;
+ }
+
+ rand_data = token + tokenlen - NGTCP2_CRYPTO_TOKEN_RAND_DATALEN;
+ ciphertext = token + 1;
+ ciphertextlen = (size_t)(rand_data - ciphertext);
+
+ ngtcp2_crypto_aead_aes_128_gcm(&aead);
+ ngtcp2_crypto_md_sha256(&md);
+
+ keylen = ngtcp2_crypto_aead_keylen(&aead);
+ ivlen = ngtcp2_crypto_aead_noncelen(&aead);
+
+ assert(sizeof(key) == keylen);
+ assert(sizeof(iv) == ivlen);
+
+ if (crypto_derive_token_key(key, keylen, iv, ivlen, &md, secret, secretlen,
+ rand_data, NGTCP2_CRYPTO_TOKEN_RAND_DATALEN,
+ retry_token_info_prefix2,
+ sizeof(retry_token_info_prefix2) - 1) != 0) {
+ return NGTCP2_CRYPTO_ERR_INTERNAL;
+ }
+
+ aadlen = crypto_generate_retry_token_aad2(aad, version, dcid);
+
+ if (ngtcp2_crypto_aead_ctx_decrypt_init(&aead_ctx, &aead, key, ivlen) != 0) {
+ return NGTCP2_CRYPTO_ERR_INTERNAL;
+ }
+
+ rv = ngtcp2_crypto_decrypt(plaintext, &aead, &aead_ctx, ciphertext,
+ ciphertextlen, iv, ivlen, aad, aadlen);
+
+ ngtcp2_crypto_aead_ctx_free(&aead_ctx);
+
+ if (rv != 0) {
+ return NGTCP2_CRYPTO_ERR_UNREADABLE_TOKEN;
+ }
+
+ p = plaintext;
+
+ memcpy(&addr, p, sizeof(addr));
+
+ switch (addr.sa.sa_family) {
+ case NGTCP2_AF_INET:
+ addrlen = sizeof(ngtcp2_sockaddr_in);
+ break;
+ case NGTCP2_AF_INET6:
+ addrlen = sizeof(ngtcp2_sockaddr_in6);
+ break;
+ default:
+ return NGTCP2_CRYPTO_ERR_VERIFY_TOKEN;
+ }
+
+ if (addrlen != (size_t)remote_addrlen ||
+ memcmp(&addr, remote_addr, addrlen) != 0) {
+ return NGTCP2_CRYPTO_ERR_VERIFY_TOKEN;
+ }
+
+ p += sizeof(addr);
+ cil = *p++;
+
+ if (cil != 0 && (cil < NGTCP2_MIN_CIDLEN || cil > NGTCP2_MAX_CIDLEN)) {
+ return NGTCP2_CRYPTO_ERR_VERIFY_TOKEN;
+ }
+
+ memcpy(&gen_ts, p + NGTCP2_MAX_CIDLEN, sizeof(gen_ts));
+
+ gen_ts = ngtcp2_ntohl64(gen_ts);
+ if (gen_ts + timeout <= ts) {
+ return NGTCP2_CRYPTO_ERR_VERIFY_TOKEN;
+ }
+
+ ngtcp2_cid_init(odcid, p, cil);
+
+ return 0;
+}
+
static size_t crypto_generate_regular_token_aad(uint8_t *dest,
const ngtcp2_sockaddr *sa) {
const uint8_t *addr;
diff --git a/contrib/libs/ngtcp2/lib/includes/ngtcp2/ngtcp2.h b/contrib/libs/ngtcp2/lib/includes/ngtcp2/ngtcp2.h
index 680f5a2eeb..2abeb8f1cd 100644
--- a/contrib/libs/ngtcp2/lib/includes/ngtcp2/ngtcp2.h
+++ b/contrib/libs/ngtcp2/lib/includes/ngtcp2/ngtcp2.h
@@ -1471,7 +1471,9 @@ typedef struct ngtcp2_transport_params {
uint64_t max_udp_payload_size;
/**
* :member:`active_connection_id_limit` is the maximum number of
- * Connection ID that sender can store.
+ * Connection ID that sender can store. If specified, it must be in
+ * the range of [:macro:`NGTCP2_DEFAULT_ACTIVE_CONNECTION_ID_LIMIT`,
+ * 8], inclusive.
*/
uint64_t active_connection_id_limit;
/**
@@ -1777,6 +1779,13 @@ typedef struct ngtcp2_settings {
* or :member:`ngtcp2_transport_params.initial_max_stream_data_uni`,
* depending on the type of stream. The window size is scaled up to
* the value specified in this field.
+ *
+ * Please note that the auto-tuning is done per stream. Even if the
+ * previous stream gets larger window as a result of auto-tuning,
+ * the new stream still starts with the initial value set in
+ * transport parameters. This might become a bottleneck if
+ * congestion window of a remote server is wide open. If this
+ * causes an issue, do not enable auto-tuning.
*/
uint64_t max_stream_window;
/**
diff --git a/contrib/libs/ngtcp2/lib/includes/ngtcp2/version.h b/contrib/libs/ngtcp2/lib/includes/ngtcp2/version.h
index 881ecb114d..20c4ac24d2 100644
--- a/contrib/libs/ngtcp2/lib/includes/ngtcp2/version.h
+++ b/contrib/libs/ngtcp2/lib/includes/ngtcp2/version.h
@@ -36,7 +36,7 @@
*
* Version number of the ngtcp2 library release.
*/
-#define NGTCP2_VERSION "1.8.1"
+#define NGTCP2_VERSION "1.10.0"
/**
* @macro
@@ -46,6 +46,6 @@
* number, 8 bits for minor and 8 bits for patch. Version 1.2.3
* becomes 0x010203.
*/
-#define NGTCP2_VERSION_NUM 0x010801
+#define NGTCP2_VERSION_NUM 0x010a00
#endif /* !defined(NGTCP2_VERSION_H) */
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_acktr.c b/contrib/libs/ngtcp2/lib/ngtcp2_acktr.c
index d5508ba890..0e5bfe069e 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_acktr.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_acktr.c
@@ -29,7 +29,7 @@
#include "ngtcp2_macro.h"
#include "ngtcp2_tstamp.h"
-ngtcp2_objalloc_def(acktr_entry, ngtcp2_acktr_entry, oplent);
+ngtcp2_objalloc_def(acktr_entry, ngtcp2_acktr_entry, oplent)
static void acktr_entry_init(ngtcp2_acktr_entry *ent, int64_t pkt_num,
ngtcp2_tstamp tstamp) {
@@ -56,10 +56,6 @@ void ngtcp2_acktr_entry_objalloc_del(ngtcp2_acktr_entry *ent,
ngtcp2_objalloc_acktr_entry_release(objalloc, ent);
}
-static int greater(const ngtcp2_ksl_key *lhs, const ngtcp2_ksl_key *rhs) {
- return *(int64_t *)lhs > *(int64_t *)rhs;
-}
-
void ngtcp2_acktr_init(ngtcp2_acktr *acktr, ngtcp2_log *log,
const ngtcp2_mem *mem) {
ngtcp2_objalloc_acktr_entry_init(&acktr->objalloc, NGTCP2_ACKTR_MAX_ENT + 1,
@@ -67,7 +63,8 @@ void ngtcp2_acktr_init(ngtcp2_acktr *acktr, ngtcp2_log *log,
ngtcp2_static_ringbuf_acks_init(&acktr->acks);
- ngtcp2_ksl_init(&acktr->ents, greater, sizeof(int64_t), mem);
+ ngtcp2_ksl_init(&acktr->ents, ngtcp2_ksl_int64_greater,
+ ngtcp2_ksl_int64_greater_search, sizeof(int64_t), mem);
acktr->log = log;
acktr->flags = NGTCP2_ACKTR_FLAG_NONE;
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_acktr.h b/contrib/libs/ngtcp2/lib/ngtcp2_acktr.h
index 4ef420723d..16aee42f27 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_acktr.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_acktr.h
@@ -65,7 +65,7 @@ typedef struct ngtcp2_acktr_entry {
};
} ngtcp2_acktr_entry;
-ngtcp2_objalloc_decl(acktr_entry, ngtcp2_acktr_entry, oplent);
+ngtcp2_objalloc_decl(acktr_entry, ngtcp2_acktr_entry, oplent)
/*
* ngtcp2_acktr_entry_objalloc_new allocates memory for ent, and
@@ -108,7 +108,7 @@ typedef struct ngtcp2_acktr_ack_entry {
expired and canceled. */
#define NGTCP2_ACKTR_FLAG_CANCEL_TIMER 0x0100u
-ngtcp2_static_ringbuf_def(acks, 32, sizeof(ngtcp2_acktr_ack_entry));
+ngtcp2_static_ringbuf_def(acks, 32, sizeof(ngtcp2_acktr_ack_entry))
/*
* ngtcp2_acktr tracks received packets which we have to send ack.
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_balloc.h b/contrib/libs/ngtcp2/lib/ngtcp2_balloc.h
index e69e7efc6f..c0e2a3f756 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_balloc.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_balloc.h
@@ -63,7 +63,7 @@ typedef struct ngtcp2_balloc {
/*
* ngtcp2_balloc_init initializes |balloc| with |blklen| which is the
- * size of memory block.
+ * size of memory block. |blklen| must be divisible by 16.
*/
void ngtcp2_balloc_init(ngtcp2_balloc *balloc, size_t blklen,
const ngtcp2_mem *mem);
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_bbr.c b/contrib/libs/ngtcp2/lib/ngtcp2_bbr.c
index 5a66c1870b..8777ca4c8a 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_bbr.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_bbr.c
@@ -1149,7 +1149,7 @@ static uint64_t bbr_bdp_multiple(ngtcp2_cc_bbr *bbr, uint64_t gain_h) {
return bbr->initial_cwnd;
}
- bdp = bbr->bw * bbr->min_rtt / NGTCP2_SECONDS;
+ bdp = ngtcp2_max_uint64(bbr->bw * bbr->min_rtt / NGTCP2_SECONDS, 1);
return (uint64_t)(bdp * gain_h / 100);
}
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_conn.c b/contrib/libs/ngtcp2/lib/ngtcp2_conn.c
index dff8d59459..765e4a877e 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_conn.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_conn.c
@@ -51,8 +51,12 @@
/* NGTCP2_MIN_COALESCED_PAYLOADLEN is the minimum length of QUIC
packet payload that should be coalesced to a long packet. */
#define NGTCP2_MIN_COALESCED_PAYLOADLEN 128
+/* NGTCP2_MAX_ACK_PER_PKT is the maximum number of ACK frame per an
+ incoming QUIC packet to process. ACK frames that exceed this limit
+ are not processed. */
+#define NGTCP2_MAX_ACK_PER_PKT 1
-ngtcp2_objalloc_def(strm, ngtcp2_strm, oplent);
+ngtcp2_objalloc_def(strm, ngtcp2_strm, oplent)
/*
* conn_local_stream returns nonzero if |stream_id| indicates that it
@@ -767,6 +771,8 @@ static int cid_less(const ngtcp2_ksl_key *lhs, const ngtcp2_ksl_key *rhs) {
return ngtcp2_cid_less(lhs, rhs);
}
+ngtcp2_ksl_search_def(cid_less, cid_less)
+
static int retired_ts_less(const ngtcp2_pq_entry *lhs,
const ngtcp2_pq_entry *rhs) {
const ngtcp2_scid *a = ngtcp2_struct_of(lhs, ngtcp2_scid, pe);
@@ -1159,7 +1165,8 @@ static int conn_new(ngtcp2_conn **pconn, const ngtcp2_cid *dcid,
ngtcp2_gaptr_init(&(*pconn)->dcid.seqgap, mem);
- ngtcp2_ksl_init(&(*pconn)->scid.set, cid_less, sizeof(ngtcp2_cid), mem);
+ ngtcp2_ksl_init(&(*pconn)->scid.set, cid_less, ksl_cid_less_search,
+ sizeof(ngtcp2_cid), mem);
ngtcp2_pq_init(&(*pconn)->scid.used, retired_ts_less, mem);
@@ -1657,8 +1664,9 @@ static int conn_ensure_ack_ranges(ngtcp2_conn *conn, size_t n) {
* ACK.
*/
static ngtcp2_duration conn_compute_ack_delay(ngtcp2_conn *conn) {
- return ngtcp2_min_uint64(conn->local.transport_params.max_ack_delay,
- conn->cstat.smoothed_rtt / 8);
+ return ngtcp2_min_uint64(
+ conn->local.transport_params.max_ack_delay,
+ ngtcp2_max_uint64(conn->cstat.smoothed_rtt / 8, NGTCP2_NANOSECONDS));
}
int ngtcp2_conn_create_ack_frame(ngtcp2_conn *conn, ngtcp2_frame **pfr,
@@ -2901,7 +2909,7 @@ static int conn_should_send_max_stream_data(ngtcp2_conn *conn,
uint64_t inc = strm->rx.unsent_max_offset - strm->rx.max_offset;
(void)conn;
- return strm->rx.window < 2 * inc;
+ return strm->rx.window < 4 * inc;
}
/*
@@ -2911,7 +2919,7 @@ static int conn_should_send_max_stream_data(ngtcp2_conn *conn,
static int conn_should_send_max_data(ngtcp2_conn *conn) {
uint64_t inc = conn->rx.unsent_max_offset - conn->rx.max_offset;
- return conn->rx.window < 2 * inc;
+ return conn->rx.window < 4 * inc;
}
/*
@@ -3423,10 +3431,9 @@ static ngtcp2_ssize conn_write_pkt(ngtcp2_conn *conn, ngtcp2_pkt_info *pi,
ngtcp2_acktr_commit_ack(&pktns->acktr);
ngtcp2_acktr_add_ack(&pktns->acktr, hd->pkt_num,
ackfr->ack.largest_ack);
- if (type == NGTCP2_PKT_1RTT) {
- conn_handle_unconfirmed_key_update_from_remote(
- conn, ackfr->ack.largest_ack, ts);
- }
+ assert(NGTCP2_PKT_1RTT == type);
+ conn_handle_unconfirmed_key_update_from_remote(
+ conn, ackfr->ack.largest_ack, ts);
pkt_empty = 0;
}
}
@@ -4209,7 +4216,7 @@ static ngtcp2_ssize conn_write_pkt(ngtcp2_conn *conn, ngtcp2_pkt_info *pi,
ngtcp2_rtb_entry_objalloc_new(&ent, hd, NULL, ts, (size_t)nwrite,
rtb_entry_flags, &conn->rtb_entry_objalloc);
if (rv != 0) {
- assert(ngtcp2_err_is_fatal((int)nwrite));
+ assert(ngtcp2_err_is_fatal(rv));
return rv;
}
@@ -5315,15 +5322,14 @@ int ngtcp2_conn_detect_lost_pkt(ngtcp2_conn *conn, ngtcp2_pktns *pktns,
* conn_recv_ack processes received ACK frame |fr|. |pkt_ts| is the
* timestamp when packet is received. |ts| should be the current
* time. Usually they are the same, but for buffered packets,
- * |pkt_ts| would be earlier than |ts|.
+ * |pkt_ts| would be earlier than |ts|. This function needs to be
+ * called after |fr| is validated by ngtcp2_pkt_validate_ack.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* NGTCP2_ERR_NOMEM
* Out of memory
- * NGTCP2_ERR_ACK_FRAME
- * ACK frame is malformed.
* NGTCP2_ERR_PROTO
* |fr| acknowledges a packet this endpoint has not sent.
* NGTCP2_ERR_CALLBACK_FAILURE
@@ -5331,7 +5337,6 @@ int ngtcp2_conn_detect_lost_pkt(ngtcp2_conn *conn, ngtcp2_pktns *pktns,
*/
static int conn_recv_ack(ngtcp2_conn *conn, ngtcp2_pktns *pktns, ngtcp2_ack *fr,
ngtcp2_tstamp pkt_ts, ngtcp2_tstamp ts) {
- int rv;
ngtcp2_ssize num_acked;
ngtcp2_conn_stat *cstat = &conn->cstat;
@@ -5339,11 +5344,6 @@ static int conn_recv_ack(ngtcp2_conn *conn, ngtcp2_pktns *pktns, ngtcp2_ack *fr,
return NGTCP2_ERR_PROTO;
}
- rv = ngtcp2_pkt_validate_ack(fr, conn->local.settings.initial_pkt_num);
- if (rv != 0) {
- return rv;
- }
-
ngtcp2_acktr_recv_ack(&pktns->acktr, fr);
num_acked =
@@ -6109,6 +6109,7 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
ngtcp2_strm *crypto;
ngtcp2_encryption_level encryption_level;
int invalid_reserved_bits = 0;
+ size_t num_ack_processed = 0;
if (pktlen == 0) {
return 0;
@@ -6553,6 +6554,13 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
case NGTCP2_FRAME_ACK_ECN:
fr->ack.ack_delay = 0;
fr->ack.ack_delay_unscaled = 0;
+
+ rv =
+ ngtcp2_pkt_validate_ack(&fr->ack, conn->local.settings.initial_pkt_num);
+ if (rv != 0) {
+ return rv;
+ }
+
break;
}
@@ -6561,6 +6569,9 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
switch (fr->type) {
case NGTCP2_FRAME_ACK:
case NGTCP2_FRAME_ACK_ECN:
+ if (num_ack_processed >= NGTCP2_MAX_ACK_PER_PKT) {
+ break;
+ }
if (!conn->server && hd.type == NGTCP2_PKT_HANDSHAKE) {
conn->flags |= NGTCP2_CONN_FLAG_SERVER_ADDR_VERIFIED;
}
@@ -6568,6 +6579,7 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
if (rv != 0) {
return rv;
}
+ ++num_ack_processed;
break;
case NGTCP2_FRAME_PADDING:
break;
@@ -8676,6 +8688,7 @@ conn_recv_delayed_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_pkt_info *pi,
int rv;
int require_ack = 0;
ngtcp2_pktns *pktns;
+ size_t num_ack_processed = 0;
assert(hd->type == NGTCP2_PKT_HANDSHAKE);
@@ -8702,6 +8715,13 @@ conn_recv_delayed_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_pkt_info *pi,
case NGTCP2_FRAME_ACK_ECN:
fr->ack.ack_delay = 0;
fr->ack.ack_delay_unscaled = 0;
+
+ rv =
+ ngtcp2_pkt_validate_ack(&fr->ack, conn->local.settings.initial_pkt_num);
+ if (rv != 0) {
+ return rv;
+ }
+
break;
}
@@ -8710,6 +8730,9 @@ conn_recv_delayed_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_pkt_info *pi,
switch (fr->type) {
case NGTCP2_FRAME_ACK:
case NGTCP2_FRAME_ACK_ECN:
+ if (num_ack_processed >= NGTCP2_MAX_ACK_PER_PKT) {
+ break;
+ }
if (!conn->server) {
conn->flags |= NGTCP2_CONN_FLAG_SERVER_ADDR_VERIFIED;
}
@@ -8717,6 +8740,7 @@ conn_recv_delayed_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_pkt_info *pi,
if (rv != 0) {
return rv;
}
+ ++num_ack_processed;
break;
case NGTCP2_FRAME_PADDING:
break;
@@ -8878,6 +8902,7 @@ static ngtcp2_ssize conn_recv_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
int recv_ncid = 0;
int new_cid_used = 0;
int path_challenge_recved = 0;
+ size_t num_ack_processed = 0;
if (conn->server && conn->local.transport_params.disable_active_migration &&
!ngtcp2_path_eq(&conn->dcid.current.ps.path, path) &&
@@ -9182,6 +9207,13 @@ static ngtcp2_ssize conn_recv_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
assert(conn->remote.transport_params);
assign_recved_ack_delay_unscaled(
&fr->ack, conn->remote.transport_params->ack_delay_exponent);
+
+ rv =
+ ngtcp2_pkt_validate_ack(&fr->ack, conn->local.settings.initial_pkt_num);
+ if (rv != 0) {
+ return rv;
+ }
+
break;
}
@@ -9228,6 +9260,9 @@ static ngtcp2_ssize conn_recv_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
switch (fr->type) {
case NGTCP2_FRAME_ACK:
case NGTCP2_FRAME_ACK_ECN:
+ if (num_ack_processed >= NGTCP2_MAX_ACK_PER_PKT) {
+ break;
+ }
if (!conn->server) {
conn->flags |= NGTCP2_CONN_FLAG_SERVER_ADDR_VERIFIED;
}
@@ -9236,6 +9271,7 @@ static ngtcp2_ssize conn_recv_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
return rv;
}
non_probing_pkt = 1;
+ ++num_ack_processed;
break;
case NGTCP2_FRAME_STREAM:
rv = conn_recv_stream(conn, &fr->stream);
@@ -11703,7 +11739,11 @@ static ngtcp2_ssize conn_write_vmsg_wrapper(ngtcp2_conn *conn,
if (cstat->bytes_in_flight >= cstat->cwnd) {
conn->rst.is_cwnd_limited = 1;
- } else if (nwrite == 0 && conn_pacing_pkt_tx_allowed(conn, ts)) {
+ } else if (conn->rst.app_limited == 0 &&
+ (cstat->cwnd >= cstat->ssthresh ||
+ cstat->bytes_in_flight * 2 < cstat->cwnd) &&
+ nwrite == 0 && conn_pacing_pkt_tx_allowed(conn, ts) &&
+ (conn->flags & NGTCP2_CONN_FLAG_HANDSHAKE_COMPLETED)) {
conn->rst.app_limited = conn->rst.delivered + cstat->bytes_in_flight;
if (conn->rst.app_limited == 0) {
@@ -12793,6 +12833,8 @@ int ngtcp2_conn_update_rtt(ngtcp2_conn *conn, ngtcp2_duration rtt,
ngtcp2_duration ack_delay, ngtcp2_tstamp ts) {
ngtcp2_conn_stat *cstat = &conn->cstat;
+ assert(rtt > 0);
+
if (cstat->min_rtt == UINT64_MAX) {
cstat->latest_rtt = rtt;
cstat->min_rtt = rtt;
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_conn.h b/contrib/libs/ngtcp2/lib/ngtcp2_conn.h
index 562628d089..55073fcc82 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_conn.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_conn.h
@@ -337,15 +337,15 @@ typedef struct ngtcp2_early_transport_params {
} ngtcp2_early_transport_params;
ngtcp2_static_ringbuf_def(dcid_bound, NGTCP2_MAX_BOUND_DCID_POOL_SIZE,
- sizeof(ngtcp2_dcid));
+ sizeof(ngtcp2_dcid))
ngtcp2_static_ringbuf_def(dcid_unused, NGTCP2_MAX_DCID_POOL_SIZE,
- sizeof(ngtcp2_dcid));
+ sizeof(ngtcp2_dcid))
ngtcp2_static_ringbuf_def(dcid_retired, NGTCP2_MAX_DCID_RETIRED_SIZE,
- sizeof(ngtcp2_dcid));
+ sizeof(ngtcp2_dcid))
ngtcp2_static_ringbuf_def(path_challenge, 4,
- sizeof(ngtcp2_path_challenge_entry));
+ sizeof(ngtcp2_path_challenge_entry))
-ngtcp2_objalloc_decl(strm, ngtcp2_strm, oplent);
+ngtcp2_objalloc_decl(strm, ngtcp2_strm, oplent)
struct ngtcp2_conn {
ngtcp2_objalloc frc_objalloc;
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_frame_chain.c b/contrib/libs/ngtcp2/lib/ngtcp2_frame_chain.c
index cf0f117179..6a8a22c3f0 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_frame_chain.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_frame_chain.c
@@ -27,7 +27,7 @@
#include <string.h>
#include <assert.h>
-ngtcp2_objalloc_def(frame_chain, ngtcp2_frame_chain, oplent);
+ngtcp2_objalloc_def(frame_chain, ngtcp2_frame_chain, oplent)
int ngtcp2_frame_chain_new(ngtcp2_frame_chain **pfrc, const ngtcp2_mem *mem) {
*pfrc = ngtcp2_mem_malloc(mem, sizeof(ngtcp2_frame_chain));
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_frame_chain.h b/contrib/libs/ngtcp2/lib/ngtcp2_frame_chain.h
index c38f1aeac9..e5b6779c0f 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_frame_chain.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_frame_chain.h
@@ -74,7 +74,7 @@ struct ngtcp2_frame_chain {
};
};
-ngtcp2_objalloc_decl(frame_chain, ngtcp2_frame_chain, oplent);
+ngtcp2_objalloc_decl(frame_chain, ngtcp2_frame_chain, oplent)
/*
* ngtcp2_bind_frame_chains binds two frame chains |a| and |b| using
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_gaptr.c b/contrib/libs/ngtcp2/lib/ngtcp2_gaptr.c
index 1475c22865..3bfa398480 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_gaptr.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_gaptr.c
@@ -28,8 +28,8 @@
#include <assert.h>
void ngtcp2_gaptr_init(ngtcp2_gaptr *gaptr, const ngtcp2_mem *mem) {
- ngtcp2_ksl_init(&gaptr->gap, ngtcp2_ksl_range_compar, sizeof(ngtcp2_range),
- mem);
+ ngtcp2_ksl_init(&gaptr->gap, ngtcp2_ksl_range_compar, ngtcp2_ksl_range_search,
+ sizeof(ngtcp2_range), mem);
gaptr->mem = mem;
}
@@ -60,8 +60,8 @@ int ngtcp2_gaptr_push(ngtcp2_gaptr *gaptr, uint64_t offset, uint64_t datalen) {
}
}
- it = ngtcp2_ksl_lower_bound_compar(&gaptr->gap, &q,
- ngtcp2_ksl_range_exclusive_compar);
+ it = ngtcp2_ksl_lower_bound_search(&gaptr->gap, &q,
+ ngtcp2_ksl_range_exclusive_search);
for (; !ngtcp2_ksl_it_end(&it);) {
k = *(ngtcp2_range *)ngtcp2_ksl_it_key(&it);
@@ -118,8 +118,8 @@ ngtcp2_range ngtcp2_gaptr_get_first_gap_after(const ngtcp2_gaptr *gaptr,
return r;
}
- it = ngtcp2_ksl_lower_bound_compar(&gaptr->gap, &q,
- ngtcp2_ksl_range_exclusive_compar);
+ it = ngtcp2_ksl_lower_bound_search(&gaptr->gap, &q,
+ ngtcp2_ksl_range_exclusive_search);
assert(!ngtcp2_ksl_it_end(&it));
@@ -136,8 +136,8 @@ int ngtcp2_gaptr_is_pushed(const ngtcp2_gaptr *gaptr, uint64_t offset,
return 0;
}
- it = ngtcp2_ksl_lower_bound_compar(&gaptr->gap, &q,
- ngtcp2_ksl_range_exclusive_compar);
+ it = ngtcp2_ksl_lower_bound_search(&gaptr->gap, &q,
+ ngtcp2_ksl_range_exclusive_search);
m = ngtcp2_range_intersect(&q, (ngtcp2_range *)ngtcp2_ksl_it_key(&it));
return ngtcp2_range_len(&m) == 0;
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_ksl.c b/contrib/libs/ngtcp2/lib/ngtcp2_ksl.c
index 2280b462cb..5e74f64724 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_ksl.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_ksl.c
@@ -35,7 +35,7 @@
static ngtcp2_ksl_blk null_blk = {{{NULL, NULL, 0, 0, {0}}}};
-ngtcp2_objalloc_def(ksl_blk, ngtcp2_ksl_blk, oplent);
+ngtcp2_objalloc_def(ksl_blk, ngtcp2_ksl_blk, oplent)
static size_t ksl_nodelen(size_t keylen) {
assert(keylen >= sizeof(uint64_t));
@@ -57,7 +57,8 @@ static void ksl_node_set_key(ngtcp2_ksl *ksl, ngtcp2_ksl_node *node,
memcpy(node->key, key, ksl->keylen);
}
-void ngtcp2_ksl_init(ngtcp2_ksl *ksl, ngtcp2_ksl_compar compar, size_t keylen,
+void ngtcp2_ksl_init(ngtcp2_ksl *ksl, ngtcp2_ksl_compar compar,
+ ngtcp2_ksl_search search, size_t keylen,
const ngtcp2_mem *mem) {
size_t nodelen = ksl_nodelen(keylen);
@@ -67,6 +68,7 @@ void ngtcp2_ksl_init(ngtcp2_ksl *ksl, ngtcp2_ksl_compar compar, size_t keylen,
ksl->head = NULL;
ksl->front = ksl->back = NULL;
ksl->compar = compar;
+ ksl->search = search;
ksl->n = 0;
ksl->keylen = keylen;
ksl->nodelen = nodelen;
@@ -269,19 +271,6 @@ static void ksl_insert_node(ngtcp2_ksl *ksl, ngtcp2_ksl_blk *blk, size_t i,
++blk->n;
}
-static size_t ksl_search(const ngtcp2_ksl *ksl, ngtcp2_ksl_blk *blk,
- const ngtcp2_ksl_key *key, ngtcp2_ksl_compar compar) {
- size_t i;
- ngtcp2_ksl_node *node;
-
- for (i = 0, node = (ngtcp2_ksl_node *)(void *)blk->nodes;
- i < blk->n && compar((ngtcp2_ksl_key *)node->key, key);
- ++i, node = (ngtcp2_ksl_node *)(void *)((uint8_t *)node + ksl->nodelen))
- ;
-
- return i;
-}
-
int ngtcp2_ksl_insert(ngtcp2_ksl *ksl, ngtcp2_ksl_it *it,
const ngtcp2_ksl_key *key, void *data) {
ngtcp2_ksl_blk *blk;
@@ -306,7 +295,7 @@ int ngtcp2_ksl_insert(ngtcp2_ksl *ksl, ngtcp2_ksl_it *it,
blk = ksl->head;
for (;;) {
- i = ksl_search(ksl, blk, key, ksl->compar);
+ i = ksl->search(ksl, blk, key);
if (blk->leaf) {
if (i < blk->n &&
@@ -565,7 +554,7 @@ int ngtcp2_ksl_remove(ngtcp2_ksl *ksl, ngtcp2_ksl_it *it,
}
for (;;) {
- i = ksl_search(ksl, blk, key, ksl->compar);
+ i = ksl->search(ksl, blk, key);
if (i == blk->n) {
if (it) {
@@ -636,12 +625,12 @@ int ngtcp2_ksl_remove(ngtcp2_ksl *ksl, ngtcp2_ksl_it *it,
ngtcp2_ksl_it ngtcp2_ksl_lower_bound(const ngtcp2_ksl *ksl,
const ngtcp2_ksl_key *key) {
- return ngtcp2_ksl_lower_bound_compar(ksl, key, ksl->compar);
+ return ngtcp2_ksl_lower_bound_search(ksl, key, ksl->search);
}
-ngtcp2_ksl_it ngtcp2_ksl_lower_bound_compar(const ngtcp2_ksl *ksl,
+ngtcp2_ksl_it ngtcp2_ksl_lower_bound_search(const ngtcp2_ksl *ksl,
const ngtcp2_ksl_key *key,
- ngtcp2_ksl_compar compar) {
+ ngtcp2_ksl_search search) {
ngtcp2_ksl_blk *blk = ksl->head;
ngtcp2_ksl_it it;
size_t i;
@@ -652,7 +641,7 @@ ngtcp2_ksl_it ngtcp2_ksl_lower_bound_compar(const ngtcp2_ksl *ksl,
}
for (;;) {
- i = ksl_search(ksl, blk, key, compar);
+ i = search(ksl, blk, key);
if (blk->leaf) {
if (i == blk->n && blk->next) {
@@ -696,7 +685,7 @@ void ngtcp2_ksl_update_key(ngtcp2_ksl *ksl, const ngtcp2_ksl_key *old_key,
assert(ksl->head);
for (;;) {
- i = ksl_search(ksl, blk, old_key, ksl->compar);
+ i = ksl->search(ksl, blk, old_key);
assert(i < blk->n);
node = ngtcp2_ksl_nth_node(ksl, blk, i);
@@ -819,9 +808,49 @@ int ngtcp2_ksl_range_compar(const ngtcp2_ksl_key *lhs,
return a->begin < b->begin;
}
+ngtcp2_ksl_search_def(range, ngtcp2_ksl_range_compar)
+
+size_t ngtcp2_ksl_range_search(const ngtcp2_ksl *ksl, ngtcp2_ksl_blk *blk,
+ const ngtcp2_ksl_key *key) {
+ return ksl_range_search(ksl, blk, key);
+}
+
int ngtcp2_ksl_range_exclusive_compar(const ngtcp2_ksl_key *lhs,
const ngtcp2_ksl_key *rhs) {
const ngtcp2_range *a = lhs, *b = rhs;
return a->begin < b->begin && !(ngtcp2_max_uint64(a->begin, b->begin) <
ngtcp2_min_uint64(a->end, b->end));
}
+
+ngtcp2_ksl_search_def(range_exclusive, ngtcp2_ksl_range_exclusive_compar)
+
+size_t ngtcp2_ksl_range_exclusive_search(const ngtcp2_ksl *ksl,
+ ngtcp2_ksl_blk *blk,
+ const ngtcp2_ksl_key *key) {
+ return ksl_range_exclusive_search(ksl, blk, key);
+}
+
+int ngtcp2_ksl_uint64_less(const ngtcp2_ksl_key *lhs,
+ const ngtcp2_ksl_key *rhs) {
+ return *(uint64_t *)lhs < *(uint64_t *)rhs;
+}
+
+ngtcp2_ksl_search_def(uint64_less, ngtcp2_ksl_uint64_less)
+
+size_t ngtcp2_ksl_uint64_less_search(const ngtcp2_ksl *ksl, ngtcp2_ksl_blk *blk,
+ const ngtcp2_ksl_key *key) {
+ return ksl_uint64_less_search(ksl, blk, key);
+}
+
+int ngtcp2_ksl_int64_greater(const ngtcp2_ksl_key *lhs,
+ const ngtcp2_ksl_key *rhs) {
+ return *(int64_t *)lhs > *(int64_t *)rhs;
+}
+
+ngtcp2_ksl_search_def(int64_greater, ngtcp2_ksl_int64_greater)
+
+size_t ngtcp2_ksl_int64_greater_search(const ngtcp2_ksl *ksl,
+ ngtcp2_ksl_blk *blk,
+ const ngtcp2_ksl_key *key) {
+ return ksl_int64_greater_search(ksl, blk, key);
+}
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_ksl.h b/contrib/libs/ngtcp2/lib/ngtcp2_ksl.h
index d8374b9b5b..de78bcb807 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_ksl.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_ksl.h
@@ -103,7 +103,7 @@ struct ngtcp2_ksl_blk {
};
};
-ngtcp2_objalloc_decl(ksl_blk, ngtcp2_ksl_blk, oplent);
+ngtcp2_objalloc_decl(ksl_blk, ngtcp2_ksl_blk, oplent)
/*
* ngtcp2_ksl_compar is a function type which returns nonzero if key
@@ -114,6 +114,33 @@ typedef int (*ngtcp2_ksl_compar)(const ngtcp2_ksl_key *lhs,
typedef struct ngtcp2_ksl ngtcp2_ksl;
+/*
+ * ngtcp2_ksl_search is a function to search for the first element in
+ * |blk|->nodes which is not ordered before |key|. It returns the
+ * index of such element. It returns |blk|->n if there is no such
+ * element.
+ */
+typedef size_t (*ngtcp2_ksl_search)(const ngtcp2_ksl *ksl, ngtcp2_ksl_blk *blk,
+ const ngtcp2_ksl_key *key);
+
+/*
+ * ngtcp2_ksl_search_def is a macro to implement ngtcp2_ksl_search
+ * with COMPAR which is supposed to be ngtcp2_ksl_compar.
+ */
+#define ngtcp2_ksl_search_def(NAME, COMPAR) \
+ static size_t ksl_##NAME##_search( \
+ const ngtcp2_ksl *ksl, ngtcp2_ksl_blk *blk, const ngtcp2_ksl_key *key) { \
+ size_t i; \
+ ngtcp2_ksl_node *node; \
+ \
+ for (i = 0, node = (ngtcp2_ksl_node *)(void *)blk->nodes; \
+ i < blk->n && COMPAR((ngtcp2_ksl_key *)node->key, key); ++i, \
+ node = (ngtcp2_ksl_node *)(void *)((uint8_t *)node + ksl->nodelen)) \
+ ; \
+ \
+ return i; \
+ }
+
typedef struct ngtcp2_ksl_it ngtcp2_ksl_it;
/*
@@ -137,6 +164,7 @@ struct ngtcp2_ksl {
/* back points to the last leaf block. */
ngtcp2_ksl_blk *back;
ngtcp2_ksl_compar compar;
+ ngtcp2_ksl_search search;
/* n is the number of elements stored. */
size_t n;
/* keylen is the size of key */
@@ -148,10 +176,12 @@ struct ngtcp2_ksl {
/*
* ngtcp2_ksl_init initializes |ksl|. |compar| specifies compare
- * function. |keylen| is the length of key and must be at least
+ * function. |search| is a search function which must use |compar|.
+ * |keylen| is the length of key and must be at least
* sizeof(uint64_t).
*/
-void ngtcp2_ksl_init(ngtcp2_ksl *ksl, ngtcp2_ksl_compar compar, size_t keylen,
+void ngtcp2_ksl_init(ngtcp2_ksl *ksl, ngtcp2_ksl_compar compar,
+ ngtcp2_ksl_search search, size_t keylen,
const ngtcp2_mem *mem);
/*
@@ -217,12 +247,12 @@ ngtcp2_ksl_it ngtcp2_ksl_lower_bound(const ngtcp2_ksl *ksl,
const ngtcp2_ksl_key *key);
/*
- * ngtcp2_ksl_lower_bound_compar works like ngtcp2_ksl_lower_bound,
- * but it takes custom function |compar| to do lower bound search.
+ * ngtcp2_ksl_lower_bound_search works like ngtcp2_ksl_lower_bound,
+ * but it takes custom function |search| to do lower bound search.
*/
-ngtcp2_ksl_it ngtcp2_ksl_lower_bound_compar(const ngtcp2_ksl *ksl,
+ngtcp2_ksl_it ngtcp2_ksl_lower_bound_search(const ngtcp2_ksl *ksl,
const ngtcp2_ksl_key *key,
- ngtcp2_ksl_compar compar);
+ ngtcp2_ksl_search search);
/*
* ngtcp2_ksl_update_key replaces the key of nodes which has |old_key|
@@ -329,21 +359,67 @@ int ngtcp2_ksl_it_begin(const ngtcp2_ksl_it *it);
/*
* ngtcp2_ksl_range_compar is an implementation of ngtcp2_ksl_compar.
- * lhs->ptr and rhs->ptr must point to ngtcp2_range object and the
- * function returns nonzero if (const ngtcp2_range *)(lhs->ptr)->begin
- * < (const ngtcp2_range *)(rhs->ptr)->begin.
+ * |lhs| and |rhs| must point to ngtcp2_range object, and the function
+ * returns nonzero if ((const ngtcp2_range *)lhs)->begin < ((const
+ * ngtcp2_range *)rhs)->begin.
*/
int ngtcp2_ksl_range_compar(const ngtcp2_ksl_key *lhs,
const ngtcp2_ksl_key *rhs);
/*
+ * ngtcp2_ksl_range_search is an implementation of ngtcp2_ksl_search
+ * that uses ngtcp2_ksl_range_compar.
+ */
+size_t ngtcp2_ksl_range_search(const ngtcp2_ksl *ksl, ngtcp2_ksl_blk *blk,
+ const ngtcp2_ksl_key *key);
+
+/*
* ngtcp2_ksl_range_exclusive_compar is an implementation of
- * ngtcp2_ksl_compar. lhs->ptr and rhs->ptr must point to
- * ngtcp2_range object and the function returns nonzero if (const
- * ngtcp2_range *)(lhs->ptr)->begin < (const ngtcp2_range
- * *)(rhs->ptr)->begin and the 2 ranges do not intersect.
+ * ngtcp2_ksl_compar. |lhs| and |rhs| must point to ngtcp2_range
+ * object, and the function returns nonzero if ((const ngtcp2_range
+ * *)lhs)->begin < ((const ngtcp2_range *)rhs)->begin, and the 2
+ * ranges do not intersect.
*/
int ngtcp2_ksl_range_exclusive_compar(const ngtcp2_ksl_key *lhs,
const ngtcp2_ksl_key *rhs);
+/*
+ * ngtcp2_ksl_range_exclusive_search is an implementation of
+ * ngtcp2_ksl_search that uses ngtcp2_ksl_range_exclusive_compar.
+ */
+size_t ngtcp2_ksl_range_exclusive_search(const ngtcp2_ksl *ksl,
+ ngtcp2_ksl_blk *blk,
+ const ngtcp2_ksl_key *key);
+
+/*
+ * ngtcp2_ksl_uint64_less is an implementation of ngtcp2_ksl_compar.
+ * |lhs| and |rhs| must point to uint64_t objects, and the function
+ * returns nonzero if *(uint64_t *)|lhs| < *(uint64_t *)|rhs|.
+ */
+int ngtcp2_ksl_uint64_less(const ngtcp2_ksl_key *lhs,
+ const ngtcp2_ksl_key *rhs);
+
+/*
+ * ngtcp2_ksl_uint64_less_search is an implementation of
+ * ngtcp2_ksl_search that uses ngtcp2_ksl_uint64_less.
+ */
+size_t ngtcp2_ksl_uint64_less_search(const ngtcp2_ksl *ksl, ngtcp2_ksl_blk *blk,
+ const ngtcp2_ksl_key *key);
+
+/*
+ * ngtcp2_ksl_int64_greater is an implementation of ngtcp2_ksl_compar.
+ * |lhs| and |rhs| must point to int64_t objects, and the function
+ * returns nonzero if *(int64_t *)|lhs| > *(int64_t *)|rhs|.
+ */
+int ngtcp2_ksl_int64_greater(const ngtcp2_ksl_key *lhs,
+ const ngtcp2_ksl_key *rhs);
+
+/*
+ * ngtcp2_ksl_int64_greater_search is an implementation of
+ * ngtcp2_ksl_search that uses ngtcp2_ksl_int64_greater.
+ */
+size_t ngtcp2_ksl_int64_greater_search(const ngtcp2_ksl *ksl,
+ ngtcp2_ksl_blk *blk,
+ const ngtcp2_ksl_key *key);
+
#endif /* !defined(NGTCP2_KSL_H) */
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_macro.h b/contrib/libs/ngtcp2/lib/ngtcp2_macro.h
index 649ed8434a..dfe5e0aed2 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_macro.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_macro.h
@@ -55,27 +55,27 @@
#define ngtcp2_max_def(SUFFIX, T) \
static inline T ngtcp2_max_##SUFFIX(T a, T b) { return a < b ? b : a; }
-ngtcp2_max_def(int8, int8_t);
-ngtcp2_max_def(int16, int16_t);
-ngtcp2_max_def(int32, int32_t);
-ngtcp2_max_def(int64, int64_t);
-ngtcp2_max_def(uint8, uint8_t);
-ngtcp2_max_def(uint16, uint16_t);
-ngtcp2_max_def(uint32, uint32_t);
-ngtcp2_max_def(uint64, uint64_t);
-ngtcp2_max_def(size, size_t);
+ngtcp2_max_def(int8, int8_t)
+ngtcp2_max_def(int16, int16_t)
+ngtcp2_max_def(int32, int32_t)
+ngtcp2_max_def(int64, int64_t)
+ngtcp2_max_def(uint8, uint8_t)
+ngtcp2_max_def(uint16, uint16_t)
+ngtcp2_max_def(uint32, uint32_t)
+ngtcp2_max_def(uint64, uint64_t)
+ngtcp2_max_def(size, size_t)
#define ngtcp2_min_def(SUFFIX, T) \
static inline T ngtcp2_min_##SUFFIX(T a, T b) { return a < b ? a : b; }
-ngtcp2_min_def(int8, int8_t);
-ngtcp2_min_def(int16, int16_t);
-ngtcp2_min_def(int32, int32_t);
-ngtcp2_min_def(int64, int64_t);
-ngtcp2_min_def(uint8, uint8_t);
-ngtcp2_min_def(uint16, uint16_t);
-ngtcp2_min_def(uint32, uint32_t);
-ngtcp2_min_def(uint64, uint64_t);
-ngtcp2_min_def(size, size_t);
+ngtcp2_min_def(int8, int8_t)
+ngtcp2_min_def(int16, int16_t)
+ngtcp2_min_def(int32, int32_t)
+ngtcp2_min_def(int64, int64_t)
+ngtcp2_min_def(uint8, uint8_t)
+ngtcp2_min_def(uint16, uint16_t)
+ngtcp2_min_def(uint32, uint32_t)
+ngtcp2_min_def(uint64, uint64_t)
+ngtcp2_min_def(size, size_t)
#endif /* !defined(NGTCP2_MACRO_H) */
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_map.c b/contrib/libs/ngtcp2/lib/ngtcp2_map.c
index 9eb102f16b..0b66fceac6 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_map.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_map.c
@@ -31,7 +31,7 @@
#include "ngtcp2_conv.h"
-#define NGTCP2_INITIAL_TABLE_LENBITS 4
+#define NGTCP2_INITIAL_HASHBITS 4
void ngtcp2_map_init(ngtcp2_map *map, const ngtcp2_mem *mem) {
map->mem = mem;
@@ -196,7 +196,7 @@ int ngtcp2_map_insert(ngtcp2_map *map, ngtcp2_map_key_type key, void *data) {
return rv;
}
} else {
- rv = map_resize(map, NGTCP2_INITIAL_TABLE_LENBITS);
+ rv = map_resize(map, NGTCP2_INITIAL_HASHBITS);
if (rv != 0) {
return rv;
}
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_pv.h b/contrib/libs/ngtcp2/lib/ngtcp2_pv.h
index 7ffa623d17..e9573da497 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_pv.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_pv.h
@@ -83,7 +83,7 @@ void ngtcp2_pv_entry_init(ngtcp2_pv_entry *pvent, const uint8_t *data,
typedef struct ngtcp2_pv ngtcp2_pv;
ngtcp2_static_ringbuf_def(pv_ents, NGTCP2_PV_MAX_ENTRIES,
- sizeof(ngtcp2_pv_entry));
+ sizeof(ngtcp2_pv_entry))
/*
* ngtcp2_pv is the context of a single path validation.
*/
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_ringbuf.c b/contrib/libs/ngtcp2/lib/ngtcp2_ringbuf.c
index 1dab296a80..41446739bf 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_ringbuf.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_ringbuf.c
@@ -31,18 +31,20 @@
#include "ngtcp2_macro.h"
+#ifndef NDEBUG
static int ispow2(size_t n) {
-#if defined(_MSC_VER) && !defined(__clang__) && \
- (defined(_M_ARM) || (defined(_M_ARM64) && _MSC_VER < 1941))
+# if defined(_MSC_VER) && !defined(__clang__) && \
+ (defined(_M_ARM) || (defined(_M_ARM64) && _MSC_VER < 1941))
return n && !(n & (n - 1));
-#elif defined(WIN32)
+# elif defined(WIN32)
return 1 == __popcnt((unsigned int)n);
-#else /* !((defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || \
- (defined(_M_ARM64) && _MSC_VER < 1941))) || defined(WIN32)) */
+# else /* !((defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || \
+ (defined(_M_ARM64) && _MSC_VER < 1941))) || defined(WIN32)) */
return 1 == __builtin_popcount((unsigned int)n);
-#endif /* !((defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || \
- (defined(_M_ARM64) && _MSC_VER < 1941))) || defined(WIN32)) */
+# endif /* !((defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || \
+ (defined(_M_ARM64) && _MSC_VER < 1941))) || defined(WIN32)) */
}
+#endif /* !defined(NDEBUG) */
int ngtcp2_ringbuf_init(ngtcp2_ringbuf *rb, size_t nmemb, size_t size,
const ngtcp2_mem *mem) {
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_rob.c b/contrib/libs/ngtcp2/lib/ngtcp2_rob.c
index 12c7d40976..ce6c2113dd 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_rob.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_rob.c
@@ -68,8 +68,8 @@ int ngtcp2_rob_init(ngtcp2_rob *rob, size_t chunk, const ngtcp2_mem *mem) {
int rv;
ngtcp2_rob_gap *g;
- ngtcp2_ksl_init(&rob->gapksl, ngtcp2_ksl_range_compar, sizeof(ngtcp2_range),
- mem);
+ ngtcp2_ksl_init(&rob->gapksl, ngtcp2_ksl_range_compar,
+ ngtcp2_ksl_range_search, sizeof(ngtcp2_range), mem);
rv = ngtcp2_rob_gap_new(&g, 0, UINT64_MAX, mem);
if (rv != 0) {
@@ -81,8 +81,8 @@ int ngtcp2_rob_init(ngtcp2_rob *rob, size_t chunk, const ngtcp2_mem *mem) {
goto fail_gapksl_ksl_insert;
}
- ngtcp2_ksl_init(&rob->dataksl, ngtcp2_ksl_range_compar, sizeof(ngtcp2_range),
- mem);
+ ngtcp2_ksl_init(&rob->dataksl, ngtcp2_ksl_range_compar,
+ ngtcp2_ksl_range_search, sizeof(ngtcp2_range), mem);
rob->chunk = chunk;
rob->mem = mem;
@@ -125,8 +125,8 @@ static int rob_write_data(ngtcp2_rob *rob, uint64_t offset, const uint8_t *data,
ngtcp2_range range = {offset, offset + len};
ngtcp2_ksl_it it;
- for (it = ngtcp2_ksl_lower_bound_compar(&rob->dataksl, &range,
- ngtcp2_ksl_range_exclusive_compar);
+ for (it = ngtcp2_ksl_lower_bound_search(&rob->dataksl, &range,
+ ngtcp2_ksl_range_exclusive_search);
len; ngtcp2_ksl_it_next(&it)) {
if (ngtcp2_ksl_it_end(&it)) {
d = NULL;
@@ -166,8 +166,8 @@ int ngtcp2_rob_push(ngtcp2_rob *rob, uint64_t offset, const uint8_t *data,
ngtcp2_range m, l, r, q = {offset, offset + datalen};
ngtcp2_ksl_it it;
- it = ngtcp2_ksl_lower_bound_compar(&rob->gapksl, &q,
- ngtcp2_ksl_range_exclusive_compar);
+ it = ngtcp2_ksl_lower_bound_search(&rob->gapksl, &q,
+ ngtcp2_ksl_range_exclusive_search);
for (; !ngtcp2_ksl_it_end(&it);) {
g = ngtcp2_ksl_it_get(&it);
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_rtb.c b/contrib/libs/ngtcp2/lib/ngtcp2_rtb.c
index 008ba470c2..090355f5db 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_rtb.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_rtb.c
@@ -38,7 +38,7 @@
#include "ngtcp2_tstamp.h"
#include "ngtcp2_frame_chain.h"
-ngtcp2_objalloc_def(rtb_entry, ngtcp2_rtb_entry, oplent);
+ngtcp2_objalloc_def(rtb_entry, ngtcp2_rtb_entry, oplent)
static void rtb_entry_init(ngtcp2_rtb_entry *ent, const ngtcp2_pkt_hd *hd,
ngtcp2_frame_chain *frc, ngtcp2_tstamp ts,
@@ -81,17 +81,14 @@ void ngtcp2_rtb_entry_objalloc_del(ngtcp2_rtb_entry *ent,
ngtcp2_objalloc_rtb_entry_release(objalloc, ent);
}
-static int greater(const ngtcp2_ksl_key *lhs, const ngtcp2_ksl_key *rhs) {
- return *(int64_t *)lhs > *(int64_t *)rhs;
-}
-
void ngtcp2_rtb_init(ngtcp2_rtb *rtb, ngtcp2_rst *rst, ngtcp2_cc *cc,
int64_t cc_pkt_num, ngtcp2_log *log, ngtcp2_qlog *qlog,
ngtcp2_objalloc *rtb_entry_objalloc,
ngtcp2_objalloc *frc_objalloc, const ngtcp2_mem *mem) {
rtb->rtb_entry_objalloc = rtb_entry_objalloc;
rtb->frc_objalloc = frc_objalloc;
- ngtcp2_ksl_init(&rtb->ents, greater, sizeof(int64_t), mem);
+ ngtcp2_ksl_init(&rtb->ents, ngtcp2_ksl_int64_greater,
+ ngtcp2_ksl_int64_greater_search, sizeof(int64_t), mem);
rtb->rst = rst;
rtb->cc = cc;
rtb->log = log;
@@ -252,9 +249,12 @@ static ngtcp2_ssize rtb_reclaim_frame(ngtcp2_rtb *rtb, uint8_t flags,
if (!fr->stream.fin) {
/* 0 length STREAM frame with offset == 0 must be
retransmitted if no non-empty data are sent to this
- stream, and no data in this stream are acknowledged. */
+ stream, fin flag is not set, and no data in this stream
+ are acknowledged. */
if (fr->stream.offset != 0 || fr->stream.datacnt != 0 ||
- strm->tx.offset || (strm->flags & NGTCP2_STRM_FLAG_ANY_ACKED)) {
+ strm->tx.offset ||
+ (strm->flags &
+ (NGTCP2_STRM_FLAG_SHUT_WR | NGTCP2_STRM_FLAG_ANY_ACKED))) {
continue;
}
} else if (strm->flags & NGTCP2_STRM_FLAG_FIN_ACKED) {
@@ -870,7 +870,8 @@ ngtcp2_ssize ngtcp2_rtb_recv_ack(ngtcp2_rtb *rtb, const ngtcp2_ack *fr,
}
if (largest_pkt_sent_ts != UINT64_MAX && ack_eliciting_pkt_acked) {
- cc_ack.rtt = pkt_ts - largest_pkt_sent_ts;
+ cc_ack.rtt =
+ ngtcp2_max_uint64(pkt_ts - largest_pkt_sent_ts, NGTCP2_NANOSECONDS);
rv = ngtcp2_conn_update_rtt(conn, cc_ack.rtt, fr->ack_delay_unscaled, ts);
if (rv == 0 && cc->new_rtt_sample) {
@@ -1286,14 +1287,6 @@ static int rtb_on_pkt_lost_resched_move(ngtcp2_rtb *rtb, ngtcp2_conn *conn,
return 0;
}
- if (ent->flags & NGTCP2_RTB_ENTRY_FLAG_PMTUD_PROBE) {
- ngtcp2_log_info(rtb->log, NGTCP2_LOG_EVENT_LDC,
- "pkn=%" PRId64
- " is a PMTUD probe packet, no retransmission is necessary",
- ent->hd.pkt_num);
- return 0;
- }
-
if (ent->flags & NGTCP2_RTB_ENTRY_FLAG_LOST_RETRANSMITTED) {
--rtb->num_lost_pkts;
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_rtb.h b/contrib/libs/ngtcp2/lib/ngtcp2_rtb.h
index 768f4abc42..2ef772b2e1 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_rtb.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_rtb.h
@@ -124,7 +124,7 @@ struct ngtcp2_rtb_entry {
};
};
-ngtcp2_objalloc_decl(rtb_entry, ngtcp2_rtb_entry, oplent);
+ngtcp2_objalloc_decl(rtb_entry, ngtcp2_rtb_entry, oplent)
/*
* ngtcp2_rtb_entry_objalloc_new allocates ngtcp2_rtb_entry object via
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_strm.c b/contrib/libs/ngtcp2/lib/ngtcp2_strm.c
index a30b052483..8ea969c4ad 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_strm.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_strm.c
@@ -32,10 +32,6 @@
#include "ngtcp2_vec.h"
#include "ngtcp2_frame_chain.h"
-static int offset_less(const ngtcp2_ksl_key *lhs, const ngtcp2_ksl_key *rhs) {
- return *(int64_t *)lhs < *(int64_t *)rhs;
-}
-
void ngtcp2_strm_init(ngtcp2_strm *strm, int64_t stream_id, uint32_t flags,
uint64_t max_rx_offset, uint64_t max_tx_offset,
void *stream_user_data, ngtcp2_objalloc *frc_objalloc,
@@ -180,7 +176,8 @@ static int strm_streamfrq_init(ngtcp2_strm *strm) {
return NGTCP2_ERR_NOMEM;
}
- ngtcp2_ksl_init(streamfrq, offset_less, sizeof(uint64_t), strm->mem);
+ ngtcp2_ksl_init(streamfrq, ngtcp2_ksl_uint64_less,
+ ngtcp2_ksl_uint64_less_search, sizeof(uint64_t), strm->mem);
strm->tx.streamfrq = streamfrq;
diff --git a/contrib/libs/ngtcp2/ya.make b/contrib/libs/ngtcp2/ya.make
index 19c9cf0579..8e51e5aa3e 100644
--- a/contrib/libs/ngtcp2/ya.make
+++ b/contrib/libs/ngtcp2/ya.make
@@ -2,9 +2,9 @@
LIBRARY()
-VERSION(1.8.1)
+VERSION(1.10.0)
-ORIGINAL_SOURCE(https://github.com/ngtcp2/ngtcp2/releases/download/v1.8.1/ngtcp2-1.8.1.tar.xz)
+ORIGINAL_SOURCE(https://github.com/ngtcp2/ngtcp2/releases/download/v1.10.0/ngtcp2-1.10.0.tar.xz)
LICENSE(
BSD-3-Clause AND