From patchwork Fri Apr 30 17:12:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valerio X-Patchwork-Id: 1472414 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=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BKM35Eog; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FWzT06grVz9sW5 for ; Sat, 1 May 2021 03:12:36 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 201F041B55; Fri, 30 Apr 2021 17:12:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v8apVYlZ6Pto; Fri, 30 Apr 2021 17:12:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTP id 738AF41B49; Fri, 30 Apr 2021 17:12:31 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2B625C000D; Fri, 30 Apr 2021 17:12:31 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id EAD81C0001 for ; Fri, 30 Apr 2021 17:12:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C285241B56 for ; Fri, 30 Apr 2021 17:12:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xPJ05iz4A4tx for ; Fri, 30 Apr 2021 17:12:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id A5BE241B49 for ; Fri, 30 Apr 2021 17:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619802746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TkLU/c2iqNtmVJALXf2gGxCF7hKqGsokNHzErU55kOg=; b=BKM35EogfTtQAUauVS7zJmVtAwOAvqLy8bwxPZmtAUv1dnqwKR0PFJ63/HY8ccOv9CW2mK ufpuqQcENK82CrxnvFMvFY+y9eHsjf9F3GefyYQccd6/39w3xzO6XqqxhC/60uaLEGEQjK qm105/ynQkeaDmTsZMl/182Qtq9w290= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-565-XT8sg1jgMTWrjZ2ArsU-uA-1; Fri, 30 Apr 2021 13:12:22 -0400 X-MC-Unique: XT8sg1jgMTWrjZ2ArsU-uA-1 Received: by mail-ed1-f72.google.com with SMTP id d13-20020a056402144db0290387e63c95d8so6041864edx.11 for ; Fri, 30 Apr 2021 10:12:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=TkLU/c2iqNtmVJALXf2gGxCF7hKqGsokNHzErU55kOg=; b=sgjshmKT5P4KaEgdGbjYTMnxNP8YRnJ2j0cLIpn++WVobsatWDs6nsBoIHz0higZGj pC4I7eXOGyQwq7FeR7VnKZGpWa6PpoeNQhvuiTMQIQPg+f3QyptjgTD6vWCoDFyN/U2n ePwVtgzbVG90i/OZT7vVTmHkMYpHOUuWPSKR43zJUQfiU10xkGFxjAF3eshHuLqGyp1x lulu3//lW4zkPNI5yF0zV6qW81WpWPhp6loARMVaeYvbctA7mBH0qc5AI7OVN4nR8tPX X0x8+eXo6lmHZdYCFaIwLwBWIXrZnVs0NJPLN/dfuIcD74iSrcf1+4yjyXU+acEY1N0k UOuw== X-Gm-Message-State: AOAM531YYrZclDXxPjKIxMOEtzK2RZ4ksxww36GR22iROamVelpbAr07 xPt1Jri5bgYf11AobiHUlWI3q+uOux10cA/ubuzDXN075uWv13xcpCNGk47k/tOnOdUbBSBgZ1L a866TUcA1TH29rI4RGw8qepJAmo7BaT5Ily5+estAPaoZz18wpLmnKytJA9E2khKP X-Received: by 2002:a17:906:f113:: with SMTP id gv19mr3360940ejb.237.1619802741124; Fri, 30 Apr 2021 10:12:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqDGfk/hXATNF6adkRj31/T/78oABcLEV7rK0HNq8RgQqjRO4Ur4QltN0mD36CUtYDKBTY6Q== X-Received: by 2002:a17:906:f113:: with SMTP id gv19mr3360907ejb.237.1619802740876; Fri, 30 Apr 2021 10:12:20 -0700 (PDT) Received: from localhost (net-37-119-128-110.cust.vodafonedsl.it. [37.119.128.110]) by smtp.gmail.com with ESMTPSA id ck4sm1012142edb.56.2021.04.30.10.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Apr 2021 10:12:20 -0700 (PDT) From: Paolo Valerio To: dev@openvswitch.org Date: Fri, 30 Apr 2021 19:12:15 +0200 Message-ID: <161980273210.95131.8863959545804983824.stgit@fed.void> User-Agent: StGit/0.23 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pvalerio@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v2] conntrack: add coverage counters for L3 bad checksum 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" similarly to what already exists for L4, add conntrack_l3csum_err and ipf_l3csum_err for L3. Received packets with L3 bad checksum will increase respectively ipf_l3csum_err if they are fragments and conntrack_l3csum_err otherwise. Although the patch basically covers IPv4, the names are kept generic. Signed-off-by: Paolo Valerio Acked-by: Eelco Chaudron Reviewed-by: Aaron Conole --- lib/conntrack.c | 3 +++ lib/ipf.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/conntrack.c b/lib/conntrack.c index 99198a601..70cdcc12a 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -45,6 +45,7 @@ VLOG_DEFINE_THIS_MODULE(conntrack); COVERAGE_DEFINE(conntrack_full); COVERAGE_DEFINE(conntrack_long_cleanup); +COVERAGE_DEFINE(conntrack_l3csum_err); COVERAGE_DEFINE(conntrack_l4csum_err); struct conn_lookup_ctx { @@ -1613,6 +1614,7 @@ extract_l3_ipv4(struct conn_key *key, const void *data, size_t size, } if (validate_checksum && csum(data, ip_len) != 0) { + COVERAGE_INC(conntrack_l3csum_err); return false; } @@ -2051,6 +2053,7 @@ conn_key_extract(struct conntrack *ct, struct dp_packet *pkt, ovs_be16 dl_type, bool hwol_bad_l3_csum = dp_packet_ip_checksum_bad(pkt); if (hwol_bad_l3_csum) { ok = false; + COVERAGE_INC(conntrack_l3csum_err); } else { bool hwol_good_l3_csum = dp_packet_ip_checksum_valid(pkt) || dp_packet_hwol_is_ipv4(pkt); diff --git a/lib/ipf.c b/lib/ipf.c index c20bcc0b3..f26e7d492 100644 --- a/lib/ipf.c +++ b/lib/ipf.c @@ -36,6 +36,7 @@ VLOG_DEFINE_THIS_MODULE(ipf); COVERAGE_DEFINE(ipf_stuck_frag_list_purged); +COVERAGE_DEFINE(ipf_l3csum_err); enum { IPV4_PACKET_MAX_HDR_SIZE = 60, @@ -575,6 +576,7 @@ static bool ipf_is_valid_v4_frag(struct ipf *ipf, struct dp_packet *pkt) { if (OVS_UNLIKELY(dp_packet_ip_checksum_bad(pkt))) { + COVERAGE_INC(ipf_l3csum_err); goto invalid_pkt; } @@ -610,6 +612,7 @@ ipf_is_valid_v4_frag(struct ipf *ipf, struct dp_packet *pkt) if (OVS_UNLIKELY(!dp_packet_ip_checksum_valid(pkt) && !dp_packet_hwol_is_ipv4(pkt) && csum(l3, ip_hdr_len) != 0)) { + COVERAGE_INC(ipf_l3csum_err); goto invalid_pkt; }