diff --git a/src/transport/xqc_frame.c b/src/transport/xqc_frame.c index 33d5619a3..9b218b63d 100644 --- a/src/transport/xqc_frame.c +++ b/src/transport/xqc_frame.c @@ -172,6 +172,105 @@ xqc_insert_stream_frame(xqc_connection_t *conn, xqc_stream_t *stream, xqc_stream } +static xqc_int_t +xqc_validate_frame_type_in_pkt(xqc_connection_t *conn, xqc_packet_in_t *packet_in, uint64_t frame_type) +{ + /* + * RFC 9000 Section 12.4 Table 3: + * frame types that are permitted in each packet type. + */ + xqc_bool_t allowed = XQC_FALSE; + xqc_bool_t pkt_flag_init = XQC_FALSE, pkt_flag_hsk = XQC_FALSE; + xqc_bool_t pkt_flag_0rtt = XQC_FALSE, pkt_flag_1rtt = XQC_FALSE; + if ((packet_in->pi_flag & XQC_PIF_FEC_RECOVERED) != 0) { + return XQC_OK; + } + xqc_pkt_type_t pkt_type = packet_in->pi_pkt.pkt_type; + if (pkt_type >= XQC_PTYPE_NUM) { + return XQC_OK; + } + pkt_flag_init = (pkt_type == XQC_PTYPE_INIT); + pkt_flag_hsk = (pkt_type == XQC_PTYPE_HSK); + pkt_flag_0rtt = (pkt_type == XQC_PTYPE_0RTT); + pkt_flag_1rtt = (pkt_type == XQC_PTYPE_SHORT_HEADER); + + if (!pkt_flag_init && !pkt_flag_hsk && !pkt_flag_0rtt && !pkt_flag_1rtt) { + return XQC_OK; + } + + if (frame_type > 0x1e && frame_type != 0x30 && frame_type != 0x31) { + return XQC_OK; + } + + switch (frame_type) { + case 0x30: + case 0x31: + allowed = (pkt_flag_0rtt || pkt_flag_1rtt); + break; + + /* IH01 */ + case 0x00: /* PADDING */ + case 0x01: /* PING */ + case 0x1c: /* CONNECTION_CLOSE (transport) */ + allowed = XQC_TRUE; + break; + + /* IH_1 */ + case 0x02: /* ACK */ + case 0x03: /* ACK (ECN) */ + case 0x06: /* CRYPTO */ + allowed = (pkt_flag_init || pkt_flag_hsk || pkt_flag_1rtt); + break; + + /* ___1 */ + case 0x07: /* NEW_TOKEN */ + case 0x1b: /* PATH_RESPONSE */ + case 0x1e: /* HANDSHAKE_DONE */ + allowed = pkt_flag_1rtt; + break; + + /* __01 */ + case 0x04: /* RESET_STREAM */ + case 0x05: /* STOP_SENDING */ + case 0x08: /* STREAM */ + case 0x09: + case 0x0a: + case 0x0b: + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + case 0x10: /* MAX_DATA */ + case 0x11: /* MAX_STREAM_DATA */ + case 0x12: /* MAX_STREAMS */ + case 0x13: + case 0x14: /* DATA_BLOCKED */ + case 0x15: /* STREAM_DATA_BLOCKED */ + case 0x16: /* STREAMS_BLOCKED */ + case 0x17: + case 0x18: /* NEW_CONNECTION_ID */ + case 0x19: /* RETIRE_CONNECTION_ID */ + case 0x1a: /* PATH_CHALLENGE */ + case 0x1d: /* CONNECTION_CLOSE (application) */ + allowed = (pkt_flag_0rtt || pkt_flag_1rtt); + break; + + default: + return XQC_OK; + } + + if (!allowed) { + xqc_log(conn->log, XQC_LOG_ERROR, + "|illegal frame in packet type|frame_type:%xL|pkt_type:%s|pkt_num:%ui|", + frame_type, xqc_pkt_type_2_str(pkt_type), packet_in->pi_pkt.pkt_num); + XQC_CONN_ERR(conn, TRA_PROTOCOL_VIOLATION); + return -XQC_EPROTO; + } + + return XQC_OK; +} + + xqc_int_t xqc_process_frames(xqc_connection_t *conn, xqc_packet_in_t *packet_in) { @@ -212,6 +311,11 @@ xqc_process_frames(xqc_connection_t *conn, xqc_packet_in_t *packet_in) xqc_log(conn->log, XQC_LOG_DEBUG, "|frame_type:%xL|", frame_type); + ret = xqc_validate_frame_type_in_pkt(conn, packet_in, frame_type); + if (ret != XQC_OK) { + return ret; + } + switch (frame_type) { case 0x00: @@ -447,8 +551,9 @@ xqc_process_stream_frame(xqc_connection_t *conn, xqc_packet_in_t *packet_in) xqc_stream_t *stream = NULL; xqc_stream_frame_t *stream_frame; - if (packet_in->pi_pkt.pkt_type == XQC_PTYPE_INIT - || packet_in->pi_pkt.pkt_type == XQC_PTYPE_HSK) + if ((packet_in->pi_flag & XQC_PIF_FEC_RECOVERED) == 0 + && (packet_in->pi_pkt.pkt_type == XQC_PTYPE_INIT + || packet_in->pi_pkt.pkt_type == XQC_PTYPE_HSK)) { xqc_log(conn->log, XQC_LOG_ERROR, "|illegal STREAM frame in %s packet, close with PROTOCOL_VIOLATION|", diff --git a/src/transport/xqc_packet_out.c b/src/transport/xqc_packet_out.c index b564cc947..ba9ef354f 100644 --- a/src/transport/xqc_packet_out.c +++ b/src/transport/xqc_packet_out.c @@ -789,13 +789,23 @@ xqc_write_conn_close_to_packet(xqc_connection_t *conn, uint64_t err_code) pkt_type = XQC_PTYPE_SHORT_HEADER; } + xqc_bool_t is_app = err_code >= H3_NO_ERROR; + if (pkt_type == XQC_PTYPE_INIT || pkt_type == XQC_PTYPE_HSK) { + if (err_code >= TRA_CRYPTO_ERROR_BASE && err_code <= TRA_CRYPTO_ERROR_BASE + 0xff) { + is_app = XQC_FALSE; + } else if (is_app) { + is_app = XQC_FALSE; + err_code = TRA_APPLICATION_ERROR; + } + } + packet_out = xqc_write_new_packet(conn, pkt_type); if (packet_out == NULL) { xqc_log(conn->log, XQC_LOG_ERROR, "|xqc_write_new_packet error|"); return -XQC_EWRITE_PKT; } - ret = xqc_gen_conn_close_frame(packet_out, err_code, err_code >= H3_NO_ERROR ? 1:0, 0); + ret = xqc_gen_conn_close_frame(packet_out, err_code, is_app, 0); if (ret < 0) { xqc_log(conn->log, XQC_LOG_ERROR, "|xqc_gen_conn_close_frame error|"); goto error; @@ -935,13 +945,51 @@ xqc_write_stop_sending_to_packet(xqc_connection_t *conn, xqc_stream_t *stream, return -XQC_EWRITE_PKT; } + +static xqc_pkt_type_t +xqc_select_pkt_type_for_app_data_frame(xqc_connection_t *conn, + xqc_pkt_type_t requested_pkt_type, xqc_bool_t *buff_pkt) +{ + *buff_pkt = XQC_FALSE; + + if (requested_pkt_type == XQC_PTYPE_0RTT) { + return XQC_PTYPE_0RTT; + } + + if (conn->conn_flag & XQC_CONN_FLAG_CAN_SEND_1RTT) { + if (requested_pkt_type == XQC_PTYPE_SHORT_HEADER) { + return requested_pkt_type; + } + + return XQC_PTYPE_SHORT_HEADER; + } + + if (requested_pkt_type == XQC_PTYPE_SHORT_HEADER) { + *buff_pkt = XQC_TRUE; + return requested_pkt_type; + } + + if (conn->conn_type == XQC_CONN_TYPE_CLIENT + && conn->conn_state == XQC_CONN_STATE_CLIENT_INITIAL_SENT + && xqc_conn_is_ready_to_send_early_data(conn)) + { + conn->conn_flag |= XQC_CONN_FLAG_HAS_0RTT; + return XQC_PTYPE_0RTT; + } + + *buff_pkt = XQC_TRUE; + return XQC_PTYPE_SHORT_HEADER; +} + int xqc_write_data_blocked_to_packet(xqc_connection_t *conn, uint64_t data_limit) { ssize_t ret; xqc_packet_out_t *packet_out; + xqc_bool_t buff_pkt = XQC_FALSE; + xqc_pkt_type_t pkt_type = xqc_select_pkt_type_for_app_data_frame(conn, XQC_PTYPE_NUM, &buff_pkt); - packet_out = xqc_write_new_packet(conn, XQC_PTYPE_SHORT_HEADER); + packet_out = xqc_write_new_packet(conn, pkt_type); if (packet_out == NULL) { xqc_log(conn->log, XQC_LOG_ERROR, "|xqc_write_new_packet error|"); return -XQC_EWRITE_PKT; @@ -956,7 +1004,11 @@ xqc_write_data_blocked_to_packet(xqc_connection_t *conn, uint64_t data_limit) packet_out->po_used_size += ret; /* we need to send this packet asap */ - xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + if (buff_pkt) { + xqc_conn_buff_1rtt_packet(conn, packet_out); + } else { + xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + } return XQC_OK; @@ -970,7 +1022,10 @@ xqc_write_stream_data_blocked_to_packet(xqc_connection_t *conn, xqc_stream_id_t { ssize_t ret; xqc_packet_out_t *packet_out; - packet_out = xqc_write_new_packet(conn, XQC_PTYPE_SHORT_HEADER); + xqc_bool_t buff_pkt = XQC_FALSE; + xqc_pkt_type_t pkt_type = xqc_select_pkt_type_for_app_data_frame(conn, XQC_PTYPE_NUM, &buff_pkt); + + packet_out = xqc_write_new_packet(conn, pkt_type); if (packet_out == NULL) { xqc_log(conn->log, XQC_LOG_ERROR, "|xqc_write_new_packet error|"); return -XQC_EWRITE_PKT; @@ -985,7 +1040,11 @@ xqc_write_stream_data_blocked_to_packet(xqc_connection_t *conn, xqc_stream_id_t packet_out->po_used_size += ret; /* we need to send this packet asap */ - xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + if (buff_pkt) { + xqc_conn_buff_1rtt_packet(conn, packet_out); + } else { + xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + } return XQC_OK; @@ -999,8 +1058,10 @@ xqc_write_streams_blocked_to_packet(xqc_connection_t *conn, uint64_t stream_limi { ssize_t ret; xqc_packet_out_t *packet_out; + xqc_bool_t buff_pkt = XQC_FALSE; + xqc_pkt_type_t pkt_type = xqc_select_pkt_type_for_app_data_frame(conn, XQC_PTYPE_NUM, &buff_pkt); - packet_out = xqc_write_new_packet(conn, XQC_PTYPE_NUM); + packet_out = xqc_write_new_packet(conn, pkt_type); if (packet_out == NULL) { xqc_log(conn->log, XQC_LOG_ERROR, "|xqc_write_new_packet error|"); return -XQC_EWRITE_PKT; @@ -1014,7 +1075,11 @@ xqc_write_streams_blocked_to_packet(xqc_connection_t *conn, uint64_t stream_limi packet_out->po_used_size += ret; - xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + if (buff_pkt) { + xqc_conn_buff_1rtt_packet(conn, packet_out); + } else { + xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + } return XQC_OK; @@ -1028,8 +1093,10 @@ xqc_write_max_data_to_packet(xqc_connection_t *conn, uint64_t max_data) { ssize_t ret; xqc_packet_out_t *packet_out; + xqc_bool_t buff_pkt = XQC_FALSE; + xqc_pkt_type_t pkt_type = xqc_select_pkt_type_for_app_data_frame(conn, XQC_PTYPE_NUM, &buff_pkt); - packet_out = xqc_write_new_packet(conn, XQC_PTYPE_SHORT_HEADER); + packet_out = xqc_write_new_packet(conn, pkt_type); if (packet_out == NULL) { xqc_log(conn->log, XQC_LOG_ERROR, "|xqc_write_new_packet error|"); return -XQC_EWRITE_PKT; @@ -1043,7 +1110,11 @@ xqc_write_max_data_to_packet(xqc_connection_t *conn, uint64_t max_data) packet_out->po_used_size += ret; - xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + if (buff_pkt) { + xqc_conn_buff_1rtt_packet(conn, packet_out); + } else { + xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + } return XQC_OK; @@ -1057,6 +1128,9 @@ xqc_write_max_stream_data_to_packet(xqc_connection_t *conn, xqc_stream_id_t stre { ssize_t ret = XQC_OK; xqc_packet_out_t *packet_out; + xqc_bool_t buff_pkt = XQC_FALSE; + + pkt_type = xqc_select_pkt_type_for_app_data_frame(conn, pkt_type, &buff_pkt); packet_out = xqc_write_new_packet(conn, pkt_type); if (packet_out == NULL) { @@ -1072,7 +1146,11 @@ xqc_write_max_stream_data_to_packet(xqc_connection_t *conn, xqc_stream_id_t stre packet_out->po_used_size += ret; - xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + if (buff_pkt) { + xqc_conn_buff_1rtt_packet(conn, packet_out); + } else { + xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + } return XQC_OK; @@ -1086,13 +1164,15 @@ xqc_write_max_streams_to_packet(xqc_connection_t *conn, uint64_t max_stream, int { ssize_t ret = XQC_ERROR; xqc_packet_out_t *packet_out; + xqc_bool_t buff_pkt = XQC_FALSE; + xqc_pkt_type_t pkt_type = xqc_select_pkt_type_for_app_data_frame(conn, XQC_PTYPE_NUM, &buff_pkt); if (max_stream > XQC_MAX_STREAMS) { xqc_log(conn->log, XQC_LOG_ERROR, "|xqc_write_max_streams_to_packet error|set max_stream:%ui", max_stream); return -XQC_EPARAM; } - packet_out = xqc_write_new_packet(conn, XQC_PTYPE_NUM); + packet_out = xqc_write_new_packet(conn, pkt_type); if (packet_out == NULL) { xqc_log(conn->log, XQC_LOG_ERROR, "|xqc_write_new_packet error|"); return -XQC_EWRITE_PKT; @@ -1106,7 +1186,11 @@ xqc_write_max_streams_to_packet(xqc_connection_t *conn, uint64_t max_stream, int packet_out->po_used_size += ret; - xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + if (buff_pkt) { + xqc_conn_buff_1rtt_packet(conn, packet_out); + } else { + xqc_send_queue_move_to_high_pri(&packet_out->po_list, conn->conn_send_queue); + } xqc_log(conn->log, XQC_LOG_DEBUG, "|new_max_stream:%ui|", max_stream); return XQC_OK; diff --git a/tests/unittest/main.c b/tests/unittest/main.c index 977b9b8a3..0ed4e17f3 100644 --- a/tests/unittest/main.c +++ b/tests/unittest/main.c @@ -110,6 +110,8 @@ main() || !CU_add_test(pSuite, "xqc_test_engine_packet_process", xqc_test_engine_packet_process) || !CU_add_test(pSuite, "xqc_test_stream_frame", xqc_test_stream_frame) || !CU_add_test(pSuite, "xqc_test_process_frame", xqc_test_process_frame) + || !CU_add_test(pSuite, "xqc_test_handshake_app_conn_close_is_converted", xqc_test_handshake_app_conn_close_is_converted) + || !CU_add_test(pSuite, "xqc_test_1rtt_only_flow_control_frames_are_buffered", xqc_test_1rtt_only_flow_control_frames_are_buffered) || !CU_add_test(pSuite, "xqc_test_parse_padding_frame", xqc_test_parse_padding_frame) || !CU_add_test(pSuite, "xqc_test_large_ack_frame", xqc_test_large_ack_frame) /* issue #632: ACK_ECN frame parsing (RFC 9000 19.3) */ diff --git a/tests/unittest/xqc_cid_test.c b/tests/unittest/xqc_cid_test.c index 8b38542bd..f4060ba6b 100644 --- a/tests/unittest/xqc_cid_test.c +++ b/tests/unittest/xqc_cid_test.c @@ -123,6 +123,7 @@ xqc_test_recv_retire_cid() 0x00, /* Sequence Number */}; xqc_packet_in_t packet_in; memset(&packet_in, 0, sizeof(xqc_packet_in_t)); + packet_in.pi_pkt.pkt_type = XQC_PTYPE_SHORT_HEADER; packet_in.pos = XQC_RETIRE_CID_FRAME; packet_in.last = packet_in.pos + sizeof(XQC_RETIRE_CID_FRAME); @@ -182,6 +183,7 @@ xqc_test_retire_cid_with_odcid_in_set() 0x00, /* Sequence Number */}; xqc_packet_in_t packet_in; memset(&packet_in, 0, sizeof(xqc_packet_in_t)); + packet_in.pi_pkt.pkt_type = XQC_PTYPE_SHORT_HEADER; packet_in.pos = XQC_RETIRE_CID_FRAME; packet_in.last = packet_in.pos + sizeof(XQC_RETIRE_CID_FRAME); diff --git a/tests/unittest/xqc_process_frame_test.c b/tests/unittest/xqc_process_frame_test.c index 51ae57e7e..1f230d879 100644 --- a/tests/unittest/xqc_process_frame_test.c +++ b/tests/unittest/xqc_process_frame_test.c @@ -9,6 +9,8 @@ #include "src/transport/xqc_frame_parser.h" #include "src/transport/xqc_packet.h" #include "src/transport/xqc_packet_in.h" +#include "src/transport/xqc_packet_out.h" +#include "src/transport/xqc_send_queue.h" #include "src/common/utils/vint/xqc_variable_len_int.h" #include "src/transport/xqc_conn.h" #include "xquic/xqc_errno.h" @@ -16,6 +18,8 @@ char XQC_TEST_ILL_FRAME_1[] = {0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; char XQC_TEST_ZERO_LEN_NEW_TOKEN_FRAME[] = {0x07, 0x00}; char XQC_TEST_STREAM_FRAME[] = {0x0a, 0x00, 0x01, 0x00}; +char XQC_TEST_APP_CONN_CLOSE_FRAME[] = {0x1d, 0x00, 0x00}; +char XQC_TEST_DATAGRAM_FRAME[] = {0x30}; static xqc_int_t @@ -41,6 +45,26 @@ xqc_test_parse_stream_frame_inner(unsigned char *frame_buf, } +static void +xqc_test_1rtt_only_frame_buffered(xqc_connection_t *conn) +{ + CU_ASSERT(xqc_list_empty(&conn->conn_send_queue->sndq_send_packets_high_pri)); + CU_ASSERT(!xqc_list_empty(&conn->conn_send_queue->sndq_buff_1rtt_packets)); +} + + +static xqc_packet_out_t * +xqc_test_first_high_pri_packet(xqc_connection_t *conn) +{ + if (xqc_list_empty(&conn->conn_send_queue->sndq_send_packets_high_pri)) { + return NULL; + } + + return xqc_list_entry(conn->conn_send_queue->sndq_send_packets_high_pri.next, + xqc_packet_out_t, po_list); +} + + void xqc_test_process_frame() { @@ -67,9 +91,109 @@ xqc_test_process_frame() CU_ASSERT(ret == -XQC_EPROTO); xqc_engine_destroy(conn->engine); + + conn = test_engine_connect(); + CU_ASSERT(conn != NULL); + + xqc_packet_in_t pi_app_conn_close_init; + memset(&pi_app_conn_close_init, 0, sizeof(xqc_packet_in_t)); + pi_app_conn_close_init.pi_pkt.pkt_type = XQC_PTYPE_INIT; + pi_app_conn_close_init.pos = XQC_TEST_APP_CONN_CLOSE_FRAME; + pi_app_conn_close_init.last = pi_app_conn_close_init.pos + sizeof(XQC_TEST_APP_CONN_CLOSE_FRAME); + ret = xqc_process_frames(conn, &pi_app_conn_close_init); + CU_ASSERT(ret == -XQC_EPROTO); + + xqc_engine_destroy(conn->engine); + + conn = test_engine_connect(); + CU_ASSERT(conn != NULL); + + xqc_packet_in_t pi_datagram_init; + memset(&pi_datagram_init, 0, sizeof(xqc_packet_in_t)); + pi_datagram_init.pi_pkt.pkt_type = XQC_PTYPE_INIT; + pi_datagram_init.pos = XQC_TEST_DATAGRAM_FRAME; + pi_datagram_init.last = pi_datagram_init.pos + sizeof(XQC_TEST_DATAGRAM_FRAME); + ret = xqc_process_frames(conn, &pi_datagram_init); + CU_ASSERT(ret == -XQC_EPROTO); + + xqc_engine_destroy(conn->engine); +} + +void +xqc_test_handshake_app_conn_close_is_converted() +{ + xqc_connection_t *conn = test_engine_connect(); + CU_ASSERT(conn != NULL); + + int ret = xqc_write_conn_close_to_packet(conn, TRA_CRYPTO_ERROR_BASE); + CU_ASSERT(ret == XQC_OK); + + xqc_packet_out_t *packet_out = xqc_test_first_high_pri_packet(conn); + CU_ASSERT(packet_out != NULL); + CU_ASSERT(packet_out->po_pkt.pkt_type == XQC_PTYPE_INIT); + CU_ASSERT(packet_out->po_payload < packet_out->po_buf + packet_out->po_used_size); + CU_ASSERT(*packet_out->po_payload == 0x1c); + + uint64_t err_code = 0; + ssize_t vlen = xqc_vint_read(packet_out->po_payload + 1, + packet_out->po_buf + packet_out->po_used_size, + &err_code); + CU_ASSERT(vlen > 0); + CU_ASSERT(err_code == TRA_CRYPTO_ERROR_BASE); + + xqc_engine_destroy(conn->engine); + + conn = test_engine_connect(); + CU_ASSERT(conn != NULL); + + ret = xqc_write_conn_close_to_packet(conn, 0x200); + CU_ASSERT(ret == XQC_OK); + + packet_out = xqc_test_first_high_pri_packet(conn); + CU_ASSERT(packet_out != NULL); + CU_ASSERT(packet_out->po_pkt.pkt_type == XQC_PTYPE_INIT); + CU_ASSERT(packet_out->po_payload < packet_out->po_buf + packet_out->po_used_size); + CU_ASSERT(*packet_out->po_payload == 0x1c); + + err_code = 0; + vlen = xqc_vint_read(packet_out->po_payload + 1, + packet_out->po_buf + packet_out->po_used_size, + &err_code); + CU_ASSERT(vlen > 0); + CU_ASSERT(err_code == TRA_APPLICATION_ERROR); + + xqc_engine_destroy(conn->engine); } +void +xqc_test_1rtt_only_flow_control_frames_are_buffered() +{ + xqc_connection_t *conn = test_engine_connect(); + CU_ASSERT(conn != NULL); + + int ret = xqc_write_data_blocked_to_packet(conn, 1); + CU_ASSERT(ret == XQC_OK); + xqc_test_1rtt_only_frame_buffered(conn); + xqc_engine_destroy(conn->engine); + + conn = test_engine_connect(); + CU_ASSERT(conn != NULL); + + ret = xqc_write_stream_data_blocked_to_packet(conn, 0, 1); + CU_ASSERT(ret == XQC_OK); + xqc_test_1rtt_only_frame_buffered(conn); + xqc_engine_destroy(conn->engine); + + conn = test_engine_connect(); + CU_ASSERT(conn != NULL); + + ret = xqc_write_max_data_to_packet(conn, 1); + CU_ASSERT(ret == XQC_OK); + xqc_test_1rtt_only_frame_buffered(conn); + xqc_engine_destroy(conn->engine); +} + void xqc_test_parse_padding_frame() { @@ -89,6 +213,7 @@ xqc_test_parse_padding_frame() char XQC_MIXED_PADDING_FRAME[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x3F}; xqc_packet_in_t pi_padding_mix; memset(&pi_padding_mix, 0, sizeof(xqc_packet_in_t)); + pi_padding_mix.pi_pkt.pkt_type = XQC_PTYPE_SHORT_HEADER; pi_padding_mix.pos = XQC_MIXED_PADDING_FRAME; pi_padding_mix.last = pi_padding_mix.pos + sizeof(XQC_MIXED_PADDING_FRAME); ret = xqc_process_frames(conn, &pi_padding_mix); @@ -98,7 +223,6 @@ xqc_test_parse_padding_frame() xqc_engine_destroy(conn->engine); } - void xqc_test_large_ack_frame() { diff --git a/tests/unittest/xqc_process_frame_test.h b/tests/unittest/xqc_process_frame_test.h index 58a9775be..008547b96 100644 --- a/tests/unittest/xqc_process_frame_test.h +++ b/tests/unittest/xqc_process_frame_test.h @@ -7,6 +7,10 @@ void xqc_test_process_frame(); +void xqc_test_handshake_app_conn_close_is_converted(); + +void xqc_test_1rtt_only_flow_control_frames_are_buffered(); + void xqc_test_parse_padding_frame(); void xqc_test_large_ack_frame();