From patchwork Fri Aug 19 15:44:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1668217 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) 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=g15oCVc0; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4M8Qzl2yj2z1ygl for ; Sat, 20 Aug 2022 01:44:35 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A60A3611B1; Fri, 19 Aug 2022 15:44:33 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org A60A3611B1 Authentication-Results: smtp3.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=g15oCVc0 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 vRkMwcjoeD3g; Fri, 19 Aug 2022 15:44:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id F06B960774; Fri, 19 Aug 2022 15:44:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org F06B960774 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D5B61C0033; Fri, 19 Aug 2022 15:44:31 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7E488C002D for ; Fri, 19 Aug 2022 15:44:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 57B7684276 for ; Fri, 19 Aug 2022 15:44:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 57B7684276 Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=g15oCVc0 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 xz35dkcJfGoc for ; Fri, 19 Aug 2022 15:44:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A3F6C8406D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id A3F6C8406D for ; Fri, 19 Aug 2022 15:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660923868; 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=Ap0WyhDcbaQj8ZUg7HSuvldgMG66XsbTn7GxLQJ+G0o=; b=g15oCVc0fUqG+ZGNofzduRfEjEu7YXEmImS7/VoqeeQ0cjT/u1nanvpyTaaSvZ5TjxQfdn 7FoCZSOf5kTqpJsNZrbY7WHZpDE4JPSzJHUfbTImA9sKUgIbY3+Mvc0AuEAS20Oz/Ffpc+ go54ELGlu8a9Y4J+HPGyBL4SM5bCfZY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-351-TOUuh7-BNRCHp35QPq4_jw-1; Fri, 19 Aug 2022 11:44:27 -0400 X-MC-Unique: TOUuh7-BNRCHp35QPq4_jw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2EE9C3C025BB for ; Fri, 19 Aug 2022 15:44:27 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.ntdv.lab.eng.bos.redhat.com [10.19.188.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17396945D7; Fri, 19 Aug 2022 15:44:27 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Fri, 19 Aug 2022 11:44:26 -0400 Message-Id: <20220819154426.1099473-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] binding: fix missing localnet for local datapath 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" When a lrp option is set to always-redirect=false ("bridged" redirect type), local datapaths are properly updated. However, in some cases, when I+P is used, localnet ports attached to those datapaths were not properly updated. This results in missing flows and packets not going trough. This issue was catched by random failures in test case "Stateless Floating IP". Signed-off-by: Xavier Simonart --- controller/binding.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/controller/binding.c b/controller/binding.c index 9f5393a92..2722b87b7 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -2574,6 +2574,31 @@ consider_patch_port_for_local_datapaths(const struct sbrec_port_binding *pb, } } +static void +update_ld_ports(struct binding_ctx_in *b_ctx_in, + struct binding_ctx_out *b_ctx_out) +{ + const struct sbrec_port_binding *pb; + SBREC_PORT_BINDING_TABLE_FOR_EACH (pb, + b_ctx_in->port_binding_table) { + enum en_lport_type lport_type = get_lport_type(pb); + if (lport_type == LP_LOCALNET) { + struct shash bridge_mappings = + SHASH_INITIALIZER(&bridge_mappings); + add_ovs_bridge_mappings(b_ctx_in->ovs_table, + b_ctx_in->bridge_table, + &bridge_mappings); + update_ld_localnet_port(pb, &bridge_mappings, + b_ctx_out->egress_ifaces, + b_ctx_out->local_datapaths); + shash_destroy(&bridge_mappings); + } else if (lport_type == LP_EXTERNAL) { + update_ld_external_ports(pb, b_ctx_out->local_datapaths); + } + } +} + + static bool handle_updated_port(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out, @@ -2671,6 +2696,14 @@ handle_updated_port(struct binding_ctx_in *b_ctx_in, } consider_patch_port_for_local_datapaths(distributed_pb, b_ctx_in, b_ctx_out); + /* If option always-redirect has changed, check if localnet should + * be updated + */ + if (sbrec_port_binding_is_updated(pb, + SBREC_PORT_BINDING_COL_OPTIONS)) { + update_ld_ports(b_ctx_in, b_ctx_out); + } + break; case LP_EXTERNAL: