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 EF210A0032; Thu, 17 Feb 2022 18:24:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9E9A41158; Thu, 17 Feb 2022 18:24:13 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 0E8CE41157 for ; Thu, 17 Feb 2022 18:24:11 +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 21HGG9Lk013894; Thu, 17 Feb 2022 09:24:08 -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=hCZGDY8tqgwwJ0N1cWWJhyjzf2bG4xvdlyjS4W70ldo=; b=UlAbb4ZLnoe1Z8qmZeFGf3v9M9VVHYMnSRWo3VP+uoeExCpasv3+4n5C+4vuWlwsZNIU kC7uqMNOlA6PXbYW1ciwX+deoEfTAKT7JD+t99v64dz3JgJtOwHivd3TFI9RG9WVwzuF wWC8+3Nx5guPNWyUJr9raYqP9vqaupn1vmUlVPORxvJKvHv0NpOYG6BFe6f7kl5uE/dN HjN68zHjnFcy1tS5TCRVRoKidLOtCogB+G+F7n/J1nlx+ChD0EmvEGrZygA6snOGob9q pQLKtouhnL04al7X8nKI1G1cDTGRWkNdvzdQ6h1KIBlTmXRv7TP6XrM/zcD1vQ4hNFWQ 4g== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3e9sqrgb6f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 09:24:07 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 17 Feb 2022 09:24:06 -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, 17 Feb 2022 09:24:06 -0800 Received: from localhost.localdomain (unknown [10.28.48.55]) by maili.marvell.com (Postfix) with ESMTP id ACC2C3F708A; Thu, 17 Feb 2022 09:24:02 -0800 (PST) From: Akhil Goyal To: CC: , , , , , , , , , , , , Akhil Goyal Subject: [PATCH v3 4/4] app/test: add IP reassembly negative cases Date: Thu, 17 Feb 2022 22:53:41 +0530 Message-ID: <20220217172341.607360-5-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220217172341.607360-1-gakhil@marvell.com> References: <20220120164804.4163645-1-gakhil@marvell.com> <20220217172341.607360-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: UWwEOJFSzKd5sUxjNhluS9sLCVjDo3Bj X-Proofpoint-GUID: UWwEOJFSzKd5sUxjNhluS9sLCVjDo3Bj 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-02-17_06,2022-02-17_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 9c9e34ca0d..cae8b083bc 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