From patchwork Tue Aug 27 12:55:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1977303 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=iupj4gvV; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 4WtSGN3813z1yh3 for ; Tue, 27 Aug 2024 22:56:12 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C71DE60819; Tue, 27 Aug 2024 12:56:07 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id TbqF5qpxKsl0; Tue, 27 Aug 2024 12:56:06 +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 smtp3.osuosl.org A3934607B6 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=iupj4gvV Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id A3934607B6; Tue, 27 Aug 2024 12:56:06 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5CC61C07E7; Tue, 27 Aug 2024 12:56:06 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3656BC07E6 for ; Tue, 27 Aug 2024 12:56:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 179F940395 for ; Tue, 27 Aug 2024 12:56:02 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 4nwhOILBAZHb for ; Tue, 27 Aug 2024 12:56:00 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 887F0402A1 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 887F0402A1 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=iupj4gvV Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 887F0402A1 for ; Tue, 27 Aug 2024 12:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724763359; 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=dW2aZGxE0viFiVdNzlBtzb+/oFh5TkphbATCao5RWDg=; b=iupj4gvVp4LLUbMt6FLGUG2YYhkSf1Rs9mzjqRFrKL098GqMyT3DIgknTij31WJbTB10rh mCU4GHu9KgOWf4zgdSulWkjl4Vz8dV0V2/Sixhjin0uApJOotUjWmFy0QyVHiPo2sZmVM+ zbh0D+uCJmBEHvgAbp6bTeayEQjXwFo= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-486-C2PfkZ9CNuetrLIUx8X23g-1; Tue, 27 Aug 2024 08:55:58 -0400 X-MC-Unique: C2PfkZ9CNuetrLIUx8X23g-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4790B1955D48 for ; Tue, 27 Aug 2024 12:55:57 +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 mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4BC631955BE1; Tue, 27 Aug 2024 12:55:56 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 27 Aug 2024 14:55:51 +0200 Message-Id: <20240827125554.3137819-2-xsimonar@redhat.com> In-Reply-To: <20240827125554.3137819-1-xsimonar@redhat.com> References: <20240827125554.3137819-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 1/4] ovn-ic: Do not try to advertise lla next_hops. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Since [1] we do not learn routes with link-local next-hops. However, routes with lla next hops were still created and deleted from ovn-ic-sb, causing high cpu usage on ovn-ic and ovn-sc-sb, as well as high traffic on physical interface. [1] cb0e2b3f44da ("ovn-ic: do not learn routes with link-local next-hops") Reported-at: https://issues.redhat.com/browse/FDP-619 Signed-off-by: Xavier Simonart --- ic/ovn-ic.c | 5 +++ tests/ovn-ic.at | 114 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 69bac4ab2..e91010892 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -1227,6 +1227,11 @@ add_network_to_routes_ad(struct hmap *routes_ad, const char *network, return; } + if (in6_is_lla(&nexthop)) { + VLOG_DBG("Route ad: skip lla nexthop of lrp %s.", nb_lrp->name); + return; + } + if (VLOG_IS_DBG_ENABLED()) { struct ds msg = DS_EMPTY_INITIALIZER; diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index 8497cb194..4c0415d63 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -2342,3 +2342,117 @@ OVN_CLEANUP_SBOX([hv2], ["/IGMP Querier enabled without a valid IPv4/d OVN_CLEANUP_IC([az1],[az2]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([interconnection - LLA]) +AT_KEYWORDS([IP]) + +# Logical network: +# +# AZ1 | AZ2 +# --------------------------------------------------------------------- +# LS1P1 --- LS1 --- LR1 --- TS --- LR2 --- LS2 --- LS2P1 +# --------------------------------------------------------------------- +# + +ovn_init_ic_db +ovn_start az1 +ovn_start az2 + +net_add n1 + +sim_add hv1 +as hv1 +check ovs-vsctl add-br br-phys +ovn_az_attach az1 n1 br-phys 192.168.1.1 16 +check ovs-vsctl -- add-port br-int hv1-vif1 \ + -- set interface hv1-vif1 external-ids:iface-id=ls1p1 \ + options:tx_pcap=hv1/vif1-tx.pcap \ + options:rxq_pcap=hv1/vif1-rx.pcap +check ovs-vsctl set open . external-ids:ovn-is-interconn=true + +sim_add hv2 +as hv2 +check ovs-vsctl add-br br-phys +ovn_az_attach az2 n1 br-phys 192.168.2.1 16 +check ovs-vsctl -- add-port br-int hv2-vif1 \ + -- set interface hv2-vif1 external-ids:iface-id=ls2p1 \ + options:tx_pcap=hv2/vif1-tx.pcap \ + options:rxq_pcap=hv2/vif1-rx.pcap +check ovs-vsctl set open . external-ids:ovn-is-interconn=true + +AT_CHECK([ovn-ic-nbctl --wait=sb create Transit_Switch name=ts1], [0], [ignore]) +check ovn_as az1 ovn-nbctl wait-until logical_switch ts1 +check ovn_as az2 ovn-nbctl wait-until logical_switch ts1 + +ovn_as az1 +check ovn-nbctl lr-add lr1 \ + -- lrp-add lr1 lr1-ts1 00:aa:aa:aa:aa:01 169.254.100.1/24 169:254:100::1/64 \ + -- lrp-add lr1 lr1-ls1 00:00:00:00:01:fe 172.16.1.254/24 172:16:1::254/64\ + -- lrp-set-gateway-chassis lr1-ts1 hv1 +check ovn-nbctl ls-add ls1 \ + -- lsp-add ls1 ls1-lr1 \ + -- lsp-set-addresses ls1-lr1 router \ + -- lsp-set-type ls1-lr1 router \ + -- lsp-set-options ls1-lr1 router-port=lr1-ls1 \ + -- lsp-add ls1 ls1p1 +check ovn-nbctl lsp-add ts1 ts1-lr1 \ + -- lsp-set-addresses ts1-lr1 router \ + -- lsp-set-type ts1-lr1 router \ + -- lsp-set-options ts1-lr1 router-port=lr1-ts1 +wait_for_ports_up + +ovn_as az2 +check ovn-nbctl lr-add lr2 \ + -- lrp-add lr2 lr2-ts1 00:aa:aa:aa:aa:02 169.254.100.2/24 169:254:100::2/64 \ + -- lrp-add lr2 lr2-ls2 00:00:00:00:02:fe 172.16.2.254/24 172:16:2::254/64 \ + -- lrp-set-gateway-chassis lr2-ts1 hv2 +check ovn-nbctl ls-add ls2 \ + -- lsp-add ls2 ls2-lr2 \ + -- lsp-set-addresses ls2-lr2 router \ + -- lsp-set-type ls2-lr2 router \ + -- lsp-set-options ls2-lr2 router-port=lr2-ls2 \ + -- lsp-add ls2 ls2p1 +check ovn-nbctl lsp-add ts1 ts1-lr2 \ + -- lsp-set-addresses ts1-lr2 router \ + -- lsp-set-type ts1-lr2 router \ + -- lsp-set-options ts1-lr2 router-port=lr2-ts1 + +wait_for_ports_up +check ovn-ic-nbctl --wait=sb sync + +ovn_as az1 +check ovn-nbctl lrp-set-gateway-chassis lr1-ts1 hv1 +check ovn-nbctl set NB_Global . options:ic-route-adv=true options:ic-route-learn=true + +ovn_as az2 +check ovn-nbctl lrp-set-gateway-chassis lr2-ts1 hv2 +check ovn-nbctl set NB_Global . options:ic-route-adv=true options:ic-route-learn=true + +check ovn_as az1 ovn-nbctl --wait=hv sync +check ovn_as az2 ovn-nbctl --wait=hv sync + +# Pre-populate the hypervisors' ARP tables so that we don't lose any +# packets for ARP resolution (native tunneling doesn't queue packets +# for ARP resolution). +OVN_POPULATE_ARP + +ovn_as az1 check ovn-nbctl remove logical_router_port lr1-ts1 networks "169\:254\:100\:\:1/64" + +# ic-sb route should not contain lla next hops. +# Such routes used to be created and deleted in ic-sb. +# Do not use OVS_WAIT_WHILE or WAIT_UNTIL as the wrong (lla) route appears and disappears. +for i in $(seq 1 50); do + AT_CHECK([ovn-ic-sbctl list route | grep "fe80:"], [1]) +done + +OVN_CLEANUP_SBOX([hv1]) + +OVN_CLEANUP_SBOX([hv2]) + +OVN_CLEANUP_IC([az1],[az2]) +AT_CLEANUP +]) + + + From patchwork Tue Aug 27 12:55:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1977301 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=fAxkvc7s; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WtSGK3SLyz1yg0 for ; Tue, 27 Aug 2024 22:56:09 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8F5FE6066E; Tue, 27 Aug 2024 12:56:05 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id TkV43YUeNULp; Tue, 27 Aug 2024 12:56:04 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4817960808 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=fAxkvc7s Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 4817960808; Tue, 27 Aug 2024 12:56:04 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D7AE8C07EA; Tue, 27 Aug 2024 12:56:03 +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 CC9F9C07E6 for ; Tue, 27 Aug 2024 12:56:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B9A7C80F85 for ; Tue, 27 Aug 2024 12:56:01 +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 MBukXSdjS2F8 for ; Tue, 27 Aug 2024 12:56:01 +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 smtp1.osuosl.org EE41180EEA Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org EE41180EEA 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=fAxkvc7s 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 EE41180EEA for ; Tue, 27 Aug 2024 12:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724763359; 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=XnxF7mLGxqrqFYk4/Vt6FcQ7fYrH+oHx8zduQrz2/m8=; b=fAxkvc7sHXfh94xlu4tsylcIqBUlvu91Dl3uTVUffKUC02P5vj8eTQTi54gU/BXls+oY+T Z9MMVAJqdPzCKBSSGFPrdIQxOg5k2Mm/L+YyPBsgMyI28T4GoQd66CZyGjmoICn0TQ0t2M JGeNG9zhSOKdyCbugm3qMDtm2XzQYmI= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-Iah4_AmEPXqX-N9HENVnVQ-1; Tue, 27 Aug 2024 08:55:58 -0400 X-MC-Unique: Iah4_AmEPXqX-N9HENVnVQ-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DD2871955D4D for ; Tue, 27 Aug 2024 12:55:57 +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 mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 22A981955F1B; Tue, 27 Aug 2024 12:55:57 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 27 Aug 2024 14:55:52 +0200 Message-Id: <20240827125554.3137819-3-xsimonar@redhat.com> In-Reply-To: <20240827125554.3137819-1-xsimonar@redhat.com> References: <20240827125554.3137819-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 2/4] ovn-ic: Fix potential segmentation violation. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" ERROR: AddressSanitizer: SEGV on unknown address 0x000000000020 (pc 0x000000709f68 bp 0x7ffe8546c9b0 sp 0x7ffe8546c9b0 T0) 0 0x709f68 in hmap_insert_fast ./ovs/./include/openvswitch/hmap.h 1 0x702611 in hmap_insert_at ./ovs/./include/openvswitch/hmap.h:307:5 2 0x70444c in ovsdb_idl_txn_write__ ./ovs/lib/ovsdb-idl.c:3631:9 3 0x704141 in ovsdb_idl_txn_write ./ovs/lib/ovsdb-idl.c:3688:5 4 0x6c1cd1 in icsbrec_availability_zone_set_name ./lib/ovn-ic-sb-idl.c:395:5 5 0x5a7f1e in az_run ./ic/ovn-ic.c:144:17 6 0x5a7f1e in main ./ic/ovn-ic.c:2323:62 7 0x7fc605b6db74 in __libc_start_main (/lib64/libc.so.6+0x27b74) 8 0x4c8fed in _start (/root/master-ovn/ic/ovn-ic+0x4c8fed) Fixes: 37fd1dd378ea ("ovn-ic: Handle NB:name updates properly.") Signed-off-by: Xavier Simonart --- ic/ovn-ic.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index e91010892..84d2ed5a4 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -137,19 +137,21 @@ az_run(struct ic_context *ctx) * "ovn-ic-sbctl destroy avail ". */ static char *az_name; const struct icsbrec_availability_zone *az; - if (az_name && strcmp(az_name, nb_global->name)) { - ICSBREC_AVAILABILITY_ZONE_FOR_EACH (az, ctx->ovnisb_idl) { - /* AZ name update locally need to update az in ISB. */ - if (nb_global->name[0] && !strcmp(az->name, az_name)) { - icsbrec_availability_zone_set_name(az, nb_global->name); - break; - } else if (!nb_global->name[0] && !strcmp(az->name, az_name)) { - icsbrec_availability_zone_delete(az); - break; + if (ctx->ovnisb_txn) { + if (az_name && strcmp(az_name, nb_global->name)) { + ICSBREC_AVAILABILITY_ZONE_FOR_EACH (az, ctx->ovnisb_idl) { + /* AZ name update locally need to update az in ISB. */ + if (nb_global->name[0] && !strcmp(az->name, az_name)) { + icsbrec_availability_zone_set_name(az, nb_global->name); + break; + } else if (!nb_global->name[0] && !strcmp(az->name, az_name)) { + icsbrec_availability_zone_delete(az); + break; + } } + free(az_name); + az_name = NULL; } - free(az_name); - az_name = NULL; } if (!nb_global->name[0]) { From patchwork Tue Aug 27 12:55:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1977302 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=ZMsr2Fbm; 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 4WtSGN0L3Hz1yg0 for ; Tue, 27 Aug 2024 22:56:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6718481100; Tue, 27 Aug 2024 12:56:10 +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 UmNkTUhrpDHe; Tue, 27 Aug 2024 12:56:09 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4327D8100F 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=ZMsr2Fbm Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4327D8100F; Tue, 27 Aug 2024 12:56:09 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7E89EC07ED; Tue, 27 Aug 2024 12:56:08 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4266CC07E7 for ; Tue, 27 Aug 2024 12:56:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1B06680EEA for ; Tue, 27 Aug 2024 12:56:02 +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 MgG-8gbC8-Su for ; Tue, 27 Aug 2024 12:56:01 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 6E6B980F1B Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6E6B980F1B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6E6B980F1B for ; Tue, 27 Aug 2024 12:56:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724763360; 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=rdGN0clUUZKww1sqaHYDE6dIUO+AchtuZCKGhavg8Rc=; b=ZMsr2FbmuGmlXs8uMiOsoivaiwMcP6uouDZLXqkUprF38AXZgssbeb20PCRoSJG5um0WOy xZm1tr+Wi6vB2h60rHKbuVPa9Xg0AZnoJNY8d4+RxVsv310YdVKmgNkYBdPtsRPI/uWxDM Q85Zc+AR/Qn359I3W3YvTsnct9rWZLA= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-496-tMuozJ2yPhKc41CcJz9cUg-1; Tue, 27 Aug 2024 08:55:59 -0400 X-MC-Unique: tMuozJ2yPhKc41CcJz9cUg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 61DEC1955D42 for ; Tue, 27 Aug 2024 12:55:58 +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 mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D43B51955DD6; Tue, 27 Aug 2024 12:55:57 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 27 Aug 2024 14:55:53 +0200 Message-Id: <20240827125554.3137819-4-xsimonar@redhat.com> In-Reply-To: <20240827125554.3137819-1-xsimonar@redhat.com> References: <20240827125554.3137819-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 3/4] ovn-ic: Fix debugging log. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Xavier Simonart Acked-by: Ales Musil --- ic/ovn-ic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 84d2ed5a4..18d1df039 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -2338,7 +2338,7 @@ main(int argc, char *argv[]) if (!rc1 || !rc2 || !rc3 || !rc4) { VLOG_DBG(" a transaction failed in: %s %s %s %s", !rc1 ? "nb" : "", !rc2 ? "sb" : "", - !rc3 ? "ic_nb" : "", rc4 ? "ic_sb" : ""); + !rc3 ? "ic_nb" : "", !rc4 ? "ic_sb" : ""); /* A transaction failed. Wake up immediately to give * opportunity to send the proper transaction */ From patchwork Tue Aug 27 12:55:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1977304 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=cz6/01+t; 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 4WtSGT1ycrz1yg0 for ; Tue, 27 Aug 2024 22:56:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 74E0D81160; Tue, 27 Aug 2024 12:56:15 +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 w0Ub2lHmoyhQ; Tue, 27 Aug 2024 12:56:12 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1B2FD81136 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=cz6/01+t Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1B2FD81136; Tue, 27 Aug 2024 12:56:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 92177C07EA; Tue, 27 Aug 2024 12:56:10 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id F0335C07EB for ; Tue, 27 Aug 2024 12:56:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C0290607B8 for ; Tue, 27 Aug 2024 12:56:03 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id JHojOvAbM82L for ; Tue, 27 Aug 2024 12:56:02 +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 smtp3.osuosl.org 22B766063A Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 22B766063A 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=cz6/01+t Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 22B766063A for ; Tue, 27 Aug 2024 12:56:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724763361; 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=z73eB8x0HpY/5v12b/fXXi8Nr6Pn+UP86Yn4scFr1Ec=; b=cz6/01+t7pfELH1yRl72OpvJBmUqVwuqdKF/JbKkj+s8nRNDnvvW/XHLeNi0OxAALjCl0p QDAjtIHSpwoCbkEOFK47JwdqMfvMpTTz4Nd+U2jnBMl3I5QyiOc/sMvL276aV9ekceo9SN yU3521weJLIm9G16CZo5yi3JNA5gOes= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-83-OYwjc3XnPvm8LXuzhtv0oQ-1; Tue, 27 Aug 2024 08:55:59 -0400 X-MC-Unique: OYwjc3XnPvm8LXuzhtv0oQ-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 32BDA1955F2D for ; Tue, 27 Aug 2024 12:55:59 +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 mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9429E1955F1B; Tue, 27 Aug 2024 12:55:58 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 27 Aug 2024 14:55:54 +0200 Message-Id: <20240827125554.3137819-5-xsimonar@redhat.com> In-Reply-To: <20240827125554.3137819-1-xsimonar@redhat.com> References: <20240827125554.3137819-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 4/4] ovn-ic: Fix memory leak. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Direct leak of 64 byte(s) in 1 object(s) allocated from: 0 0x56f127 in calloc (/root/master-ovn/ic/ovn-ic+0x56f127) 1 0x731de2 in xcalloc__ /root/master-ovn/ovs/lib/util.c:125:31 2 0x731e10 in xzalloc__ /root/master-ovn/ovs/lib/util.c:135:12 3 0x731ed5 in xzalloc /root/master-ovn/ovs/lib/util.c:169:12 4 0x706139 in ovsdb_idl_txn_add_map_op /root/master-ovn/ovs/lib/ovsdb-idl.c:4178:29 5 0x705ff8 in ovsdb_idl_txn_write_partial_map /root/master-ovn/ovs/lib/ovsdb-idl.c:4335:5 6 0x5b2f67 in update_isb_pb_external_ids /root/master-ovn/ic/ovn-ic.c:588:5 7 0x5ab08e in create_isb_pb /root/master-ovn/ic/ovn-ic.c:733:5 8 0x5ab08e in port_binding_run /root/master-ovn/ic/ovn-ic.c:821:21 9 0x5ab08e in ovn_db_run /root/master-ovn/ic/ovn-ic.c:1901:5 10 0x5a8143 in main /root/master-ovn/ic/ovn-ic.c:2337:21 11 0x7f58bd0f9b74 in __libc_start_main (/lib64/libc.so.6+0x27b74) This happens when, in a single transaction, we run something like - isb_pb = icsbrec_port_binding_insert(ctx->ovnisb_txn); - icsbrec_port_binding_update_external_ids_setkey(isb_pb, "router-id",uuid_s); - icsbrec_port_binding_delete(isb_pb) Signed-off-by: Xavier Simonart --- ic/ovn-ic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 18d1df039..dfefa538e 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -121,6 +121,9 @@ Options:\n\ stream_usage("database", true, true, false); } +static const char * +get_lrp_name_by_ts_port_name(struct ic_context *ctx, const char *ts_port_name); + static const struct icsbrec_availability_zone * az_run(struct ic_context *ctx) { @@ -710,13 +713,19 @@ create_isb_pb(struct ic_context *ctx, const char *ts_name, uint32_t pb_tnl_key) { + if (!get_lrp_name_by_ts_port_name(ctx, sb_pb->logical_port)) { + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); + VLOG_WARN_RL(&rl, "ignoring port %s on ts %s because " + "logical router port is not found in NB.", + sb_pb->logical_port, ts_name); + return; + } const struct icsbrec_port_binding *isb_pb = icsbrec_port_binding_insert(ctx->ovnisb_txn); icsbrec_port_binding_set_availability_zone(isb_pb, az); icsbrec_port_binding_set_transit_switch(isb_pb, ts_name); icsbrec_port_binding_set_logical_port(isb_pb, sb_pb->logical_port); icsbrec_port_binding_set_tunnel_key(isb_pb, pb_tnl_key); - const char *address = get_lrp_address_for_sb_pb(ctx, sb_pb); if (address) { icsbrec_port_binding_set_address(isb_pb, address);