From patchwork Fri Aug 7 16:11:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aniket Bhat X-Patchwork-Id: 1342328 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.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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=hrgvLTU+; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BNVk41CS5z9sTN for ; Sat, 8 Aug 2020 02:12:12 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8A5CE25C36; Fri, 7 Aug 2020 16:12:08 +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 obyVVtNFiXYD; Fri, 7 Aug 2020 16:12:05 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id A281920396; Fri, 7 Aug 2020 16:12:04 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 75BECC0050; Fri, 7 Aug 2020 16:12:04 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 89E23C004C for ; Fri, 7 Aug 2020 16:12:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6D170886F3 for ; Fri, 7 Aug 2020 16:12:03 +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 w4ltLxTiOf-N for ; Fri, 7 Aug 2020 16:12:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by whitealder.osuosl.org (Postfix) with ESMTPS id B28B3888CA for ; Fri, 7 Aug 2020 16:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596816721; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type; bh=tF/6WqogUQpScTeXnuBJ3fEKAe+CxV2JGRqi9T5jFy8=; b=hrgvLTU+zkOvgg0xmWRYh7uFqVjQsbb8gcGsozBfP7NB+5okeaCVowOOosLO76kS+jk6m2 VWnjrnmlKL3WTkkUxy60NnIF4lYlPUSZ9HLdNRKCOo1JjgstdxdX40F6dWtRNV3YKdJJNy XRkUs/wa5bV9iHiBDcj3Vh9ApYkbEmM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-6tDpKsoiMHy8p5USB7SwFw-1; Fri, 07 Aug 2020 12:11:59 -0400 X-MC-Unique: 6tDpKsoiMHy8p5USB7SwFw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 11463801E6A for ; Fri, 7 Aug 2020 16:11:59 +0000 (UTC) Received: from atman-centos-dev.gsslab.rdu.redhat.com (dhcp-12-213-46.gsslab.rdu.redhat.com [10.12.213.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id C69015D9FC; Fri, 7 Aug 2020 16:11:58 +0000 (UTC) From: Aniket Bhat To: dev@openvswitch.org Date: Fri, 7 Aug 2020 12:11:56 -0400 Message-Id: <20200807161156.9438-1-anbhat@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=anbhat@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] Fix an issue with may-exist flag for lr_nat_add 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" This commit fixes a case where may-exist flag was not honored. When the nat type and logical ip both match for snat, but the external_ip is not the same, the may-exist flag was being ignored. Signed-off-by: Aniket Bhat --- utilities/ovn-nbctl.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c index e6d8dbe..8194414 100644 --- a/utilities/ovn-nbctl.c +++ b/utilities/ovn-nbctl.c @@ -4295,11 +4295,13 @@ nbctl_lr_nat_add(struct ctl_context *ctx) should_return = true; } } else { - ctl_error(ctx, "a NAT with this type (%s) and %s (%s) " - "already exists", - nat_type, - is_snat ? "logical_ip" : "external_ip", - is_snat ? new_logical_ip : new_external_ip); + if (!may_exist) { + ctl_error(ctx, "a NAT with this type (%s) and %s (%s) " + "already exists", + nat_type, + is_snat ? "logical_ip" : "external_ip", + is_snat ? new_logical_ip : new_external_ip); + } should_return = true; } }