From patchwork Tue Apr 23 11:53:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1926507 X-Patchwork-Delegate: nusiddiq@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=KJNRACvQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP0rj5fzQz1yP2 for ; Tue, 23 Apr 2024 21:53:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 35C6581FBB; Tue, 23 Apr 2024 11:53:55 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id OiLZOlmCp3aN; Tue, 23 Apr 2024 11:53:54 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 5ABBE802D5 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KJNRACvQ Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 5ABBE802D5; Tue, 23 Apr 2024 11:53:41 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C6CB9C0DD4; Tue, 23 Apr 2024 11:53:40 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 98DDDC0037 for ; Tue, 23 Apr 2024 11:53:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 86B224114E for ; Tue, 23 Apr 2024 11:53:38 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 40YJK_WEX7JR for ; Tue, 23 Apr 2024 11:53:37 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 10093400D9 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 10093400D9 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KJNRACvQ Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 10093400D9 for ; Tue, 23 Apr 2024 11:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713873215; 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: in-reply-to:in-reply-to:references:references; bh=AZtLRxrfUMrMVBG8d9WGPlY0ip5Ia7v1yBvNJZEl/Ik=; b=KJNRACvQs8jO4lmKFhZM91dYqQQIHlti8f+iIF9RTcOtDKErFBVNIfNnEm4mOvrJ9XPKQq orutISy3oylMaH4kD1eHfdwFzDI9SEUZz4PUW13xi0m+r9TTExV/G69tlPMYzHyIZeBfhC GqWAEdJxYPqS/8wvikXt6izGP+YGBVM= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-563-0HQOkx22OG-Mx6NFndQEdw-1; Tue, 23 Apr 2024 07:53:34 -0400 X-MC-Unique: 0HQOkx22OG-Mx6NFndQEdw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2D0429ABA11 for ; Tue, 23 Apr 2024 11:53:33 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.anl.eng.rdu2.dc.redhat.com [10.6.38.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBAC640C465; Tue, 23 Apr 2024 11:53:33 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 23 Apr 2024 13:53:30 +0200 Message-Id: <20240423115333.2796843-3-xsimonar@redhat.com> In-Reply-To: <20240423115333.2796843-1-xsimonar@redhat.com> References: <20240423115333.2796843-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 2/5] controller: Nonvif related lports handling. 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 patches fixes flows not properly deleted in scenarios similar to: foo1 (hv1) - foo - R1 - join - R2 (chassis = hv2) - alice - alice1 (hv2). When R2 is deleted, alice_R2 changed from l3gateway to patch, and, on hv1, alice_R2 was added to related ports. When R2 was added back (together with R2-alice and R2-join), alice_R2 changed back from patch to l3gateway and alice_R2 remained in related_lports on hv1. This is now fixed: a l3_gateway port is not a related_port if not for our chassis. A test case has been modified to highlight the error, but also to make the test easier to read (e.g avoid using same name for a port and for a switch). Signed-off-by: Xavier Simonart Acked-by: Numan Siddique --- controller/binding.c | 12 ++++++++---- tests/ovn.at | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index c9658cb2a..3b36ed881 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -1824,7 +1824,7 @@ consider_localport(const struct sbrec_port_binding *pb, */ static bool consider_nonvif_lport_(const struct sbrec_port_binding *pb, - bool our_chassis, + bool our_chassis, bool is_ha_chassis, struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) { @@ -1844,6 +1844,9 @@ consider_nonvif_lport_(const struct sbrec_port_binding *pb, b_ctx_out->if_mgr, b_ctx_out->postponed_ports); } + if (!is_ha_chassis) { + remove_related_lport(pb, b_ctx_out); + } if (pb->chassis == b_ctx_in->chassis_rec || is_additional_chassis(pb, b_ctx_in->chassis_rec) @@ -1867,7 +1870,7 @@ consider_l2gw_lport(const struct sbrec_port_binding *pb, bool our_chassis = chassis_id && !strcmp(chassis_id, b_ctx_in->chassis_rec->name); - return consider_nonvif_lport_(pb, our_chassis, b_ctx_in, b_ctx_out); + return consider_nonvif_lport_(pb, our_chassis, false, b_ctx_in, b_ctx_out); } static bool @@ -1879,7 +1882,7 @@ consider_l3gw_lport(const struct sbrec_port_binding *pb, bool our_chassis = chassis_id && !strcmp(chassis_id, b_ctx_in->chassis_rec->name); - return consider_nonvif_lport_(pb, our_chassis, b_ctx_in, b_ctx_out); + return consider_nonvif_lport_(pb, our_chassis, false, b_ctx_in, b_ctx_out); } static void @@ -1942,7 +1945,8 @@ consider_ha_lport(const struct sbrec_port_binding *pb, update_related_lport(pb, b_ctx_out); } - return consider_nonvif_lport_(pb, our_chassis, b_ctx_in, b_ctx_out); + return consider_nonvif_lport_(pb, our_chassis, is_ha_chassis, b_ctx_in, + b_ctx_out); } static bool diff --git a/tests/ovn.at b/tests/ovn.at index f974cbb15..3c888aaf5 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -7781,9 +7781,9 @@ ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \ type=router options:router-port=foo addresses=\"00:00:01:01:02:03\" # Connect alice to R2 -ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24 -ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \ - type=router options:router-port=alice addresses=\"00:00:02:01:02:03\" +ovn-nbctl lrp-add R2 R2-alice 00:00:02:01:02:03 172.16.1.1/24 +ovn-nbctl lsp-add alice alice-R2 -- set Logical_Switch_Port alice-R2 \ + type=router options:router-port=R2-alice addresses=\"00:00:02:01:02:03\" # Connect R1 to join ovn-nbctl lrp-add R1 R1_join 00:00:04:01:02:03 20.0.0.1/24 @@ -7871,11 +7871,13 @@ echo "----------------------------" echo $expected > expected OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) +CHECK_FLOWS_AFTER_RECOMPUTE([hv1], [hv1]) + # Delete the router and re-create it. Things should work as before. ovn-nbctl lr-del R2 ovn-nbctl create Logical_Router name=R2 options:chassis="hv2" # Connect alice to R2 -ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24 +ovn-nbctl lrp-add R2 R2-alice 00:00:02:01:02:03 172.16.1.1/24 # Connect R2 to join ovn-nbctl lrp-add R2 R2_join 00:00:04:01:02:04 20.0.0.2/24 @@ -7887,6 +7889,8 @@ R2 static_routes @lrt wait_for_ports_up check ovn-nbctl --wait=hv sync +CHECK_FLOWS_AFTER_RECOMPUTE([hv1], [hv1]) + # Send the packet again. as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet