From patchwork Thu Apr 16 14:17:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1271726 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=gq3SClvx; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4931XK6Mtgz9sW2 for ; Fri, 17 Apr 2020 00:17:53 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A78508695C; Thu, 16 Apr 2020 14:17:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dfDqGfzGu2RW; Thu, 16 Apr 2020 14:17:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id E2A628638F; Thu, 16 Apr 2020 14:17:50 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D0CC5C1AE8; Thu, 16 Apr 2020 14:17:50 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3FA12C0172 for ; Thu, 16 Apr 2020 14:17:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 248A322270 for ; Thu, 16 Apr 2020 14:17:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BVAcM7xW3mtU for ; Thu, 16 Apr 2020 14:17:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by silver.osuosl.org (Postfix) with ESMTPS id 88DFC21FA8 for ; Thu, 16 Apr 2020 14:17:49 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id r4so1709289pgg.4 for ; Thu, 16 Apr 2020 07:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=tS9r0UIY74aore5omgpAeQVOXxJcG+HfD2X6/yMhhdM=; b=gq3SClvxKZJZBoMqORs/uAtuNEa2CHp6LYq3pCE8bl8kRhRudg87GLNccrw/D+AOaY z6WfcnbLv25PXZqp8wu1jtxBwUGYsuRiIEwpyz4E5SxwHxpl3NexUQbvb+SiHhTSzIh7 uk8K8qDGf6eSIk/NHjrQUE5wSYmOTQJFlz8OZ86wXqnmBuITu8WP5e42tIZp+dHKtb1l +CZVhnHWNW7yW7nz+0qkD9jT9+OWcK5H4Bdf8CcnjyEm+UbMcSoZmjsZkkskPTwRHGUV Ux6CCM2iPoFucied3JNbYtXGCcvEY/bmsxMP3ORQhKrYs8nLvVBRFDOcD5wwK2RaRGK8 5bAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tS9r0UIY74aore5omgpAeQVOXxJcG+HfD2X6/yMhhdM=; b=VQcutt6oP90VsDnNnvbZtI2ii+yX/IOvoctkCS3ruxCouyVKqsde6mFXcUVGXvWzd8 QdimkOxoWTvCosfIdpo89iYaIMLgHQmG7juDKp6oAfrCYzqu4KHBMueUTyQVxAsMs/0V 3otPFsfv316xE+eFRGI7oC2cD5jQKEqKqS+RGSH2ooEdfZKMi8oTe7lqyunerkg7Goax Uao2lYVp4CbI9vVHdvpnR1sxP1wqRyE3kaxEwh6IoYlG4wa2yUkXHGCzjKabi8ir7gtR hV/61aEOE9bnDHUJlJ5uOsoWNZcOUZR4EzD3gHGqhPJZWwCdLqftjJ+pKkQ94b0ApDh9 h/lA== X-Gm-Message-State: AGi0PuZQVZBTpyI5sQwrgoq0EzM4wsuRCLNLfwUnjA+5ozPP6EX+yxVb 4RXiTTaw2E8EM10BdW60FCNwLgEb X-Google-Smtp-Source: APiQypJefjG1mDa76d8PZIH4kHrmdn8CnwWRd0h/tdn1aMnx0EZJZygG7/7jwYqqnsZ5fHWpTvy7Xg== X-Received: by 2002:a62:7c86:: with SMTP id x128mr1466664pfc.295.1587046668817; Thu, 16 Apr 2020 07:17:48 -0700 (PDT) Received: from sc9-mailhost3.vmware.com (c-76-21-95-192.hsd1.ca.comcast.net. [76.21.95.192]) by smtp.gmail.com with ESMTPSA id a200sm14121708pfa.201.2020.04.16.07.17.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Apr 2020 07:17:48 -0700 (PDT) From: William Tu To: dev@openvswitch.org Date: Thu, 16 Apr 2020 07:17:20 -0700 Message-Id: <1587046640-41943-1-git-send-email-u9012063@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: guru@ovn.org Subject: [ovs-dev] [PATCH] conntrack: Add coverage count for l4csum error. 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: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Add a coverage counter when userspace conntrack receives a packet with invalid l4 checksum. When using veth for testing, users often forget to turn off the tx offload on the other side of the namespace, causing l4 checksum not calculated in packet header, and at conntrack, return invalid conntrack state. Suggested-by: Yi-Hung Wei Signed-off-by: William Tu --- lib/conntrack.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/conntrack.c b/lib/conntrack.c index 0cbc8f6d2b25..98a62ce3bae6 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -44,6 +44,7 @@ VLOG_DEFINE_THIS_MODULE(conntrack); COVERAGE_DEFINE(conntrack_full); COVERAGE_DEFINE(conntrack_long_cleanup); +COVERAGE_DEFINE(conntrack_l4csum_err); struct conn_lookup_ctx { struct conn_key key; @@ -1661,6 +1662,7 @@ checksum_valid(const struct conn_key *key, const void *data, size_t size, } else if (key->dl_type == htons(ETH_TYPE_IPV6)) { return packet_csum_upperlayer6(l3, data, key->nw_proto, size) == 0; } else { + COVERAGE_INC(conntrack_l4csum_err); return false; } }