From patchwork Thu Oct 7 12:35:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valerio X-Patchwork-Id: 1537675 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=U2HvBn4f; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HQ9lq5T8sz9sPB for ; Thu, 7 Oct 2021 23:35:51 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 09FEB60FBC; Thu, 7 Oct 2021 12:35:49 +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 4lGsze7uIYa5; Thu, 7 Oct 2021 12:35:47 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 2626C60FCA; Thu, 7 Oct 2021 12:35:46 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6D618C001E; Thu, 7 Oct 2021 12:35:44 +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 59B28C000D for ; Thu, 7 Oct 2021 12:35:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E4FFE40A24 for ; Thu, 7 Oct 2021 12:35:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com 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 JXubqqj5_jyd for ; Thu, 7 Oct 2021 12:35:39 +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 3825840A20 for ; Thu, 7 Oct 2021 12:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633610138; 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=fwz4VnNrEqR7a7nla7Wq9XqUjOA+m7qjJIlsFkzvWtE=; b=U2HvBn4fEsG7ROqvr7ZNKT7s8gMaAZNw+W/hP0qGHBjRcENrB1vUiH4vm4EgpoUUYBd6zp MXXvlmc2c33okwJSoLE5NTYm2vMu4kqvkXugalbUwSmNOiy8A4B9txSyEadWlweT22crzM d7LlKf5t9H0BdEsfbLqY7lR4Q02NaAI= 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-143-I2v1jGQyPbiZf0W4lwauug-1; Thu, 07 Oct 2021 08:35:37 -0400 X-MC-Unique: I2v1jGQyPbiZf0W4lwauug-1 Received: by mail-wr1-f69.google.com with SMTP id 75-20020adf82d1000000b00160cbb0f800so3808115wrc.22 for ; Thu, 07 Oct 2021 05:35:37 -0700 (PDT) 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=fwz4VnNrEqR7a7nla7Wq9XqUjOA+m7qjJIlsFkzvWtE=; b=aWBxC3ojg4e/9FC1d18zrl/JlmcKxq+zQXffiD3fkdsPvgW6tF6xq8xgLUHtfnlYug 1zR6/wY/NQP4r8jZyYu+hE6K+qIetYugB1ze70AxIPWG7H+MZ5hGVlBM/Ou3klMz2tTG 8SbdnMFOe9IjvJfjEEVHbzCSMU0PdCUb54T6h4fYl0RW3goSt4RJa+mxU49otw8xoviH KVDyleLyhDIs0M3vxvABqWbSPF3SJ7cF5GpxGLdxF6YQXTGeCN5gekC8AKDkN09/nT3f 2rc8l6Xa3IjuzV3DWp00LgWqF3T2jdC98y4ZOElOia2YXixfq2nKxzv0v/WwWAp3cB3S bCdQ== X-Gm-Message-State: AOAM533n9aINfow0QY+d7KoTEOY2nijBHsFY0hQx0zPjEuKRwb7ElKwX vnSpc6qB53L3keR5MP6QZZlj34U6pXt19KZgCWz8rgIxLJBXK5mHMuvIM/NCuWmQ/6uwPYbOPk1 rG3lRzYRRWT35UBSDkOCGjP6NvNgHq1qLuijmgH1wzsBg3NIEOjPm4h6LdPGvdWRz X-Received: by 2002:a1c:3b44:: with SMTP id i65mr16188866wma.129.1633610135941; Thu, 07 Oct 2021 05:35:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCENXPSu3jOWxgYYlykIZQO3jzKELAZHUltW4b6hNWWAa9MzgfQMeaIWffHOSP5Dnj/0jD5A== X-Received: by 2002:a1c:3b44:: with SMTP id i65mr16188831wma.129.1633610135520; Thu, 07 Oct 2021 05:35:35 -0700 (PDT) Received: from localhost (net-31-156-149-94.cust.vodafonedsl.it. [31.156.149.94]) by smtp.gmail.com with ESMTPSA id d8sm16854072wrz.84.2021.10.07.05.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 05:35:35 -0700 (PDT) From: Paolo Valerio To: dev@openvswitch.org Date: Thu, 07 Oct 2021 14:35:34 +0200 Message-ID: <163361013437.2049658.1927530737014999774.stgit@fed.void> In-Reply-To: <163361010601.2049658.11988551193043156960.stgit@fed.void> References: <163361010601.2049658.11988551193043156960.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 RFC 4/5] 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 subsequntly refreshes/adds the entry in the cache. Signed-off-by: Paolo Valerio --- 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 9d3f00ad9..df8de48eb 100644 --- a/lib/tnl-neigh-cache.c +++ b/lib/tnl-neigh-cache.c @@ -173,7 +173,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 update) { /* Snoop normal ARP replies and gratuitous ARP requests/replies only */ if (!is_arp(flow) @@ -183,13 +183,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 (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 update) { if (!is_nd(flow, wc) || flow->tp_src != htons(ND_NEIGHBOR_ADVERT)) { return EINVAL; @@ -208,20 +212,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 (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 update) { int res; - res = tnl_arp_snoop(flow, wc, name); + res = tnl_arp_snoop(flow, wc, name, update); if (res != EINVAL) { return res; } - return tnl_nd_snoop(flow, wc, name); + return tnl_nd_snoop(flow, wc, name, update); } void diff --git a/lib/tnl-neigh-cache.h b/lib/tnl-neigh-cache.h index 92fdf5a93..a2fd9f4ae 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 update); void tnl_neigh_set(const char name[IFNAMSIZ], const struct in6_addr *dst, const struct eth_addr mac); diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 4430ac073..44a49dae8 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); } else if (*tnl_port != ODPP_NONE && ctx->xin->allow_side_effects && (flow->dl_type == htons(ETH_TYPE_IP) ||