From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E3C5EA034E; Thu, 20 Jan 2022 17:48:45 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B68D64271A; Thu, 20 Jan 2022 17:48:38 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E826B4271C for ; Thu, 20 Jan 2022 17:48:36 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20KAA6d7026175; Thu, 20 Jan 2022 08:48:35 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=sErV168jbL0sro0qULIsxtK7RibtHFU/F8j6F+OihTI=; b=DZTmqczxVMvBqSC7CZgmvv1GXV2NVKJsepfmoY8f7d4IkxGilQbbpsZ0vmlysJSyjljA yb9XDttJobuEm0DZ29TUA0yAlVsgGgJW4gt6rFRfU0X29+VL2srS27z/1O2s8WsybJV5 6WhN7Nt+MqY0lzxIK2S7eucueag5My5fnxPdEVULrmiC9rr8Bui4VNEIVCz+cy9SvUjH y49Iki1upS/SZ9zJf7kO93fNlIQ/8nk6qOG1DfWkm8rimlTORMEgPRQ6nKMxnun3z6tv 39l0cbwtA42WYF0nnNGRMb4nghph4Ym07j6qL0qKEM2FoR5kzqHekGmASyGjAlGtfPN/ oA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3dq5re1fu0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 20 Jan 2022 08:48:35 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 20 Jan 2022 08:48:33 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 20 Jan 2022 08:48:33 -0800 Received: from localhost.localdomain (unknown [10.28.48.55]) by maili.marvell.com (Postfix) with ESMTP id 66B443F7048; Thu, 20 Jan 2022 08:48:29 -0800 (PST) From: Akhil Goyal To: CC: , , , , , , , , , , , , "Akhil Goyal" Subject: [PATCH v2 4/4] app/test: add IP reassembly negative cases Date: Thu, 20 Jan 2022 22:18:04 +0530 Message-ID: <20220120164804.4163645-5-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220120164804.4163645-1-gakhil@marvell.com> References: <20220103150813.1694888-6-gakhil@marvell.com> <20220120164804.4163645-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: pnwLMvEQCRiMxFFRumvON_v4zMyLvtYI X-Proofpoint-ORIG-GUID: pnwLMvEQCRiMxFFRumvON_v4zMyLvtYI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-20_06,2022-01-20_01,2021-12-02_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org test_inline_ipsec testsuite is added with cases where the IP reassembly is incomplete and software will need to reassemble them later. The failure cases added are: - all fragments are not received. - same fragment is received more than once. - out of order fragments. Signed-off-by: Akhil Goyal --- app/test/test_security_inline_proto.c | 71 +++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/app/test/test_security_inline_proto.c b/app/test/test_security_inline_proto.c index d05325b205..b1794c1bc7 100644 --- a/app/test/test_security_inline_proto.c +++ b/app/test/test_security_inline_proto.c @@ -1179,6 +1179,68 @@ test_reassembly_ipv6_5frag(void) RTE_SECURITY_IPSEC_TUNNEL_IPV6); } +static int +test_reassembly_incomplete(void) +{ + /* Negative test case, not sending all fragments. */ + struct reassembly_vector ipv4_incomplete_case = { + .sa_data = &conf_aes_128_gcm, + .full_pkt = &pkt_ipv4_udp_p2, + .frags[0] = &pkt_ipv4_udp_p2_f1, + .frags[1] = &pkt_ipv4_udp_p2_f2, + .nb_frags = 2, + }; + test_vector_payload_populate(&pkt_ipv4_udp_p2, true); + test_vector_payload_populate(&pkt_ipv4_udp_p2_f1, true); + test_vector_payload_populate(&pkt_ipv4_udp_p2_f2, false); + + return test_ipsec_encap_decap(&ipv4_incomplete_case, + RTE_SECURITY_IPSEC_TUNNEL_IPV4); +} + +static int +test_reassembly_overlap(void) +{ + /* Negative test case, sending 1 fragment twice. */ + struct reassembly_vector ipv4_overlap_case = { + .sa_data = &conf_aes_128_gcm, + .full_pkt = &pkt_ipv4_udp_p1, + .frags[0] = &pkt_ipv4_udp_p1_f1, + .frags[1] = &pkt_ipv4_udp_p1_f1, /* Overlap */ + .frags[2] = &pkt_ipv4_udp_p1_f2, + .nb_frags = 3, + }; + test_vector_payload_populate(&pkt_ipv4_udp_p2, true); + test_vector_payload_populate(&pkt_ipv4_udp_p2_f1, true); + test_vector_payload_populate(&pkt_ipv4_udp_p2_f2, false); + + return test_ipsec_encap_decap(&ipv4_overlap_case, + RTE_SECURITY_IPSEC_TUNNEL_IPV4); +} + +static int +test_reassembly_out_of_order(void) +{ + /* Negative test case, out of order fragments. */ + struct reassembly_vector ipv4_ooo_case = { + .sa_data = &conf_aes_128_gcm, + .full_pkt = &pkt_ipv4_udp_p2, + .frags[0] = &pkt_ipv4_udp_p2_f1, + .frags[1] = &pkt_ipv4_udp_p2_f3, + .frags[2] = &pkt_ipv4_udp_p2_f4, + .frags[3] = &pkt_ipv4_udp_p2_f2, + .nb_frags = 4, + }; + test_vector_payload_populate(&pkt_ipv4_udp_p2, true); + test_vector_payload_populate(&pkt_ipv4_udp_p2_f1, true); + test_vector_payload_populate(&pkt_ipv4_udp_p2_f2, false); + test_vector_payload_populate(&pkt_ipv4_udp_p2_f3, false); + test_vector_payload_populate(&pkt_ipv4_udp_p2_f4, false); + + return test_ipsec_encap_decap(&ipv4_ooo_case, + RTE_SECURITY_IPSEC_TUNNEL_IPV4); +} + static struct unit_test_suite inline_ipsec_testsuite = { .suite_name = "Inline IPsec Ethernet Device Unit Test Suite", .setup = testsuite_setup, @@ -1214,6 +1276,15 @@ static struct unit_test_suite inline_ipsec_testsuite = { TEST_CASE_ST(ut_setup_inline_ipsec, ut_teardown_inline_ipsec, test_reassembly_ipv6_5frag), + TEST_CASE_ST(ut_setup_inline_ipsec, + ut_teardown_inline_ipsec, + test_reassembly_incomplete), + TEST_CASE_ST(ut_setup_inline_ipsec, + ut_teardown_inline_ipsec, + test_reassembly_overlap), + TEST_CASE_ST(ut_setup_inline_ipsec, + ut_teardown_inline_ipsec, + test_reassembly_out_of_order), TEST_CASES_END() /**< NULL terminate unit test array */ } -- 2.25.1