From patchwork Tue Nov 9 22:30:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valerio X-Patchwork-Id: 1553185 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=Q0Lm9qvw; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpjNd6X2nz9sCD for ; Wed, 10 Nov 2021 09:30:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 19C36608DF; Tue, 9 Nov 2021 22:30:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hisX5Uuv5JTM; Tue, 9 Nov 2021 22:30:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 4EA0A60A3B; Tue, 9 Nov 2021 22:30:22 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 180B2C0021; Tue, 9 Nov 2021 22:30:22 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 101D7C0012 for ; Tue, 9 Nov 2021 22:30:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D426B81951 for ; Tue, 9 Nov 2021 22:30:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LxDR8TFTDBi8 for ; Tue, 9 Nov 2021 22:30:13 +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 [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 171D98194A for ; Tue, 9 Nov 2021 22:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636497012; 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: in-reply-to:in-reply-to:references:references; bh=EfN5swx21JRJKVcAe8vRWo3Y7K26RaYKlvCCA/wNr3I=; b=Q0Lm9qvwa7ozd2ZA5Iz5lZfZmqWJOP/dbXqksHnpuLVZnhqFJSVXGizMk1RjtMxbGsyki7 kyRhvwNhDXzanzVG2mpL9w816z8HVdXRs34gmYx0kUMnitfh0cxhr2nCGVWR1P17fnhhqt vq8T7WJEMRLEEUdZXGgP4ADZiVHmfF4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-247-7ETusQkrMQmIzjZEmvh-RA-1; Tue, 09 Nov 2021 17:30:11 -0500 X-MC-Unique: 7ETusQkrMQmIzjZEmvh-RA-1 Received: by mail-wr1-f69.google.com with SMTP id v17-20020adfedd1000000b0017c5e737b02so37931wro.18 for ; Tue, 09 Nov 2021 14:30:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=EfN5swx21JRJKVcAe8vRWo3Y7K26RaYKlvCCA/wNr3I=; b=o1bhDH9+aIr6KDsE4FWaLRrdRREes9CvE5zOO0eEgcJPrrFw8T7yNXUpPdRNoj46wt m+zLfOc6B9wJvIjeDd701RNn4W/pwUzBQaIoq9s297tTJoNzUCxTqBy/0i/rYpwrWQTj peMPWUJkvF64fW6e+ehfDHlB5I9VtVaJ0HA13qbWGv/U1FNbfp19RKzRaD662kxYPCZe 9ivPDhJr8vTqQZJfIwUiNhzzFo4cAFznP5MU4JhrBjCjSWpvA9WuJSBFhGwpnthMniZ/ +eCbNNR7tvMDI3D0V1RVFJZnGESU6jvYqjb7CeNa8LMloc8F+HdmE4ez76+uKBWSrzPc U8kQ== X-Gm-Message-State: AOAM533ZnJBl9fliss7B3xRLJppUTxgPDNcICok6TAJgbUXM5f9wSgbG 6lPi7N3TAFynxrnibcjrvGRII9IfTHR6Roq3Ahyf0yK0CttfFbIbb7K5c1Uoc7MgkT5dmC6t1TV 0n2hn94zhjuuBGgAT2iekI9IwvLxih7aA9o98tHiQb+ea1Lw/c8NL8XUc4QO18e+4 X-Received: by 2002:a1c:cc0f:: with SMTP id h15mr11362221wmb.37.1636497009620; Tue, 09 Nov 2021 14:30:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkCr0BuLORWXDZtMWrWu44HKkdDS7XvrarcJr/FQyNW4c3tJl7lZrhM6PuksZC7tGwyAIPDQ== X-Received: by 2002:a1c:cc0f:: with SMTP id h15mr11362186wmb.37.1636497009358; Tue, 09 Nov 2021 14:30:09 -0800 (PST) Received: from localhost (net-5-88-23-84.cust.vodafonedsl.it. [5.88.23.84]) by smtp.gmail.com with ESMTPSA id h1sm3769631wmb.7.2021.11.09.14.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 14:30:09 -0800 (PST) From: Paolo Valerio To: dev@openvswitch.org Date: Tue, 09 Nov 2021 23:30:08 +0100 Message-ID: <163649700835.1456179.5887498794534040460.stgit@fed.void> In-Reply-To: <163649698390.1456179.6935508376718804388.stgit@fed.void> References: <163649698390.1456179.6935508376718804388.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 Cc: fbl@redhat.com, i.maximets@ovn.org Subject: [ovs-dev] [PATCH 3/4] Native tunnel: Do not refresh the entry while revalidating. 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" This is a minor issue but visible e.g. when you try to flush the neigh cache while the ARP flow is still present in the datapath, triggering the revalidation of the datapath flows which subsequently refreshes/adds the entry in the cache. Signed-off-by: Paolo Valerio --- v2: - renamed update -> allow_update --- lib/tnl-neigh-cache.c | 20 +++++++++++++------- lib/tnl-neigh-cache.h | 2 +- ofproto/ofproto-dpif-xlate.c | 3 ++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/tnl-neigh-cache.c b/lib/tnl-neigh-cache.c index a4d56e4cc..5f2d4be75 100644 --- a/lib/tnl-neigh-cache.c +++ b/lib/tnl-neigh-cache.c @@ -174,7 +174,7 @@ tnl_arp_set(const char name[IFNAMSIZ], ovs_be32 dst, static int tnl_arp_snoop(const struct flow *flow, struct flow_wildcards *wc, - const char name[IFNAMSIZ]) + const char name[IFNAMSIZ], bool allow_update) { /* Snoop normal ARP replies and gratuitous ARP requests/replies only */ if (!is_arp(flow) @@ -184,13 +184,17 @@ tnl_arp_snoop(const struct flow *flow, struct flow_wildcards *wc, return EINVAL; } - tnl_arp_set(name, FLOW_WC_GET_AND_MASK_WC(flow, wc, nw_src), flow->arp_sha); + memset(&wc->masks.nw_src, 0xff, sizeof wc->masks.nw_src); + + if (allow_update) { + tnl_arp_set(name, flow->nw_src, flow->arp_sha); + } return 0; } static int tnl_nd_snoop(const struct flow *flow, struct flow_wildcards *wc, - const char name[IFNAMSIZ]) + const char name[IFNAMSIZ], bool allow_update) { if (!is_nd(flow, wc) || flow->tp_src != htons(ND_NEIGHBOR_ADVERT)) { return EINVAL; @@ -209,20 +213,22 @@ tnl_nd_snoop(const struct flow *flow, struct flow_wildcards *wc, memset(&wc->masks.ipv6_dst, 0xff, sizeof wc->masks.ipv6_dst); memset(&wc->masks.nd_target, 0xff, sizeof wc->masks.nd_target); - tnl_neigh_set__(name, &flow->nd_target, flow->arp_tha); + if (allow_update) { + tnl_neigh_set__(name, &flow->nd_target, flow->arp_tha); + } return 0; } int tnl_neigh_snoop(const struct flow *flow, struct flow_wildcards *wc, - const char name[IFNAMSIZ]) + const char name[IFNAMSIZ], bool allow_update) { int res; - res = tnl_arp_snoop(flow, wc, name); + res = tnl_arp_snoop(flow, wc, name, allow_update); if (res != EINVAL) { return res; } - return tnl_nd_snoop(flow, wc, name); + return tnl_nd_snoop(flow, wc, name, allow_update); } void diff --git a/lib/tnl-neigh-cache.h b/lib/tnl-neigh-cache.h index e4b42b059..59804ea3e 100644 --- a/lib/tnl-neigh-cache.h +++ b/lib/tnl-neigh-cache.h @@ -32,7 +32,7 @@ #include "util.h" int tnl_neigh_snoop(const struct flow *flow, struct flow_wildcards *wc, - const char dev_name[IFNAMSIZ]); + const char dev_name[IFNAMSIZ], bool allow_update); int tnl_neigh_lookup(const char dev_name[IFNAMSIZ], const struct in6_addr *dst, struct eth_addr *mac); void tnl_neigh_cache_init(void); diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 9d336bc6a..9cf414ee8 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4097,7 +4097,8 @@ terminate_native_tunnel(struct xlate_ctx *ctx, struct flow *flow, (flow->dl_type == htons(ETH_TYPE_ARP) || flow->nw_proto == IPPROTO_ICMPV6) && is_neighbor_reply_correct(ctx, flow)) { - tnl_neigh_snoop(flow, wc, ctx->xbridge->name); + tnl_neigh_snoop(flow, wc, ctx->xbridge->name, + ctx->xin->allow_side_effects); } }