quic_ackm_test.c 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116
  1. /*
  2. * Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #include "testutil.h"
  10. #include <openssl/ssl.h>
  11. #include "internal/quic_ackm.h"
  12. #include "internal/quic_cc.h"
  13. static OSSL_TIME fake_time = {0};
  14. #define TIME_BASE (ossl_ticks2time(123 * OSSL_TIME_SECOND))
  15. static OSSL_TIME fake_now(void *arg)
  16. {
  17. return fake_time;
  18. }
  19. struct pkt_info {
  20. OSSL_ACKM_TX_PKT *pkt;
  21. int lost, acked, discarded;
  22. };
  23. static void on_lost(void *arg)
  24. {
  25. struct pkt_info *info = arg;
  26. ++info->lost;
  27. }
  28. static void on_acked(void *arg)
  29. {
  30. struct pkt_info *info = arg;
  31. ++info->acked;
  32. }
  33. static void on_discarded(void *arg)
  34. {
  35. struct pkt_info *info = arg;
  36. ++info->discarded;
  37. }
  38. struct helper {
  39. OSSL_ACKM *ackm;
  40. struct pkt_info *pkts;
  41. size_t num_pkts;
  42. OSSL_CC_DATA *ccdata;
  43. OSSL_STATM statm;
  44. int have_statm;
  45. };
  46. static void helper_destroy(struct helper *h)
  47. {
  48. size_t i;
  49. if (h->ackm != NULL) {
  50. ossl_ackm_free(h->ackm);
  51. h->ackm = NULL;
  52. }
  53. if (h->ccdata != NULL) {
  54. ossl_cc_dummy_method.free(h->ccdata);
  55. h->ccdata = NULL;
  56. }
  57. if (h->have_statm) {
  58. ossl_statm_destroy(&h->statm);
  59. h->have_statm = 0;
  60. }
  61. if (h->pkts != NULL) {
  62. for (i = 0; i < h->num_pkts; ++i) {
  63. OPENSSL_free(h->pkts[i].pkt);
  64. h->pkts[i].pkt = NULL;
  65. }
  66. OPENSSL_free(h->pkts);
  67. h->pkts = NULL;
  68. }
  69. }
  70. static int helper_init(struct helper *h, size_t num_pkts)
  71. {
  72. int rc = 0;
  73. memset(h, 0, sizeof(*h));
  74. fake_time = TIME_BASE;
  75. /* Initialise statistics tracker. */
  76. if (!TEST_int_eq(ossl_statm_init(&h->statm), 1))
  77. goto err;
  78. h->have_statm = 1;
  79. /* Initialise congestion controller. */
  80. h->ccdata = ossl_cc_dummy_method.new(fake_now, NULL);
  81. if (!TEST_ptr(h->ccdata))
  82. goto err;
  83. /* Initialise ACK manager. */
  84. h->ackm = ossl_ackm_new(fake_now, NULL, &h->statm,
  85. &ossl_cc_dummy_method, h->ccdata);
  86. if (!TEST_ptr(h->ackm))
  87. goto err;
  88. /* Allocate our array of packet information. */
  89. h->num_pkts = num_pkts;
  90. if (num_pkts > 0) {
  91. h->pkts = OPENSSL_zalloc(sizeof(struct pkt_info) * num_pkts);
  92. if (!TEST_ptr(h->pkts))
  93. goto err;
  94. } else {
  95. h->pkts = NULL;
  96. }
  97. rc = 1;
  98. err:
  99. if (rc == 0)
  100. helper_destroy(h);
  101. return rc;
  102. }
  103. static const QUIC_PN linear_20[] = {
  104. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
  105. };
  106. static const QUIC_PN high_linear_20[] = {
  107. 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008,
  108. 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
  109. 1018, 1019
  110. };
  111. /*
  112. * TX ACK (Packet Threshold) Test Cases
  113. * ******************************************************************
  114. */
  115. struct tx_ack_test_case {
  116. const QUIC_PN *pn_table;
  117. size_t pn_table_len;
  118. const OSSL_QUIC_ACK_RANGE *ack_ranges;
  119. size_t num_ack_ranges;
  120. const char *expect_ack; /* 1=ack, 2=lost, 4=discarded */
  121. };
  122. #define DEFINE_TX_ACK_CASE(n, pntable) \
  123. static const struct tx_ack_test_case tx_ack_case_##n = { \
  124. (pntable), OSSL_NELEM(pntable), \
  125. tx_ack_range_##n, OSSL_NELEM(tx_ack_range_##n), \
  126. tx_ack_expect_##n \
  127. }
  128. /* One range, partial coverage of space */
  129. static const OSSL_QUIC_ACK_RANGE tx_ack_range_1[] = {
  130. { 0, 10 },
  131. };
  132. static const char tx_ack_expect_1[] = {
  133. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
  134. };
  135. DEFINE_TX_ACK_CASE(1, linear_20);
  136. /* Two ranges, partial coverage of space, overlapping by 1 */
  137. static const OSSL_QUIC_ACK_RANGE tx_ack_range_2[] = {
  138. { 5, 10 }, { 0, 5 }
  139. };
  140. static const char tx_ack_expect_2[] = {
  141. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
  142. };
  143. DEFINE_TX_ACK_CASE(2, linear_20);
  144. /* Two ranges, partial coverage of space, together contiguous */
  145. static const OSSL_QUIC_ACK_RANGE tx_ack_range_3[] = {
  146. { 6, 10 }, { 0, 5 }
  147. };
  148. static const char tx_ack_expect_3[] = {
  149. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
  150. };
  151. DEFINE_TX_ACK_CASE(3, linear_20);
  152. /*
  153. * Two ranges, partial coverage of space, non-contiguous by 1
  154. * Causes inferred loss due to packet threshold being exceeded.
  155. */
  156. static const OSSL_QUIC_ACK_RANGE tx_ack_range_4[] = {
  157. { 7, 10 }, { 0, 5 }
  158. };
  159. static const char tx_ack_expect_4[] = {
  160. 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
  161. };
  162. DEFINE_TX_ACK_CASE(4, linear_20);
  163. /*
  164. * Two ranges, partial coverage of space, non-contiguous by 2
  165. * Causes inferred loss due to packet threshold being exceeded.
  166. */
  167. static const OSSL_QUIC_ACK_RANGE tx_ack_range_5[] = {
  168. { 7, 10 }, { 0, 4 }
  169. };
  170. static const char tx_ack_expect_5[] = {
  171. 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
  172. };
  173. DEFINE_TX_ACK_CASE(5, linear_20);
  174. /* One range, covering entire space */
  175. static const OSSL_QUIC_ACK_RANGE tx_ack_range_6[] = {
  176. { 0, 20 },
  177. };
  178. static const char tx_ack_expect_6[] = {
  179. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
  180. };
  181. DEFINE_TX_ACK_CASE(6, linear_20);
  182. /* One range, covering more space than exists */
  183. static const OSSL_QUIC_ACK_RANGE tx_ack_range_7[] = {
  184. { 0, 30 },
  185. };
  186. static const char tx_ack_expect_7[] = {
  187. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
  188. };
  189. DEFINE_TX_ACK_CASE(7, linear_20);
  190. /* One range, covering nothing (too high) */
  191. static const OSSL_QUIC_ACK_RANGE tx_ack_range_8[] = {
  192. { 21, 30 },
  193. };
  194. static const char tx_ack_expect_8[] = {
  195. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  196. };
  197. DEFINE_TX_ACK_CASE(8, linear_20);
  198. /* One range, covering nothing (too low) */
  199. static const OSSL_QUIC_ACK_RANGE tx_ack_range_9[] = {
  200. { 0, 999 },
  201. };
  202. static const char tx_ack_expect_9[] = {
  203. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  204. };
  205. DEFINE_TX_ACK_CASE(9, high_linear_20);
  206. /* One single packet at start of PN set */
  207. static const OSSL_QUIC_ACK_RANGE tx_ack_range_10[] = {
  208. { 0, 0 },
  209. };
  210. static const char tx_ack_expect_10[] = {
  211. 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  212. };
  213. DEFINE_TX_ACK_CASE(10, linear_20);
  214. /*
  215. * One single packet in middle of PN set
  216. * Causes inferred loss of one packet due to packet threshold being exceeded,
  217. * but several other previous packets survive as they are under the threshold.
  218. */
  219. static const OSSL_QUIC_ACK_RANGE tx_ack_range_11[] = {
  220. { 3, 3 },
  221. };
  222. static const char tx_ack_expect_11[] = {
  223. 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  224. };
  225. DEFINE_TX_ACK_CASE(11, linear_20);
  226. /*
  227. * One single packet at end of PN set
  228. * Causes inferred loss due to packet threshold being exceeded.
  229. */
  230. static const OSSL_QUIC_ACK_RANGE tx_ack_range_12[] = {
  231. { 19, 19 },
  232. };
  233. static const char tx_ack_expect_12[] = {
  234. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 1
  235. };
  236. DEFINE_TX_ACK_CASE(12, linear_20);
  237. /*
  238. * Mixed straddling
  239. * Causes inferred loss due to packet threshold being exceeded.
  240. */
  241. static const OSSL_QUIC_ACK_RANGE tx_ack_range_13[] = {
  242. { 1008, 1008 }, { 1004, 1005 }, { 1001, 1002 }
  243. };
  244. static const char tx_ack_expect_13[] = {
  245. 2, 1, 1, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  246. };
  247. DEFINE_TX_ACK_CASE(13, high_linear_20);
  248. static const struct tx_ack_test_case *const tx_ack_cases[] = {
  249. &tx_ack_case_1,
  250. &tx_ack_case_2,
  251. &tx_ack_case_3,
  252. &tx_ack_case_4,
  253. &tx_ack_case_5,
  254. &tx_ack_case_6,
  255. &tx_ack_case_7,
  256. &tx_ack_case_8,
  257. &tx_ack_case_9,
  258. &tx_ack_case_10,
  259. &tx_ack_case_11,
  260. &tx_ack_case_12,
  261. &tx_ack_case_13,
  262. };
  263. enum {
  264. MODE_ACK, MODE_DISCARD, MODE_PTO, MODE_NUM
  265. };
  266. static int test_probe_counts(const OSSL_ACKM_PROBE_INFO *p,
  267. uint32_t anti_deadlock_handshake,
  268. uint32_t anti_deadlock_initial,
  269. uint32_t pto_initial,
  270. uint32_t pto_handshake,
  271. uint32_t pto_app)
  272. {
  273. if (!TEST_uint_eq(p->anti_deadlock_handshake, anti_deadlock_handshake))
  274. return 0;
  275. if (!TEST_uint_eq(p->anti_deadlock_initial, anti_deadlock_initial))
  276. return 0;
  277. if (!TEST_uint_eq(p->pto[QUIC_PN_SPACE_INITIAL], pto_initial))
  278. return 0;
  279. if (!TEST_uint_eq(p->pto[QUIC_PN_SPACE_HANDSHAKE], pto_handshake))
  280. return 0;
  281. if (!TEST_uint_eq(p->pto[QUIC_PN_SPACE_APP], pto_app))
  282. return 0;
  283. return 1;
  284. }
  285. static void on_loss_detection_deadline_callback(OSSL_TIME deadline, void *arg)
  286. {
  287. *(OSSL_TIME *)arg = deadline;
  288. }
  289. static int test_tx_ack_case_actual(int tidx, int space, int mode)
  290. {
  291. int testresult = 0;
  292. struct helper h;
  293. size_t i;
  294. OSSL_ACKM_TX_PKT *tx;
  295. const struct tx_ack_test_case *c = tx_ack_cases[tidx];
  296. OSSL_QUIC_FRAME_ACK ack = {0};
  297. OSSL_TIME loss_detection_deadline = ossl_time_zero();
  298. /* Cannot discard app space, so skip this */
  299. if (mode == MODE_DISCARD && space == QUIC_PN_SPACE_APP) {
  300. TEST_skip("skipping test for app space");
  301. return 1;
  302. }
  303. if (!TEST_int_eq(helper_init(&h, c->pn_table_len), 1))
  304. goto err;
  305. /* Arm callback. */
  306. ossl_ackm_set_loss_detection_deadline_callback(h.ackm,
  307. on_loss_detection_deadline_callback,
  308. &loss_detection_deadline);
  309. /* Allocate TX packet structures. */
  310. for (i = 0; i < c->pn_table_len; ++i) {
  311. h.pkts[i].pkt = tx = OPENSSL_zalloc(sizeof(*tx));
  312. if (!TEST_ptr(tx))
  313. goto err;
  314. tx->pkt_num = c->pn_table[i];
  315. tx->pkt_space = space;
  316. tx->is_inflight = 1;
  317. tx->is_ack_eliciting = 1;
  318. tx->num_bytes = 123;
  319. tx->largest_acked = QUIC_PN_INVALID;
  320. tx->on_lost = on_lost;
  321. tx->on_acked = on_acked;
  322. tx->on_discarded = on_discarded;
  323. tx->cb_arg = &h.pkts[i];
  324. tx->time = fake_time;
  325. if (!TEST_int_eq(ossl_ackm_on_tx_packet(h.ackm, tx), 1))
  326. goto err;
  327. }
  328. if (mode == MODE_DISCARD) {
  329. /* Try discarding. */
  330. if (!TEST_int_eq(ossl_ackm_on_pkt_space_discarded(h.ackm, space), 1))
  331. goto err;
  332. /* Check all discard callbacks were called. */
  333. for (i = 0; i < c->pn_table_len; ++i) {
  334. if (!TEST_int_eq(h.pkts[i].acked, 0))
  335. goto err;
  336. if (!TEST_int_eq(h.pkts[i].lost, 0))
  337. goto err;
  338. if (!TEST_int_eq(h.pkts[i].discarded, 1))
  339. goto err;
  340. }
  341. } else if (mode == MODE_ACK) {
  342. /* Try acknowledging. */
  343. ack.ack_ranges = (OSSL_QUIC_ACK_RANGE *)c->ack_ranges;
  344. ack.num_ack_ranges = c->num_ack_ranges;
  345. if (!TEST_int_eq(ossl_ackm_on_rx_ack_frame(h.ackm, &ack, space, fake_time), 1))
  346. goto err;
  347. /* Check correct ranges were acknowledged. */
  348. for (i = 0; i < c->pn_table_len; ++i) {
  349. if (!TEST_int_eq(h.pkts[i].acked,
  350. (c->expect_ack[i] & 1) != 0 ? 1 : 0))
  351. goto err;
  352. if (!TEST_int_eq(h.pkts[i].lost,
  353. (c->expect_ack[i] & 2) != 0 ? 1 : 0))
  354. goto err;
  355. if (!TEST_int_eq(h.pkts[i].discarded,
  356. (c->expect_ack[i] & 4) != 0 ? 1 : 0))
  357. goto err;
  358. }
  359. } else if (mode == MODE_PTO) {
  360. OSSL_TIME deadline = ossl_ackm_get_loss_detection_deadline(h.ackm);
  361. OSSL_ACKM_PROBE_INFO probe;
  362. if (!TEST_int_eq(ossl_time_compare(deadline, loss_detection_deadline), 0))
  363. goto err;
  364. /* We should have a PTO deadline. */
  365. if (!TEST_int_gt(ossl_time_compare(deadline, fake_time), 0))
  366. goto err;
  367. /* Should not have any probe requests yet. */
  368. probe = *ossl_ackm_get0_probe_request(h.ackm);
  369. if (!TEST_int_eq(test_probe_counts(&probe, 0, 0, 0, 0, 0), 1))
  370. goto err;
  371. /*
  372. * If in app space, confirm handshake, as this is necessary to enable
  373. * app space PTO probe requests.
  374. */
  375. if (space == QUIC_PN_SPACE_APP)
  376. if (!TEST_int_eq(ossl_ackm_on_handshake_confirmed(h.ackm), 1))
  377. goto err;
  378. /* Advance to the PTO deadline. */
  379. fake_time = ossl_time_add(deadline, ossl_ticks2time(1));
  380. if (!TEST_int_eq(ossl_ackm_on_timeout(h.ackm), 1))
  381. goto err;
  382. /* Should have a probe request. Not cleared by first call. */
  383. for (i = 0; i < 3; ++i) {
  384. probe = *ossl_ackm_get0_probe_request(h.ackm);
  385. if (i > 0)
  386. memset(ossl_ackm_get0_probe_request(h.ackm), 0, sizeof(probe));
  387. if (i == 2) {
  388. if (!TEST_int_eq(test_probe_counts(&probe, 0, 0, 0, 0, 0), 1))
  389. goto err;
  390. } else {
  391. if (!TEST_int_eq(test_probe_counts(&probe, 0, 0,
  392. space == QUIC_PN_SPACE_INITIAL,
  393. space == QUIC_PN_SPACE_HANDSHAKE,
  394. space == QUIC_PN_SPACE_APP), 1))
  395. goto err;
  396. }
  397. }
  398. } else
  399. goto err;
  400. testresult = 1;
  401. err:
  402. helper_destroy(&h);
  403. return testresult;
  404. }
  405. /*
  406. * TX ACK (Time Threshold) Test
  407. * ******************************************************************
  408. */
  409. enum {
  410. TX_ACK_TIME_OP_END,
  411. TX_ACK_TIME_OP_PKT, /* TX packets */
  412. TX_ACK_TIME_OP_ACK, /* Synthesise incoming ACK of single PN range */
  413. TX_ACK_TIME_OP_EXPECT /* Ack/loss assertion */
  414. };
  415. struct tx_ack_time_op {
  416. int kind;
  417. uint64_t time_advance; /* all ops */
  418. QUIC_PN pn; /* PKT, ACK */
  419. size_t num_pn; /* PKT, ACK */
  420. const char *expect; /* 1=ack, 2=lost, 4=discarded */
  421. };
  422. #define TX_OP_PKT(advance, pn, num_pn) \
  423. { TX_ACK_TIME_OP_PKT, (advance) * OSSL_TIME_MS, (pn), (num_pn), NULL },
  424. #define TX_OP_ACK(advance, pn, num_pn) \
  425. { TX_ACK_TIME_OP_ACK, (advance) * OSSL_TIME_MS, (pn), (num_pn), NULL },
  426. #define TX_OP_EXPECT(expect) \
  427. { TX_ACK_TIME_OP_EXPECT, 0, 0, 0, (expect) },
  428. #define TX_OP_END { TX_ACK_TIME_OP_END }
  429. static const char tx_ack_time_script_1_expect[] = {
  430. 2, 1
  431. };
  432. static const struct tx_ack_time_op tx_ack_time_script_1[] = {
  433. TX_OP_PKT ( 0, 0, 1)
  434. TX_OP_PKT (3600000, 1, 1)
  435. TX_OP_ACK ( 1000, 1, 1)
  436. TX_OP_EXPECT(tx_ack_time_script_1_expect)
  437. TX_OP_END
  438. };
  439. static const struct tx_ack_time_op *const tx_ack_time_scripts[] = {
  440. tx_ack_time_script_1,
  441. };
  442. static int test_tx_ack_time_script(int tidx)
  443. {
  444. int testresult = 0;
  445. struct helper h;
  446. OSSL_ACKM_TX_PKT *tx = NULL;
  447. OSSL_QUIC_FRAME_ACK ack = {0};
  448. OSSL_QUIC_ACK_RANGE ack_range = {0};
  449. size_t i, num_pkts = 0, pkt_idx = 0;
  450. const struct tx_ack_time_op *script = tx_ack_time_scripts[tidx], *s;
  451. /* Calculate number of packets. */
  452. for (s = script; s->kind != TX_ACK_TIME_OP_END; ++s)
  453. if (s->kind == TX_ACK_TIME_OP_PKT)
  454. num_pkts += s->num_pn;
  455. /* Initialise ACK manager and packet structures. */
  456. if (!TEST_int_eq(helper_init(&h, num_pkts), 1))
  457. goto err;
  458. for (i = 0; i < num_pkts; ++i) {
  459. h.pkts[i].pkt = tx = OPENSSL_zalloc(sizeof(*tx));
  460. if (!TEST_ptr(tx))
  461. goto err;
  462. }
  463. /* Run script. */
  464. for (s = script; s->kind != TX_ACK_TIME_OP_END; ++s)
  465. switch (s->kind) {
  466. case TX_ACK_TIME_OP_PKT:
  467. for (i = 0; i < s->num_pn; ++i) {
  468. tx = h.pkts[pkt_idx + i].pkt;
  469. tx->pkt_num = s->pn + i;
  470. tx->pkt_space = QUIC_PN_SPACE_INITIAL;
  471. tx->num_bytes = 123;
  472. tx->largest_acked = QUIC_PN_INVALID;
  473. tx->is_inflight = 1;
  474. tx->is_ack_eliciting = 1;
  475. tx->on_lost = on_lost;
  476. tx->on_acked = on_acked;
  477. tx->on_discarded = on_discarded;
  478. tx->cb_arg = &h.pkts[pkt_idx + i];
  479. fake_time = ossl_time_add(fake_time,
  480. ossl_ticks2time(s->time_advance));
  481. tx->time = fake_time;
  482. if (!TEST_int_eq(ossl_ackm_on_tx_packet(h.ackm, tx), 1))
  483. goto err;
  484. }
  485. pkt_idx += s->num_pn;
  486. break;
  487. case TX_ACK_TIME_OP_ACK:
  488. ack.ack_ranges = &ack_range;
  489. ack.num_ack_ranges = 1;
  490. ack_range.start = s->pn;
  491. ack_range.end = s->pn + s->num_pn;
  492. fake_time = ossl_time_add(fake_time,
  493. ossl_ticks2time(s->time_advance));
  494. if (!TEST_int_eq(ossl_ackm_on_rx_ack_frame(h.ackm, &ack,
  495. QUIC_PN_SPACE_INITIAL,
  496. fake_time), 1))
  497. goto err;
  498. break;
  499. case TX_ACK_TIME_OP_EXPECT:
  500. for (i = 0; i < num_pkts; ++i) {
  501. if (!TEST_int_eq(h.pkts[i].acked,
  502. (s->expect[i] & 1) != 0 ? 1 : 0))
  503. goto err;
  504. if (!TEST_int_eq(h.pkts[i].lost,
  505. (s->expect[i] & 2) != 0 ? 1 : 0))
  506. goto err;
  507. if (!TEST_int_eq(h.pkts[i].discarded,
  508. (s->expect[i] & 4) != 0 ? 1 : 0))
  509. goto err;
  510. }
  511. break;
  512. }
  513. testresult = 1;
  514. err:
  515. helper_destroy(&h);
  516. return testresult;
  517. }
  518. /*
  519. * RX ACK Test
  520. * ******************************************************************
  521. */
  522. enum {
  523. RX_OPK_END,
  524. RX_OPK_PKT, /* RX packet */
  525. RX_OPK_CHECK_UNPROC, /* check PNs unprocessable */
  526. RX_OPK_CHECK_PROC, /* check PNs processable */
  527. RX_OPK_CHECK_STATE, /* check is_desired/deadline */
  528. RX_OPK_CHECK_ACKS, /* check ACK ranges */
  529. RX_OPK_TX, /* TX packet */
  530. RX_OPK_RX_ACK, /* RX ACK frame */
  531. RX_OPK_SKIP_IF_PN_SPACE /* skip for a given PN space */
  532. };
  533. struct rx_test_op {
  534. int kind;
  535. uint64_t time_advance;
  536. QUIC_PN pn; /* PKT, CHECK_(UN)PROC, TX, RX_ACK */
  537. size_t num_pn; /* PKT, CHECK_(UN)PROC, TX, RX_ACK */
  538. char expect_desired; /* CHECK_STATE */
  539. char expect_deadline; /* CHECK_STATE */
  540. const OSSL_QUIC_ACK_RANGE *ack_ranges; /* CHECK_ACKS */
  541. size_t num_ack_ranges; /* CHECK_ACKS */
  542. QUIC_PN largest_acked; /* TX */
  543. };
  544. #define RX_OP_PKT(advance, pn, num_pn) \
  545. { \
  546. RX_OPK_PKT, (advance) * OSSL_TIME_MS, (pn), (num_pn), \
  547. 0, 0, NULL, 0, 0 \
  548. },
  549. #define RX_OP_CHECK_UNPROC(advance, pn, num_pn) \
  550. { \
  551. RX_OPK_CHECK_UNPROC, (advance) * OSSL_TIME_MS, (pn), (num_pn),\
  552. 0, 0, NULL, 0, 0 \
  553. },
  554. #define RX_OP_CHECK_PROC(advance, pn, num_pn) \
  555. { \
  556. RX_OPK_CHECK_PROC, (advance) * OSSL_TIME_MS, (pn), (num_pn), \
  557. 0, 0, NULL, 0, 0 \
  558. },
  559. #define RX_OP_CHECK_STATE(advance, expect_desired, expect_deadline) \
  560. { \
  561. RX_OPK_CHECK_STATE, (advance) * OSSL_TIME_MS, 0, 0, \
  562. (expect_desired), (expect_deadline), NULL, 0, 0 \
  563. },
  564. #define RX_OP_CHECK_ACKS(advance, ack_ranges) \
  565. { \
  566. RX_OPK_CHECK_ACKS, (advance) * OSSL_TIME_MS, 0, 0, \
  567. 0, 0, (ack_ranges), OSSL_NELEM(ack_ranges), 0 \
  568. },
  569. #define RX_OP_CHECK_NO_ACKS(advance) \
  570. { \
  571. RX_OPK_CHECK_ACKS, (advance) * OSSL_TIME_MS, 0, 0, \
  572. 0, 0, NULL, 0, 0 \
  573. },
  574. #define RX_OP_TX(advance, pn, largest_acked) \
  575. { \
  576. RX_OPK_TX, (advance) * OSSL_TIME_MS, (pn), 1, \
  577. 0, 0, NULL, 0, (largest_acked) \
  578. },
  579. #define RX_OP_RX_ACK(advance, pn, num_pn) \
  580. { \
  581. RX_OPK_RX_ACK, (advance) * OSSL_TIME_MS, (pn), (num_pn), \
  582. 0, 0, NULL, 0, 0 \
  583. },
  584. #define RX_OP_SKIP_IF_PN_SPACE(pn_space) \
  585. { \
  586. RX_OPK_SKIP_IF_PN_SPACE, 0, (pn_space), 0, \
  587. 0, 0, NULL, 0, 0 \
  588. },
  589. #define RX_OP_END \
  590. { RX_OPK_END }
  591. /* RX 1. Simple Test with ACK Desired (Packet Threshold, Exactly) */
  592. static const OSSL_QUIC_ACK_RANGE rx_ack_ranges_1a[] = {
  593. { 0, 1 }
  594. };
  595. static const struct rx_test_op rx_script_1[] = {
  596. RX_OP_CHECK_STATE (0, 0, 0) /* no threshold yet */
  597. RX_OP_CHECK_PROC (0, 0, 3)
  598. RX_OP_PKT (0, 0, 2) /* two packets, threshold */
  599. RX_OP_CHECK_UNPROC (0, 0, 2)
  600. RX_OP_CHECK_PROC (0, 2, 1)
  601. RX_OP_CHECK_STATE (0, 1, 0) /* threshold met, immediate */
  602. RX_OP_CHECK_ACKS (0, rx_ack_ranges_1a)
  603. /* At this point we would generate e.g. a packet with an ACK. */
  604. RX_OP_TX (0, 0, 1) /* ACKs both */
  605. RX_OP_CHECK_ACKS (0, rx_ack_ranges_1a) /* not provably ACKed yet */
  606. RX_OP_RX_ACK (0, 0, 1) /* TX'd packet is ACK'd */
  607. RX_OP_CHECK_NO_ACKS (0) /* nothing more to ACK */
  608. RX_OP_CHECK_UNPROC (0, 0, 2) /* still unprocessable */
  609. RX_OP_CHECK_PROC (0, 2, 1) /* still processable */
  610. RX_OP_END
  611. };
  612. /* RX 2. Simple Test with ACK Not Yet Desired (Packet Threshold) (1-RTT) */
  613. static const OSSL_QUIC_ACK_RANGE rx_ack_ranges_2a[] = {
  614. { 0, 0 }
  615. };
  616. static const OSSL_QUIC_ACK_RANGE rx_ack_ranges_2b[] = {
  617. { 0, 2 }
  618. };
  619. static const struct rx_test_op rx_script_2[] = {
  620. /*
  621. * We skip this for INITIAL/HANDSHAKE and use a separate version
  622. * (rx_script_4) for those spaces as those spaces should not delay ACK
  623. * generation, so a different RX_OP_CHECK_STATE test is needed.
  624. */
  625. RX_OP_SKIP_IF_PN_SPACE(QUIC_PN_SPACE_INITIAL)
  626. RX_OP_SKIP_IF_PN_SPACE(QUIC_PN_SPACE_HANDSHAKE)
  627. RX_OP_CHECK_STATE (0, 0, 0) /* no threshold yet */
  628. RX_OP_CHECK_PROC (0, 0, 3)
  629. /* First packet always generates an ACK so get it out of the way. */
  630. RX_OP_PKT (0, 0, 1)
  631. RX_OP_CHECK_UNPROC (0, 0, 1)
  632. RX_OP_CHECK_PROC (0, 1, 1)
  633. RX_OP_CHECK_STATE (0, 1, 0) /* first packet always causes ACK */
  634. RX_OP_CHECK_ACKS (0, rx_ack_ranges_2a) /* clears packet counter */
  635. RX_OP_CHECK_STATE (0, 0, 0) /* desired state should have been cleared */
  636. /* Second packet should not cause ACK-desired state */
  637. RX_OP_PKT (0, 1, 1) /* just one packet, threshold is 2 */
  638. RX_OP_CHECK_UNPROC (0, 0, 2)
  639. RX_OP_CHECK_PROC (0, 2, 1)
  640. RX_OP_CHECK_STATE (0, 0, 1) /* threshold not yet met, so deadline */
  641. /* Don't check ACKs here, as it would reset our threshold counter. */
  642. /* Now receive a second packet, triggering the threshold */
  643. RX_OP_PKT (0, 2, 1) /* second packet meets threshold */
  644. RX_OP_CHECK_UNPROC (0, 0, 3)
  645. RX_OP_CHECK_PROC (0, 3, 1)
  646. RX_OP_CHECK_STATE (0, 1, 0) /* desired immediately */
  647. RX_OP_CHECK_ACKS (0, rx_ack_ranges_2b)
  648. /* At this point we would generate e.g. a packet with an ACK. */
  649. RX_OP_TX (0, 0, 2) /* ACKs all */
  650. RX_OP_CHECK_ACKS (0, rx_ack_ranges_2b) /* not provably ACKed yet */
  651. RX_OP_RX_ACK (0, 0, 1) /* TX'd packet is ACK'd */
  652. RX_OP_CHECK_NO_ACKS (0) /* nothing more to ACK */
  653. RX_OP_CHECK_UNPROC (0, 0, 3) /* still unprocessable */
  654. RX_OP_CHECK_PROC (0, 3, 1) /* still processable */
  655. RX_OP_END
  656. };
  657. /* RX 3. Simple Test with ACK Desired (Packet Threshold, Multiple Watermarks) */
  658. static const OSSL_QUIC_ACK_RANGE rx_ack_ranges_3a[] = {
  659. { 0, 0 }
  660. };
  661. static const OSSL_QUIC_ACK_RANGE rx_ack_ranges_3b[] = {
  662. { 0, 10 }
  663. };
  664. static const OSSL_QUIC_ACK_RANGE rx_ack_ranges_3c[] = {
  665. { 6, 10 }
  666. };
  667. static const struct rx_test_op rx_script_3[] = {
  668. RX_OP_CHECK_STATE (0, 0, 0) /* no threshold yet */
  669. RX_OP_CHECK_PROC (0, 0, 11)
  670. /* First packet always generates an ACK so get it out of the way. */
  671. RX_OP_PKT (0, 0, 1)
  672. RX_OP_CHECK_UNPROC (0, 0, 1)
  673. RX_OP_CHECK_PROC (0, 1, 1)
  674. RX_OP_CHECK_STATE (0, 1, 0) /* first packet always causes ACK */
  675. RX_OP_CHECK_ACKS (0, rx_ack_ranges_3a) /* clears packet counter */
  676. RX_OP_CHECK_STATE (0, 0, 0) /* desired state should have been cleared */
  677. /* Generate ten packets, exceeding the threshold. */
  678. RX_OP_PKT (0, 1, 10) /* ten packets, threshold is 2 */
  679. RX_OP_CHECK_UNPROC (0, 0, 11)
  680. RX_OP_CHECK_PROC (0, 11, 1)
  681. RX_OP_CHECK_STATE (0, 1, 0) /* threshold met, immediate */
  682. RX_OP_CHECK_ACKS (0, rx_ack_ranges_3b)
  683. /*
  684. * Test TX'ing a packet which doesn't ACK anything.
  685. */
  686. RX_OP_TX (0, 0, QUIC_PN_INVALID)
  687. RX_OP_RX_ACK (0, 0, 1)
  688. /*
  689. * At this point we would generate a packet with an ACK immediately.
  690. * TX a packet which when ACKed makes [0,5] provably ACKed.
  691. */
  692. RX_OP_TX (0, 1, 5)
  693. RX_OP_CHECK_ACKS (0, rx_ack_ranges_3b) /* not provably ACKed yet */
  694. RX_OP_RX_ACK (0, 1, 1)
  695. RX_OP_CHECK_ACKS (0, rx_ack_ranges_3c) /* provably ACKed now gone */
  696. RX_OP_CHECK_UNPROC (0, 0, 11) /* still unprocessable */
  697. RX_OP_CHECK_PROC (0, 11, 1) /* still processable */
  698. /*
  699. * Now TX another packet which provably ACKs the rest when ACKed.
  700. */
  701. RX_OP_TX (0, 2, 10)
  702. RX_OP_CHECK_ACKS (0, rx_ack_ranges_3c) /* not provably ACKed yet */
  703. RX_OP_RX_ACK (0, 2, 1)
  704. RX_OP_CHECK_NO_ACKS (0) /* provably ACKed now gone */
  705. RX_OP_CHECK_UNPROC (0, 0, 11) /* still unprocessable */
  706. RX_OP_CHECK_PROC (0, 11, 1) /* still processable */
  707. RX_OP_END
  708. };
  709. /*
  710. * RX 4. Simple Test with ACK Not Yet Desired (Packet Threshold)
  711. * (Initial/Handshake)
  712. */
  713. static const OSSL_QUIC_ACK_RANGE rx_ack_ranges_4a[] = {
  714. { 0, 1 }
  715. };
  716. static const struct rx_test_op rx_script_4[] = {
  717. /* The application PN space is tested in rx_script_2. */
  718. RX_OP_SKIP_IF_PN_SPACE(QUIC_PN_SPACE_APP)
  719. RX_OP_CHECK_STATE (0, 0, 0) /* no threshold yet */
  720. RX_OP_CHECK_PROC (0, 0, 3)
  721. /* First packet always generates an ACK so get it out of the way. */
  722. RX_OP_PKT (0, 0, 1)
  723. RX_OP_CHECK_UNPROC (0, 0, 1)
  724. RX_OP_CHECK_PROC (0, 1, 1)
  725. RX_OP_CHECK_STATE (0, 1, 0) /* first packet always causes ACK */
  726. RX_OP_CHECK_ACKS (0, rx_ack_ranges_2a) /* clears packet counter */
  727. RX_OP_CHECK_STATE (0, 0, 0) /* desired state should have been cleared */
  728. /*
  729. * Second packet should cause ACK-desired state because we are
  730. * INITIAL/HANDSHAKE (RFC 9000 s. 13.2.1)
  731. */
  732. RX_OP_PKT (0, 1, 1) /* just one packet, threshold is 2 */
  733. RX_OP_CHECK_UNPROC (0, 0, 2)
  734. RX_OP_CHECK_PROC (0, 2, 1)
  735. RX_OP_CHECK_STATE (0, 1, 1)
  736. RX_OP_CHECK_ACKS (0, rx_ack_ranges_4a)
  737. RX_OP_CHECK_STATE (0, 0, 0) /* desired state should have been cleared */
  738. /* At this point we would generate e.g. a packet with an ACK. */
  739. RX_OP_TX (0, 0, 1) /* ACKs all */
  740. RX_OP_CHECK_ACKS (0, rx_ack_ranges_4a) /* not provably ACKed yet */
  741. RX_OP_RX_ACK (0, 0, 1) /* TX'd packet is ACK'd */
  742. RX_OP_CHECK_NO_ACKS (0) /* nothing more to ACK */
  743. RX_OP_CHECK_UNPROC (0, 0, 2) /* still unprocessable */
  744. RX_OP_CHECK_PROC (0, 2, 1) /* still processable */
  745. RX_OP_END
  746. };
  747. static const struct rx_test_op *const rx_test_scripts[] = {
  748. rx_script_1,
  749. rx_script_2,
  750. rx_script_3,
  751. rx_script_4
  752. };
  753. static void on_ack_deadline_callback(OSSL_TIME deadline,
  754. int pkt_space, void *arg)
  755. {
  756. ((OSSL_TIME *)arg)[pkt_space] = deadline;
  757. }
  758. static int test_rx_ack_actual(int tidx, int space)
  759. {
  760. int testresult = 0;
  761. struct helper h;
  762. const struct rx_test_op *script = rx_test_scripts[tidx], *s;
  763. size_t i, num_tx = 0, txi = 0;
  764. const OSSL_QUIC_FRAME_ACK *ack;
  765. OSSL_QUIC_FRAME_ACK rx_ack = {0};
  766. OSSL_QUIC_ACK_RANGE rx_ack_range = {0};
  767. struct pkt_info *pkts = NULL;
  768. OSSL_ACKM_TX_PKT *txs = NULL, *tx;
  769. OSSL_TIME ack_deadline[QUIC_PN_SPACE_NUM];
  770. size_t opn = 0;
  771. for (i = 0; i < QUIC_PN_SPACE_NUM; ++i)
  772. ack_deadline[i] = ossl_time_infinite();
  773. /* Initialise ACK manager. */
  774. if (!TEST_int_eq(helper_init(&h, 0), 1))
  775. goto err;
  776. /* Arm callback for testing. */
  777. ossl_ackm_set_ack_deadline_callback(h.ackm, on_ack_deadline_callback,
  778. ack_deadline);
  779. /*
  780. * Determine how many packets we are TXing, and therefore how many packet
  781. * structures we need.
  782. */
  783. for (s = script; s->kind != RX_OPK_END; ++s)
  784. if (s->kind == RX_OPK_TX)
  785. num_tx += s->num_pn;
  786. /* Allocate packet information structures. */
  787. txs = OPENSSL_zalloc(sizeof(*txs) * num_tx);
  788. if (!TEST_ptr(txs))
  789. goto err;
  790. pkts = OPENSSL_zalloc(sizeof(*pkts) * num_tx);
  791. if (!TEST_ptr(pkts))
  792. goto err;
  793. /* Run script. */
  794. for (s = script; s->kind != RX_OPK_END; ++s, ++opn) {
  795. fake_time = ossl_time_add(fake_time,
  796. ossl_ticks2time(s->time_advance));
  797. switch (s->kind) {
  798. case RX_OPK_PKT:
  799. for (i = 0; i < s->num_pn; ++i) {
  800. OSSL_ACKM_RX_PKT pkt = {0};
  801. pkt.pkt_num = s->pn + i;
  802. pkt.time = fake_time;
  803. pkt.pkt_space = space;
  804. pkt.is_ack_eliciting = 1;
  805. /* The packet should be processable before we feed it. */
  806. if (!TEST_int_eq(ossl_ackm_is_rx_pn_processable(h.ackm,
  807. pkt.pkt_num,
  808. pkt.pkt_space), 1))
  809. goto err;
  810. if (!TEST_int_eq(ossl_ackm_on_rx_packet(h.ackm, &pkt), 1))
  811. goto err;
  812. }
  813. break;
  814. case RX_OPK_CHECK_UNPROC:
  815. case RX_OPK_CHECK_PROC:
  816. for (i = 0; i < s->num_pn; ++i)
  817. if (!TEST_int_eq(ossl_ackm_is_rx_pn_processable(h.ackm,
  818. s->pn + i, space),
  819. (s->kind == RX_OPK_CHECK_PROC)))
  820. goto err;
  821. break;
  822. case RX_OPK_CHECK_STATE:
  823. if (!TEST_int_eq(ossl_ackm_is_ack_desired(h.ackm, space),
  824. s->expect_desired))
  825. goto err;
  826. if (!TEST_int_eq(!ossl_time_is_infinite(ossl_ackm_get_ack_deadline(h.ackm, space))
  827. && !ossl_time_is_zero(ossl_ackm_get_ack_deadline(h.ackm, space)),
  828. s->expect_deadline))
  829. goto err;
  830. for (i = 0; i < QUIC_PN_SPACE_NUM; ++i) {
  831. if (i != (size_t)space
  832. && !TEST_true(ossl_time_is_infinite(ossl_ackm_get_ack_deadline(h.ackm, i))))
  833. goto err;
  834. if (!TEST_int_eq(ossl_time_compare(ossl_ackm_get_ack_deadline(h.ackm, i),
  835. ack_deadline[i]), 0))
  836. goto err;
  837. }
  838. break;
  839. case RX_OPK_CHECK_ACKS:
  840. ack = ossl_ackm_get_ack_frame(h.ackm, space);
  841. /* Should always be able to get an ACK frame. */
  842. if (!TEST_ptr(ack))
  843. goto err;
  844. if (!TEST_size_t_eq(ack->num_ack_ranges, s->num_ack_ranges))
  845. goto err;
  846. for (i = 0; i < ack->num_ack_ranges; ++i) {
  847. if (!TEST_uint64_t_eq(ack->ack_ranges[i].start,
  848. s->ack_ranges[i].start))
  849. goto err;
  850. if (!TEST_uint64_t_eq(ack->ack_ranges[i].end,
  851. s->ack_ranges[i].end))
  852. goto err;
  853. }
  854. break;
  855. case RX_OPK_TX:
  856. pkts[txi].pkt = tx = &txs[txi];
  857. tx->pkt_num = s->pn;
  858. tx->pkt_space = space;
  859. tx->num_bytes = 123;
  860. tx->largest_acked = s->largest_acked;
  861. tx->is_inflight = 1;
  862. tx->is_ack_eliciting = 1;
  863. tx->on_lost = on_lost;
  864. tx->on_acked = on_acked;
  865. tx->on_discarded = on_discarded;
  866. tx->cb_arg = &pkts[txi];
  867. tx->time = fake_time;
  868. if (!TEST_int_eq(ossl_ackm_on_tx_packet(h.ackm, tx), 1))
  869. goto err;
  870. ++txi;
  871. break;
  872. case RX_OPK_RX_ACK:
  873. rx_ack.ack_ranges = &rx_ack_range;
  874. rx_ack.num_ack_ranges = 1;
  875. rx_ack_range.start = s->pn;
  876. rx_ack_range.end = s->pn + s->num_pn - 1;
  877. if (!TEST_int_eq(ossl_ackm_on_rx_ack_frame(h.ackm, &rx_ack,
  878. space, fake_time), 1))
  879. goto err;
  880. break;
  881. case RX_OPK_SKIP_IF_PN_SPACE:
  882. if (space == (int)s->pn) {
  883. testresult = 1;
  884. goto err;
  885. }
  886. break;
  887. default:
  888. goto err;
  889. }
  890. }
  891. testresult = 1;
  892. err:
  893. if (!testresult)
  894. TEST_error("error in ACKM RX script %d, op %zu", tidx + 1, opn + 1);
  895. helper_destroy(&h);
  896. OPENSSL_free(pkts);
  897. OPENSSL_free(txs);
  898. return testresult;
  899. }
  900. /*
  901. * Driver
  902. * ******************************************************************
  903. */
  904. static int test_tx_ack_case(int idx)
  905. {
  906. int tidx, space;
  907. tidx = idx % OSSL_NELEM(tx_ack_cases);
  908. idx /= OSSL_NELEM(tx_ack_cases);
  909. space = idx % QUIC_PN_SPACE_NUM;
  910. idx /= QUIC_PN_SPACE_NUM;
  911. return test_tx_ack_case_actual(tidx, space, idx);
  912. }
  913. static int test_rx_ack(int idx)
  914. {
  915. int tidx;
  916. tidx = idx % OSSL_NELEM(rx_test_scripts);
  917. idx /= OSSL_NELEM(rx_test_scripts);
  918. return test_rx_ack_actual(tidx, idx);
  919. }
  920. int setup_tests(void)
  921. {
  922. ADD_ALL_TESTS(test_tx_ack_case,
  923. OSSL_NELEM(tx_ack_cases) * MODE_NUM * QUIC_PN_SPACE_NUM);
  924. ADD_ALL_TESTS(test_tx_ack_time_script, OSSL_NELEM(tx_ack_time_scripts));
  925. ADD_ALL_TESTS(test_rx_ack, OSSL_NELEM(rx_test_scripts) * QUIC_PN_SPACE_NUM);
  926. return 1;
  927. }