From patchwork Tue Dec 3 14:11:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1203728 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.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47S3nT5TgZz9sPJ for ; Wed, 4 Dec 2019 01:11:41 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2943486A08; Tue, 3 Dec 2019 14:11:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3dIv3vi-zQFS; Tue, 3 Dec 2019 14:11:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9BF9986A47; Tue, 3 Dec 2019 14:11:37 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 837C6C1DE2; Tue, 3 Dec 2019 14:11:37 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 891C7C087F for ; Tue, 3 Dec 2019 14:11:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 75A0A87877 for ; Tue, 3 Dec 2019 14:11:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0vxkomPGW4Cx for ; Tue, 3 Dec 2019 14:11:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by hemlock.osuosl.org (Postfix) with ESMTP id 3937A8757D for ; Tue, 3 Dec 2019 14:11:35 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from roid@mellanox.com) with ESMTPS (AES256-SHA encrypted); 3 Dec 2019 16:11:32 +0200 Received: from dev-r-vrt-139.mtr.labs.mlnx (dev-r-vrt-139.mtr.labs.mlnx [10.212.139.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id xB3EBVkT022661; Tue, 3 Dec 2019 16:11:31 +0200 From: Roi Dayan To: dev@openvswitch.org Date: Tue, 3 Dec 2019 16:11:21 +0200 Message-Id: <20191203141121.464-1-roid@mellanox.com> X-Mailer: git-send-email 2.8.4 Cc: Simon Horman , Dmytro Linkin Subject: [ovs-dev] [PATCH v2] ofproto-dpif-xlate: Prevent duplicating of traffic to a mirror port 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" From: Dmytro Linkin Currently ofproto design disallow duplicating output packet on forwarding and mirroring to/from same ovs port. Next scenario reveal lack of design: 1. Send ping between regular ovs ports (VFs, for ex.), stop it. 2. While rule still exist, make mirror for one of the ports. Prevent duplicating of traffic to a mirror port. Fixes: 86e2dcddce85 ("dpif-xlate: Snoop multicast packets and send them properly") Signed-off-by: Dmytro Linkin Acked-by: Roi Dayan --- changlog v2: - remove one redundant warnng and update the second. - remove the redundant comment as its the same as the error print. ofproto/ofproto-dpif-xlate.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 7e55575b183a..daf7fec80c9e 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -3118,6 +3118,13 @@ xlate_normal(struct xlate_ctx *ctx) if (mac_port) { struct xbundle *mac_xbundle = xbundle_lookup(ctx->xcfg, mac_port); + + if (mac_xbundle && xbundle_mirror_out(ctx->xbridge, mac_xbundle)) { + xlate_report(ctx, OFT_WARN, + "learned port is a mirror port, dropping"); + return; + } + if (mac_xbundle && mac_xbundle != in_xbundle && mac_xbundle->ofbundle != in_xbundle->ofbundle) {