From patchwork Tue Feb 15 19:04:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1593223 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=EgkK14lv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 4JyrBb5qFkz9s0B for ; Wed, 16 Feb 2022 06:05:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E65C4829BB; Tue, 15 Feb 2022 19:05:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org 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 0ZoW5pREKVV2; Tue, 15 Feb 2022 19:05:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 32BDD812DC; Tue, 15 Feb 2022 19:05:07 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 16D96C001A; Tue, 15 Feb 2022 19:05:07 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id D031CC000B for ; Tue, 15 Feb 2022 19:05:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id B04DB40385 for ; Tue, 15 Feb 2022 19:05:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mOT3CVaxcD3E for ; Tue, 15 Feb 2022 19:05:04 +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.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 7008040018 for ; Tue, 15 Feb 2022 19:05:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644951903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NsvJahfUUsubNJAp4sIhel1qX747Gw553iACi2nlIcY=; b=EgkK14lvLp75iIX4pCzKWpJpGrXQkxRqVx/BjLOs2XWOhKFXLT3mcr1vFh+OgvDoo4opij jW31+cKNXGuBsFIgwwMDCAO53HmBI8+9tLYdK7qVXGx9bJhEptOuedMIZvef++S6H9ZLcQ 9RjyvM/At436EDhfHiTTFJwEHDxPHVA= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-460-QWLEuQD-NK6-56rw3k51Vg-1; Tue, 15 Feb 2022 14:05:02 -0500 X-MC-Unique: QWLEuQD-NK6-56rw3k51Vg-1 Received: by mail-wr1-f72.google.com with SMTP id v9-20020adfa1c9000000b001e33e5dbd5fso8786942wrv.17 for ; Tue, 15 Feb 2022 11:05:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=NsvJahfUUsubNJAp4sIhel1qX747Gw553iACi2nlIcY=; b=BgpWPcQziR3fqul84+a2YEZ8ovq0ey65vU2/WaQBCaDvzXwd/18+AnHxV5eUx7UhnO lwD3IAO/ZgrodYudYqcuE28idKqqsAG/S2k4ugM34BkkXKCU2tpETspolj6X0QhxR+KW WEmxAxMD4jwiTBjGXlobIrq27h9yMVQyF0aGDstSuv+txZJ2EM06PaF+Gkw7tn4YcAgV KqTZswFGCkKMnTSlUS+Vkb0DO2hOdS0U8UFyhp0JburBPe3uQgwV/LTi/VRnMRejRw1N T87cGKbNkRwR+V7bKkkM5X3ywmwnLqKMozQdYMt0fcmykD5iGEZUXy+52sUQt0L7NtNC IO3A== X-Gm-Message-State: AOAM53090qvBIvQnOLya/J9aBT38/c+PR4SPZZKCuD6WrGMH3w58AXRp BKH2eHS3QkfnRH/W/ZGknXS/v+VbRFCCENP8Wjnks92/WlAApo03OH6B02fcGwrZslkIAd+Hudh e3LtTfsXYaQE0kkqkc9JBaik5UwLCtWNPRBydt9ZkHHTtozLHPbaNdhS/PNTA2I7lEgCElh8qDR JwvflO X-Received: by 2002:a7b:cd86:: with SMTP id y6mr367815wmj.10.1644951900752; Tue, 15 Feb 2022 11:05:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRE7y7UhY9qHE4QjLkYUihfXgWGXJuukK0SxCWyZXWCxwTgscx/5MKEqZD47iWLDvB7jhc6A== X-Received: by 2002:a7b:cd86:: with SMTP id y6mr367796wmj.10.1644951900435; Tue, 15 Feb 2022 11:05:00 -0800 (PST) Received: from lore-desk.redhat.com (net-37-182-17-113.cust.vodafonedsl.it. [37.182.17.113]) by smtp.gmail.com with ESMTPSA id n5sm16640663wrm.3.2022.02.15.11.04.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 11:05:00 -0800 (PST) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Tue, 15 Feb 2022 20:04:52 +0100 Message-Id: <9c27b067a4779d431c19886d1cecdf655872a6dc.1644951848.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lorenzo.bianconi@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] northd: allow explicit nat-addresses for distributed gw ports 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" Allow the CMS to explicitly configure nat addresses to use in GARP advertising even if the logical switch port is connected to a distributed gateway router port. Signed-off-by: Lorenzo Bianconi --- northd/northd.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index 861812259..4f9c10648 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -3373,6 +3373,8 @@ ovn_port_update_sbrec(struct northd_input *input_data, "nat-addresses"); size_t n_nats = 0; char **nats = NULL; + bool l3dgw_ports = op->peer && op->peer->od && + op->peer->od->n_l3dgw_ports; if (nat_addresses && !strcmp(nat_addresses, "router")) { if (op->peer && op->peer->od && (chassis || op->peer->od->n_l3dgw_ports)) { @@ -3380,17 +3382,24 @@ ovn_port_update_sbrec(struct northd_input *input_data, } /* Only accept manual specification of ethernet address * followed by IPv4 addresses on type "l3gateway" ports. */ - } else if (nat_addresses && chassis) { + } else if (nat_addresses && (chassis || l3dgw_ports)) { struct lport_addresses laddrs; if (!extract_lsp_addresses(nat_addresses, &laddrs)) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); VLOG_WARN_RL(&rl, "Error extracting nat-addresses."); } else { + struct ds data = DS_EMPTY_INITIALIZER; + ds_put_format(&data, "%s", nat_addresses); + if (l3dgw_ports) { + ds_put_format(&data, " is_chassis_resident(%s)", + op->peer->od->l3dgw_ports[0]->cr_port->json_key); + } destroy_lport_addresses(&laddrs); n_nats = 1; nats = xcalloc(1, sizeof *nats); - nats[0] = xstrdup(nat_addresses); + nats[0] = xstrdup(ds_cstr(&data)); + ds_destroy(&data); } }