From patchwork Wed May 22 02:37:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?6LWW6aaZ5q2m?= <15310488637@163.com> X-Patchwork-Id: 1937583 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=Yr8jf5X9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vkb7x0Xk5z2020 for ; Wed, 22 May 2024 12:38:04 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id CD703607FD; Wed, 22 May 2024 02:37:54 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id XLplE8qXexbW; Wed, 22 May 2024 02:37:54 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D29B960833 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=Yr8jf5X9 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id D29B960833; Wed, 22 May 2024 02:37:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id AD49AC0077; Wed, 22 May 2024 02:37:53 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 02FC1C0037 for ; Wed, 22 May 2024 02:37:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id CB7E581B25 for ; Wed, 22 May 2024 02:37:52 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id N6TYFY6DI-bJ for ; Wed, 22 May 2024 02:37:51 +0000 (UTC) X-Greylist: delayed 158230 seconds by postgrey-1.37 at util1.osuosl.org; Wed, 22 May 2024 02:37:50 UTC DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org A91A781B10 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=163.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A91A781B10 Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=Yr8jf5X9 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.254.50.219; helo=m15.mail.163.com; envelope-from=15310488637@163.com; receiver= Received: from m15.mail.163.com (m15.mail.163.com [45.254.50.219]) by smtp1.osuosl.org (Postfix) with ESMTP id A91A781B10 for ; Wed, 22 May 2024 02:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version: Content-Type; bh=xVRDzO+XDRFtDmVrwgj1Pk8BoAKqQNc8SE1kpc4UD14=; b=Yr8jf5X9Bif+zM5NDHLL0Cn269lFX7HeWGqRe2zSL0fza0CPc7AdrBmKvLbQHz TmGu+d7mBqQb5edyGZqpnp3ec+6Cl1jnF2IseWVqEbFvKq13ZymMihfTWM8KnJuc 6HDYnpwLyCrnZsbCvXfiHOIAXmklkCYxwys/SEEQV4Pg8= Received: from localhost.localdomain (unknown [223.108.79.102]) by gzga-smtp-mta-g0-2 (Coremail) with SMTP id _____wB37CN1Wk1m3TB0FQ--.63454S2; Wed, 22 May 2024 10:37:41 +0800 (CST) From: laixiangwu <15310488637@163.com> To: dev@openvswitch.org Date: Wed, 22 May 2024 02:37:39 +0000 Message-Id: <20240522023739.82063-1-15310488637@163.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-CM-TRANSID: _____wB37CN1Wk1m3TB0FQ--.63454S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxZFy8Xr4DZFWfKFW5uryUZFb_yoW5Wr13pa y3Ga4UGFs7ta1kKr4UXr4Fka1FvF4rJrWaqry3Wa4Yyw4qv3yFgFn2yryYkF1fXr48Cw43 Wr4kKryUWF15JrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRA-BNUUUUU= X-Originating-IP: [223.108.79.102] X-CM-SenderInfo: zprvjiaquymlitx6il2tof0z/1tbiXRrm3WXAlYJ2twAAsP Cc: laixiangwu <15310488637@163.com> Subject: [ovs-dev] [PATCH]ipf: Fix ovs ipf crash. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Description: when 1) The fragment timeout is between 15 seconds and 25 seconds; 2) The ipf_list currently has received more than 32 fragments, and there are other fragments of same big packet that have not been received. When the above two scenario conditions are met, due to exceeding the capacity of the packet batch(here is 32), ipf_dp_packet_batch_add returns false, and ipf_list will not be cleared. However, the 32 fragments packets added to the packet batch will be processed normally. When receiving the subsequent fragments of the ipf_list, because the first 32 fragments have been processed, when processing subsequent fragment packets, relevant information about the processed fragment packets will be read,therefore will occur carsh. One solution is do not forward timeout fragment packets from the above scenarios, that is, do not add them to the packet batch, and handle other scenarios according to the original logic. --- lib/ipf.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/ipf.c b/lib/ipf.c index d45266374..9258173ab 100644 --- a/lib/ipf.c +++ b/lib/ipf.c @@ -1011,7 +1011,7 @@ ipf_purge_list_check(struct ipf *ipf, struct ipf_list *ipf_list, } /* Does the packet batch management and common accounting work associated - * with 'ipf_send_completed_frags()' and 'ipf_send_expired_frags()'. */ + * with 'ipf_send_completed_frags()'. */ static bool ipf_send_frags_in_list(struct ipf *ipf, struct ipf_list *ipf_list, struct dp_packet_batch *pb, @@ -1076,8 +1076,7 @@ ipf_send_completed_frags(struct ipf *ipf, struct dp_packet_batch *pb, * a packet batch to be processed by the calling application, typically * conntrack. Also cleans up the list context when it is empty.*/ static void -ipf_send_expired_frags(struct ipf *ipf, struct dp_packet_batch *pb, - long long now, bool v6) +ipf_clean_expired_frags(struct ipf *ipf, long long now) { enum { /* Very conservative, due to DOS probability. */ @@ -1099,8 +1098,7 @@ ipf_send_expired_frags(struct ipf *ipf, struct dp_packet_batch *pb, break; } - if (ipf_send_frags_in_list(ipf, ipf_list, pb, IPF_FRAG_EXPIRY_LIST, - v6, now)) { + if (ipf_purge_list_check(ipf, ipf_list, now)) { ipf_expiry_list_clean(&ipf->frag_lists, ipf_list); lists_removed++; } else { @@ -1249,7 +1247,7 @@ ipf_postprocess_conntrack(struct ipf *ipf, struct dp_packet_batch *pb, bool v6 = dl_type == htons(ETH_TYPE_IPV6); ipf_post_execute_reass_pkts(ipf, pb, v6); ipf_send_completed_frags(ipf, pb, now, v6); - ipf_send_expired_frags(ipf, pb, now, v6); + ipf_clean_expired_frags(ipf, now); } }