[{"id":3659811,"web_url":"http://patchwork.ozlabs.org/comment/3659811/","msgid":"<aar1WDMvTIf6UwIx@lore-desk>","list_archive_url":null,"date":"2026-03-06T15:40:08","subject":"Re: [ovs-dev] [PATCH ovn v2] ic: Avoid learn the same prefix and\n nexthop in same TS.","submitter":{"id":73083,"url":"http://patchwork.ozlabs.org/api/people/73083/","name":"Lorenzo Bianconi","email":"lorenzo.bianconi@redhat.com"},"content":"> Avoid learned route loop if two differents AZs\n> configure the same address and adv the same prefix\n> in the same Transit Switch.\n> Do not remove the route from routes learned structure,\n> mark the route as not stale.\n\nHi Lucas,\n\nlooking at the testing scenario this seems mostly a configuration issue to me\nand the networking will not working properly even adding this patch right? E.g.\nBoth the routers will respond to ARP requests or snat the traffic with the same\nIP.\n\nSome comments inline.\nRegards,\nLorenzo\n\n> \n> Signed-off-by: Lucas Vargas Dias <lucas.vdias@luizalabs.com>\n> ---\n>  ic/ovn-ic.c     | 17 ++++++++------\n>  tests/ovn-ic.at | 60 +++++++++++++++++++++++++++++++++++++++++++++++++\n>  2 files changed, 70 insertions(+), 7 deletions(-)\n> \n> diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c\n> index 95d73cb4b..3f3c0d99d 100644\n> --- a/ic/ovn-ic.c\n> +++ b/ic/ovn-ic.c\n> @@ -1300,6 +1300,7 @@ struct ic_route_info {\n>      const struct nbrec_logical_router_static_route *nb_route;\n>      const struct nbrec_logical_router_port *nb_lrp;\n>      const struct nbrec_load_balancer *nb_lb;\n> +    bool stale; /* True if the route is stale and should be removed. */\n>  };\n>  \n>  static uint32_t\n> @@ -1393,6 +1394,7 @@ add_to_routes_learned(struct hmap *routes_learned,\n>      ic_route->origin = origin;\n>      ic_route->route_table = nb_route->route_table;\n>      ic_route->nb_lr = nb_lr;\n> +    ic_route->stale = true;\n>      hmap_insert(routes_learned, &ic_route->node,\n>                  ic_route_hash(&prefix, plen, &nexthop, origin,\n>                                nb_route->route_table));\n> @@ -2168,8 +2170,7 @@ sync_learned_routes(struct ic_context *ctx,\n>                          route_learned->nb_route, \"ic-learned-route\", uuid_s);\n>                      free(uuid_s);\n>                  }\n> -                hmap_remove(&ic_lr->routes_learned, &route_learned->node);\n> -                free(route_learned);\n> +                route_learned->stale = false;\n>              } else {\n>                  /* Create the missing route in NB. */\n>                  const struct nbrec_logical_router_static_route *nb_route =\n> @@ -2197,11 +2198,13 @@ sync_learned_routes(struct ic_context *ctx,\n>      /* Delete extra learned routes. */\n>      struct ic_route_info *route_learned;\n>      HMAP_FOR_EACH_SAFE (route_learned, node, &ic_lr->routes_learned) {\n> -        VLOG_DBG(\"Delete route %s -> %s that is not in IC-SB from NB.\",\n> -                 route_learned->nb_route->ip_prefix,\n> -                 route_learned->nb_route->nexthop);\n> -        nbrec_logical_router_update_static_routes_delvalue(\n> -            ic_lr->lr, route_learned->nb_route);\n> +        if (route_learned->stale) {\n> +            VLOG_DBG(\"Delete route %s -> %s that is not in IC-SB from NB.\",\n> +                     route_learned->nb_route->ip_prefix,\n> +                     route_learned->nb_route->nexthop);\n> +            nbrec_logical_router_update_static_routes_delvalue(\n> +                ic_lr->lr, route_learned->nb_route);\n> +        }\n>          hmap_remove(&ic_lr->routes_learned, &route_learned->node);\n>          free(route_learned);\n>      }\n> diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at\n> index 1a826aa1c..ead16aa91 100644\n> --- a/tests/ovn-ic.at\n> +++ b/tests/ovn-ic.at\n> @@ -3394,6 +3394,66 @@ OVN_CLEANUP_IC([az1], [az2])\n>  AT_CLEANUP\n>  ])\n>  \n> +OVN_FOR_EACH_NORTHD([\n> +AT_SETUP([ovn-ic -- check loop with LSP of duplicated address])\n> +\n> +ovn_init_ic_db\n> +\n> +for i in 1 2 3; do\n> +    ovn_start az$i\n> +    ovn_as az$i\n> +\n> +    # Enable route learning at AZ level\n> +    check ovn-nbctl set nb_global . options:ic-route-learn=true\n> +    # Enable route advertising at AZ level\n> +    check ovn-nbctl set nb_global . options:ic-route-adv=true\n> +done\n> +\n> +# Create new transit switches and LRs. Test topology is next:\n> +#                            logical router (lr12)\n> +#                                   |\n> +# logical router (lr11) -  / transit switch (ts11) \\ - logical router (lr13)\n> +#\n> +\n> +# Create lr11, lr13, ts11 and connect them\n> +for i in 1 3; do\n> +    ovn_as az$i\n> +\n> +    lr=lr1$i\n> +    check ovn-nbctl lr-add $lr\n> +\n> +    check ovn-ic-nbctl --wait=sb --may-exist ts-add ts11\n> +\n> +    lrp=lrp-$lr-ts11\n> +    lsp=lsp-ts11-$lr\n> +    # Create LRP and connect to TS\n> +    check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a1:0$i 169.254.101.1/24\n> +    check ovn-nbctl lsp-add-router-port ts11 $lsp $lrp\n> +done\n> +\n> +# Create lr12 and connect it to ts11\n> +ovn_as az2\n> +check ovn-nbctl lr-add lr12\n> +\n> +# Create LRP and connect to TS\n> +check ovn-nbctl lrp-add lr12 lrp-lr12-ts11 aa:aa:aa:aa:a1:03 169.254.101.2/24\n> +check ovn-nbctl lsp-add-router-port ts11 lsp-lr12-ts11 lrp-lr12-ts11\n> +\n> +\n> +# Create directly-connected route in lr11\n> +check ovn_as az1 ovn-nbctl lrp-add lr11 lrp-lr11 aa:aa:aa:aa:bb:01 \"192.168.0.1/24\"\n> +check ovn_as az3 ovn-nbctl lrp-add lr13 lrp-lr13 aa:aa:aa:aa:bb:03 \"192.168.0.1/24\"\n> +sleep 2\n\nI guess you do not need this sleep\n\n> +OVS_WAIT_FOR_OUTPUT([ovn_as az2 ovn-nbctl lr-route-list lr12 | grep 192.168 |\n> +             grep learned | awk '{print $1, $2}' | sort ], [0], [dnl\n> +192.168.0.0/24 169.254.101.1\n\neven if we have just one route here, it is not clear to me which router (lr11\nor lr13 will respond to the ARP request as next-hop).\n\n> +])\n> +\n> +OVN_CLEANUP_IC([az1], [az2], [az3])\n> +\n> +AT_CLEANUP\n> +])\n> +\n>  OVN_FOR_EACH_NORTHD([\n>  AT_SETUP([ovn-ic -- prefix filter -- filtering routes])\n>  ovn_init_ic_db\n> -- \n> 2.43.0\n> \n> \n> -- \n> \n> \n> \n> \n> _'Esta mensagem é direcionada apenas para os endereços constantes no \n> cabeçalho inicial. Se você não está listado nos endereços constantes no \n> cabeçalho, pedimos-lhe que desconsidere completamente o conteúdo dessa \n> mensagem e cuja cópia, encaminhamento e/ou execução das ações citadas estão \n> imediatamente anuladas e proibidas'._\n> \n> \n> * **'Apesar do Magazine Luiza tomar \n> todas as precauções razoáveis para assegurar que nenhum vírus esteja \n> presente nesse e-mail, a empresa não poderá aceitar a responsabilidade por \n> quaisquer perdas ou danos causados por esse e-mail ou por seus anexos'.*\n> \n> \n> \n> _______________________________________________\n> dev mailing list\n> dev@openvswitch.org\n> https://mail.openvswitch.org/mailman/listinfo/ovs-dev\n>","headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ovs-dev@lists.linuxfoundation.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Ui7iUVNp;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=L09R0Mud;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)","smtp2.osuosl.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Ui7iUVNp;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=L09R0Mud","smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","smtp1.osuosl.org;\n dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ui7iUVNp;\n dkim=pass (2048-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=L09R0Mud"],"Received":["from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fS9bC4LD2z1xw1\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 07 Mar 2026 02:40:23 +1100 (AEDT)","from localhost (localhost [127.0.0.1])\n\tby smtp2.osuosl.org (Postfix) with ESMTP id C0736412D8;\n\tFri,  6 Mar 2026 15:40:21 +0000 (UTC)","from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id Pg_bKFb7hbTP; Fri,  6 Mar 2026 15:40:20 +0000 (UTC)","from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])\n\tby smtp2.osuosl.org (Postfix) with ESMTPS id A503640225;\n\tFri,  6 Mar 2026 15:40:20 +0000 (UTC)","from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 85981C0070;\n\tFri,  6 Mar 2026 15:40:20 +0000 (UTC)","from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 0040EC003D\n for <dev@openvswitch.org>; Fri,  6 Mar 2026 15:40:18 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id D9CA081546\n for <dev@openvswitch.org>; Fri,  6 Mar 2026 15:40:17 +0000 (UTC)","from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id 8AufCwgPswt9 for <dev@openvswitch.org>;\n Fri,  6 Mar 2026 15:40:17 +0000 (UTC)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by smtp1.osuosl.org (Postfix) with ESMTPS id B76E080F6B\n for <dev@openvswitch.org>; Fri,  6 Mar 2026 15:40:16 +0000 (UTC)","from mail-wm1-f72.google.com (mail-wm1-f72.google.com\n [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-628-wlr4V7SmOd6L8h6Ye-xgfw-1; Fri, 06 Mar 2026 10:40:13 -0500","by mail-wm1-f72.google.com with SMTP id\n 5b1f17b1804b1-4839fc4cef6so93784315e9.0\n for <dev@openvswitch.org>; Fri, 06 Mar 2026 07:40:13 -0800 (PST)","from localhost (net-37-119-153-93.cust.vodafonedsl.it.\n [37.119.153.93]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-4852470b412sm41060585e9.8.2026.03.06.07.40.09\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 06 Mar 2026 07:40:09 -0800 (PST)"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.9.56;\n helo=lists.linuxfoundation.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp2.osuosl.org A503640225","OpenDKIM Filter v2.11.0 smtp1.osuosl.org B76E080F6B"],"Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124;\n helo=us-smtp-delivery-124.mimecast.com;\n envelope-from=lorenzo.bianconi@redhat.com; receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp1.osuosl.org B76E080F6B","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1772811615;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=rqbNKSo52kDcm1A4IiCpzc0gXGf+9+8n5UYtd4cg/s8=;\n b=Ui7iUVNpGNRNBFNrgrRnFfcAWVJ8bXBWSfBbM3L6i6TYA1DDyOHjyuLwsMP3FDe0iyLnXJ\n 7MGWGhImv1MLuri1YM2K997VvCUBSsfbhbukospe51JUIy4Lm3/sNZ/FX+EawqvacHIZ7z\n 1LbItAqdP3o8Z22seK81wD0wCoA//2E=","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1772811612; x=1773416412; darn=openvswitch.org;\n h=in-reply-to:content-disposition:mime-version:references:message-id\n :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;\n bh=rqbNKSo52kDcm1A4IiCpzc0gXGf+9+8n5UYtd4cg/s8=;\n b=L09R0Mud3+dtw7fufVzyDNyo7Hxv9LqZolEK88IHFLzzHijlL9bbkWRwiqDLnUA3xy\n VNdQK6DWI/lfzV/rcmQznhHHkl++15MVYp0BKFLbf0mTTMIt9mRl1U+bKM3q00iqfmdX\n OkIB1PiaI0DzXZ7/jqkyh5bEtRu7Nc4KTjUUgY3JOePEFta8W/t7NLfUkF8JxLuQII6/\n /XcakC/MOfawzR0ia0DZMiBKh+pEJGz0X0yxm6wvJu2GdQTzfzHkfYklxp3B8FbWBFGM\n EXspNJUDymbcsWSF2EwrFPlxHaPs+2PXkEoPStoD3SNB/tJZ1ScJ/YuYmuZ/fhvZASsf\n yY0w=="],"X-MC-Unique":"wlr4V7SmOd6L8h6Ye-xgfw-1","X-Mimecast-MFC-AGG-ID":"wlr4V7SmOd6L8h6Ye-xgfw_1772811612","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1772811612; x=1773416412;\n h=in-reply-to:content-disposition:mime-version:references:message-id\n :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=rqbNKSo52kDcm1A4IiCpzc0gXGf+9+8n5UYtd4cg/s8=;\n b=KdJgCCnSTNIKs6eafasaLUpxhRYmm2MWwenxF1Ecqg6WNe/zotfxyGtsY1Hk+TUWTj\n Yl82hKSNDq9XSd57geqmlag+PFn5IZNNUhMuMLBAPrlqQ3nnea2YxRDkwLWBqIKg5Nm/\n i3dOLjNV38NHSFric59dI+bHM21CwsEz4qAkh1eea3+/6VCteyUTH3/9619sxklMjhmG\n KuJeiLK4yQpwiGFHjv0dbFJIUwHQ3ZdJlAygrMaUoLvtwFK4AAS3/X9pY86GnPkAxcKW\n Nxr764nrLACL5wdufg6VrA6SExX9SE3w0pdJFE71mzI1ox7T1mWCy5hQ3f8Uq9MaXEl0\n gksQ==","X-Gm-Message-State":"AOJu0YyMGLd7FSSqHx7EbP5nZCF8O/CBPPGcBeLRHDaKmA2Bf0bzbOXH\n F4ajxol84IdxEqC1hnVXw9SH6HN9Zepb+mK14kexF3uobJw+w4bQ5We2jGEnyFJ5JcMPWCmo4az\n O8gIGPHIUO1a0vtyLqEMIPksHQCTj9dSofEqG/2u/nmVHXCnwAzUXx5uj2BBTUg==","X-Gm-Gg":"ATEYQzxRsd074yGSy4w5mPWGgALCs5J9QFh247jZo9wls8sxjtVkH4+sEddHVdna9ol\n 8yU43PEm+Ce6tS35KwbB5umua2wGzMnZp3A2QHj6BFVwuLjXf9LNI5oAVbsJQC/hK6Cixm3cNJt\n T0ueqcBjMuWdNyVPZQJBMi+avvuYnuutaMY9VQ1nTUQSmmvl84XYBzwKBfh9PBpxspN92xpvMaJ\n VC80HyJwgmJGqP5lMYdryKLdaxTaEiQhrKNPJD+gksDIZB4507iAQ10UnicPXLaxob/m78wbm+6\n wX0Pl1MfWr7maTkSB4/0OCA2LJ4A3mM5745/6n/68o3MnAQaN1h6a5kKKD5sCorFveYvK0CKB0j\n uMgvHXhJAjk1FIHxkc1sTaOGpHNXpzLJGPEHHzTVNXUHwDsGHigwITkHN+ikh8RSwjQmfog==","X-Received":["by 2002:a05:600c:4446:b0:483:29f4:26b3 with SMTP id\n 5b1f17b1804b1-48526715248mr40411485e9.1.1772811611845;\n Fri, 06 Mar 2026 07:40:11 -0800 (PST)","by 2002:a05:600c:4446:b0:483:29f4:26b3 with SMTP id\n 5b1f17b1804b1-48526715248mr40410675e9.1.1772811611256;\n Fri, 06 Mar 2026 07:40:11 -0800 (PST)"],"Date":"Fri, 6 Mar 2026 16:40:08 +0100","To":"Lucas Vargas Dias <lucas.vdias@luizalabs.com>","Cc":"dev@openvswitch.org","Message-ID":"<aar1WDMvTIf6UwIx@lore-desk>","References":"<20260224123621.21065-1-lucas.vdias@luizalabs.com>","MIME-Version":"1.0","In-Reply-To":"<20260224123621.21065-1-lucas.vdias@luizalabs.com>","X-Content-Filtered-By":"Mailman/MimeDel 2.1.30","Subject":"Re: [ovs-dev] [PATCH ovn v2] ic: Avoid learn the same prefix and\n nexthop in same TS.","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","From":"Lorenzo Bianconi via dev <ovs-dev@openvswitch.org>","Reply-To":"Lorenzo Bianconi <lorenzo.bianconi@redhat.com>","Content-Type":"multipart/mixed; boundary=\"===============2170470213621222551==\"","Errors-To":"ovs-dev-bounces@openvswitch.org","Sender":"\"dev\" <ovs-dev-bounces@openvswitch.org>"}},{"id":3659843,"web_url":"http://patchwork.ozlabs.org/comment/3659843/","msgid":"<CACAUutOYDHcJ-xC=a36QXMLzPCz8PZDWEUJqOzM4bAL=ZtquoQ@mail.gmail.com>","list_archive_url":null,"date":"2026-03-06T16:09:18","subject":"Re: [ovs-dev] [PATCH ovn v2] ic: Avoid learn the same prefix and\n nexthop in same TS.","submitter":{"id":90169,"url":"http://patchwork.ozlabs.org/api/people/90169/","name":"Lucas Vargas Dias","email":"lucas.vdias@luizalabs.com"},"content":"Hi Lorenzo,\nThanks for your review.\nActually this patch must be ignored.\n\nPatch [0] fixes this issue.\n\n[0]\nhttps://github.com/ovn-org/ovn/commit/69c2b8677de0676db7b3f4a5cd89cb0be931737a\n\nRegards,\nLucas\n\nEm sex., 6 de mar. de 2026, 12:40, Lorenzo Bianconi <\nlorenzo.bianconi@redhat.com> escreveu:\n\n> > Avoid learned route loop if two differents AZs\n> > configure the same address and adv the same prefix\n> > in the same Transit Switch.\n> > Do not remove the route from routes learned structure,\n> > mark the route as not stale.\n>\n> Hi Lucas,\n>\n> looking at the testing scenario this seems mostly a configuration issue to\n> me\n> and the networking will not working properly even adding this patch right?\n> E.g.\n> Both the routers will respond to ARP requests or snat the traffic with the\n> same\n> IP.\n>\n> Some comments inline.\n> Regards,\n> Lorenzo\n>\n> >\n> > Signed-off-by: Lucas Vargas Dias <lucas.vdias@luizalabs.com>\n> > ---\n> >  ic/ovn-ic.c     | 17 ++++++++------\n> >  tests/ovn-ic.at | 60 +++++++++++++++++++++++++++++++++++++++++++++++++\n> >  2 files changed, 70 insertions(+), 7 deletions(-)\n> >\n> > diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c\n> > index 95d73cb4b..3f3c0d99d 100644\n> > --- a/ic/ovn-ic.c\n> > +++ b/ic/ovn-ic.c\n> > @@ -1300,6 +1300,7 @@ struct ic_route_info {\n> >      const struct nbrec_logical_router_static_route *nb_route;\n> >      const struct nbrec_logical_router_port *nb_lrp;\n> >      const struct nbrec_load_balancer *nb_lb;\n> > +    bool stale; /* True if the route is stale and should be removed. */\n> >  };\n> >\n> >  static uint32_t\n> > @@ -1393,6 +1394,7 @@ add_to_routes_learned(struct hmap *routes_learned,\n> >      ic_route->origin = origin;\n> >      ic_route->route_table = nb_route->route_table;\n> >      ic_route->nb_lr = nb_lr;\n> > +    ic_route->stale = true;\n> >      hmap_insert(routes_learned, &ic_route->node,\n> >                  ic_route_hash(&prefix, plen, &nexthop, origin,\n> >                                nb_route->route_table));\n> > @@ -2168,8 +2170,7 @@ sync_learned_routes(struct ic_context *ctx,\n> >                          route_learned->nb_route, \"ic-learned-route\",\n> uuid_s);\n> >                      free(uuid_s);\n> >                  }\n> > -                hmap_remove(&ic_lr->routes_learned,\n> &route_learned->node);\n> > -                free(route_learned);\n> > +                route_learned->stale = false;\n> >              } else {\n> >                  /* Create the missing route in NB. */\n> >                  const struct nbrec_logical_router_static_route\n> *nb_route =\n> > @@ -2197,11 +2198,13 @@ sync_learned_routes(struct ic_context *ctx,\n> >      /* Delete extra learned routes. */\n> >      struct ic_route_info *route_learned;\n> >      HMAP_FOR_EACH_SAFE (route_learned, node, &ic_lr->routes_learned) {\n> > -        VLOG_DBG(\"Delete route %s -> %s that is not in IC-SB from NB.\",\n> > -                 route_learned->nb_route->ip_prefix,\n> > -                 route_learned->nb_route->nexthop);\n> > -        nbrec_logical_router_update_static_routes_delvalue(\n> > -            ic_lr->lr, route_learned->nb_route);\n> > +        if (route_learned->stale) {\n> > +            VLOG_DBG(\"Delete route %s -> %s that is not in IC-SB from\n> NB.\",\n> > +                     route_learned->nb_route->ip_prefix,\n> > +                     route_learned->nb_route->nexthop);\n> > +            nbrec_logical_router_update_static_routes_delvalue(\n> > +                ic_lr->lr, route_learned->nb_route);\n> > +        }\n> >          hmap_remove(&ic_lr->routes_learned, &route_learned->node);\n> >          free(route_learned);\n> >      }\n> > diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at\n> > index 1a826aa1c..ead16aa91 100644\n> > --- a/tests/ovn-ic.at\n> > +++ b/tests/ovn-ic.at\n> > @@ -3394,6 +3394,66 @@ OVN_CLEANUP_IC([az1], [az2])\n> >  AT_CLEANUP\n> >  ])\n> >\n> > +OVN_FOR_EACH_NORTHD([\n> > +AT_SETUP([ovn-ic -- check loop with LSP of duplicated address])\n> > +\n> > +ovn_init_ic_db\n> > +\n> > +for i in 1 2 3; do\n> > +    ovn_start az$i\n> > +    ovn_as az$i\n> > +\n> > +    # Enable route learning at AZ level\n> > +    check ovn-nbctl set nb_global . options:ic-route-learn=true\n> > +    # Enable route advertising at AZ level\n> > +    check ovn-nbctl set nb_global . options:ic-route-adv=true\n> > +done\n> > +\n> > +# Create new transit switches and LRs. Test topology is next:\n> > +#                            logical router (lr12)\n> > +#                                   |\n> > +# logical router (lr11) -  / transit switch (ts11) \\ - logical router\n> (lr13)\n> > +#\n> > +\n> > +# Create lr11, lr13, ts11 and connect them\n> > +for i in 1 3; do\n> > +    ovn_as az$i\n> > +\n> > +    lr=lr1$i\n> > +    check ovn-nbctl lr-add $lr\n> > +\n> > +    check ovn-ic-nbctl --wait=sb --may-exist ts-add ts11\n> > +\n> > +    lrp=lrp-$lr-ts11\n> > +    lsp=lsp-ts11-$lr\n> > +    # Create LRP and connect to TS\n> > +    check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a1:0$i\n> 169.254.101.1/24\n> > +    check ovn-nbctl lsp-add-router-port ts11 $lsp $lrp\n> > +done\n> > +\n> > +# Create lr12 and connect it to ts11\n> > +ovn_as az2\n> > +check ovn-nbctl lr-add lr12\n> > +\n> > +# Create LRP and connect to TS\n> > +check ovn-nbctl lrp-add lr12 lrp-lr12-ts11 aa:aa:aa:aa:a1:03\n> 169.254.101.2/24\n> > +check ovn-nbctl lsp-add-router-port ts11 lsp-lr12-ts11 lrp-lr12-ts11\n> > +\n> > +\n> > +# Create directly-connected route in lr11\n> > +check ovn_as az1 ovn-nbctl lrp-add lr11 lrp-lr11 aa:aa:aa:aa:bb:01 \"\n> 192.168.0.1/24\"\n> > +check ovn_as az3 ovn-nbctl lrp-add lr13 lrp-lr13 aa:aa:aa:aa:bb:03 \"\n> 192.168.0.1/24\"\n> > +sleep 2\n>\n> I guess you do not need this sleep\n>\n> > +OVS_WAIT_FOR_OUTPUT([ovn_as az2 ovn-nbctl lr-route-list lr12 | grep\n> 192.168 |\n> > +             grep learned | awk '{print $1, $2}' | sort ], [0], [dnl\n> > +192.168.0.0/24 169.254.101.1\n>\n> even if we have just one route here, it is not clear to me which router\n> (lr11\n> or lr13 will respond to the ARP request as next-hop).\n>\n> > +])\n> > +\n> > +OVN_CLEANUP_IC([az1], [az2], [az3])\n> > +\n> > +AT_CLEANUP\n> > +])\n> > +\n> >  OVN_FOR_EACH_NORTHD([\n> >  AT_SETUP([ovn-ic -- prefix filter -- filtering routes])\n> >  ovn_init_ic_db\n> > --\n> > 2.43.0\n> >\n> >\n> > --\n> >\n> >\n> >\n> >\n> > _'Esta mensagem é direcionada apenas para os endereços constantes no\n> > cabeçalho inicial. Se você não está listado nos endereços constantes no\n> > cabeçalho, pedimos-lhe que desconsidere completamente o conteúdo dessa\n> > mensagem e cuja cópia, encaminhamento e/ou execução das ações citadas\n> estão\n> > imediatamente anuladas e proibidas'._\n> >\n> >\n> > * **'Apesar do Magazine Luiza tomar\n> > todas as precauções razoáveis para assegurar que nenhum vírus esteja\n> > presente nesse e-mail, a empresa não poderá aceitar a responsabilidade\n> por\n> > quaisquer perdas ou danos causados por esse e-mail ou por seus anexos'.*\n> >\n> >\n> >\n> > _______________________________________________\n> > dev mailing list\n> > dev@openvswitch.org\n> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev\n> >\n>","headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ovs-dev@lists.linuxfoundation.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=luizalabs.com header.i=@luizalabs.com\n header.a=rsa-sha256 header.s=google header.b=KDRJMnTH;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)","smtp4.osuosl.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=luizalabs.com header.i=@luizalabs.com header.a=rsa-sha256\n header.s=google header.b=KDRJMnTH","smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=luizalabs.com","smtp3.osuosl.org; dkim=pass (1024-bit key,\n unprotected) header.d=luizalabs.com header.i=@luizalabs.com\n header.a=rsa-sha256 header.s=google header.b=KDRJMnTH"],"Received":["from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fSBF22m3yz1xxS\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 07 Mar 2026 03:09:42 +1100 (AEDT)","from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 54ADD41DF1;\n\tFri,  6 Mar 2026 16:09:35 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id fHYfCfbaMFSi; Fri,  6 Mar 2026 16:09:33 +0000 (UTC)","from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])\n\tby smtp4.osuosl.org (Postfix) with ESMTPS id 8B86241DEE;\n\tFri,  6 Mar 2026 16:09:33 +0000 (UTC)","from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 70BFBC0070;\n\tFri,  6 Mar 2026 16:09:33 +0000 (UTC)","from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 9D759C003D\n for <dev@openvswitch.org>; Fri,  6 Mar 2026 16:09:32 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id 8F1F761266\n for <dev@openvswitch.org>; Fri,  6 Mar 2026 16:09:32 +0000 (UTC)","from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id iUJdWO96gNId for <dev@openvswitch.org>;\n Fri,  6 Mar 2026 16:09:31 +0000 (UTC)","from mail-oa1-x2b.google.com (mail-oa1-x2b.google.com\n [IPv6:2001:4860:4864:20::2b])\n by smtp3.osuosl.org (Postfix) with ESMTPS id 125FE6126A\n for <dev@openvswitch.org>; Fri,  6 Mar 2026 16:09:30 +0000 (UTC)","by mail-oa1-x2b.google.com with SMTP id\n 586e51a60fabf-4043b27ddeaso3143868fac.1\n for <dev@openvswitch.org>; Fri, 06 Mar 2026 08:09:30 -0800 (PST)"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.9.56;\n helo=lists.linuxfoundation.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp4.osuosl.org 8B86241DEE","OpenDKIM Filter v2.11.0 smtp3.osuosl.org 125FE6126A"],"Received-SPF":"Pass (mailfrom) identity=mailfrom;\n client-ip=2001:4860:4864:20::2b; helo=mail-oa1-x2b.google.com;\n envelope-from=lucas.vdias@luizalabs.com; receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp3.osuosl.org 125FE6126A","ARC-Seal":"i=1; a=rsa-sha256; t=1772813370; cv=none;\n d=google.com; s=arc-20240605;\n b=Umree47RxkjLY8Y4sbwGXNRiBRpVhUojZUwZahzBEarKyNO9lIXLuPEcT3TZ10iwfj\n 9432EwwjvE6wBHDdHrQ+7KennnYEtfqAYyGP2jL23zIRn7VLaYyCsM3fnq3iLv3vNY62\n BwyKYStkn5la850x+DQ1CLJ4iIvUMdU5AVteMi+S+650sU7VGJ4XshtMaXVTpWXbOQSr\n ybNwN/Tff+4IkfVm+ZaE+FlqCYDvA3LijDur/vhSVi9cT52HcvzUYxtOPsWF+WHjFh4Q\n h5oy7UGR/WHu0dghAzo4OXdJWSdGQLJ0uilu7YoZvYgjkQsbrW2qk93VPMYd8g36tPwx\n 8yYQ==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:dkim-signature;\n bh=1LwfIJm5xwM117OowYty24aa2V8Nm+MJvI85ZeBuqc4=;\n fh=/ytlKXQwlt09KTrb82wbQwTcebeRPHJ0ZVv2pU4O1so=;\n b=M0zfOwvl+pQ/rIRVo0n00B+h423IHq4Orw4J9WeKlxx0UubcGNiqyNPSPDTecHdPmA\n iLwjz5PP9pFTWzZ3PFBpiHjqa5qbKFlLOMv9vcBlbAE0Rehdd+953d9pJ9Y7gKafFmrh\n iI9L+sRjiJnbRDct2olNGfgFjmUlUi6/ZDqAyFxcQqDZiXXK6E7ZNKSiUTxswUU5oTlL\n jY9EGNH12Rk0vnpALSS/7hpyEILNn8aXwfLVWPblrw17zvvKyQC1u/fy72xnQYZwGYyu\n BoUk/xtmaU27f2xa+/bKqllgTBl8tR3ztQk7k+jSEbEvpUFXXt12cvPY2jsiCkhLYmLX\n lkZg==; darn=openvswitch.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=luizalabs.com; s=google; t=1772813370; x=1773418170; darn=openvswitch.org;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:from:to:cc:subject:date:message-id:reply-to;\n bh=1LwfIJm5xwM117OowYty24aa2V8Nm+MJvI85ZeBuqc4=;\n b=KDRJMnTHt7J+bRLcIWwpbhlE8EuXoBtFWAhPlU3SLIqt29VCyxRAwzWqnR1DQqWFNX\n QGYEEsSHlTkJBXZ8vJdIFADJIuon2ylgT36SGGfvoMcJfF9rpPfUzrR7HmA/nTzxkibK\n A/4wz6SjMSoK2SoxlG09EZL8kzzTuYY9sBgjs=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1772813370; x=1773418170;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=1LwfIJm5xwM117OowYty24aa2V8Nm+MJvI85ZeBuqc4=;\n b=kXvS+tIwM6lGOxjVzVX2GtsLn5rvZjXybM7GLLwxlZzPUDPg2NV5tAnkYfyBOaPg8A\n /PnyzqWDF1VSDp0xjx0hWQq6f7RZe+3iGdVsrFgcEoNqj1nc2YzGgBjtPZI8l4gJpuoD\n MzrLAYd078rbOJytWwJDSok1V+kMOy8+oFphgFb7aWtOr8tGQZ6qleurJmpHQtY3UH8T\n aUn2bo5DR7jR0p3S27KTDUDWtjKDapN8aL4AOQICv5XcRzRCCl1OjMpbYs/SBp+y8pyN\n DyGkOZWBdx/duWYrwBYRyf3LT5Pd2G2OsfMBFa/12hXITYN8Xtbj/tB417im7fSdtV7x\n w7Jg==","X-Gm-Message-State":"AOJu0YzzvudsmOE9N7Hlx8Fn9riDD8eeod2mHjvS3t0e641MPXJMbYBt\n A9Bl9+Psys0cYlnqviHTcLjJ5eVFQkujiAa/hdhaN4UTtZZGA1ahPbkZ5n8laDeySW5JynWeRba\n Pw3OyhmA3x5f5RdI5t1H5koCat0b5UHu8aTBcOgKw3mAShSBGu5mKfXjXkCCDkU3O6XQgvTvoj8\n 0sj8WhDxm4y4bumeftv8ONDQ==","X-Gm-Gg":"ATEYQzzJvJK1Gai4I5O5jKuJdNg4DO4RGxuky/plPygrYOBX8o3NfcV29STIbpROjPu\n f1MVfMc1d246srLFos6p1uUmy/OT0fJEZzGlO7WZZnPp3o4nkDaJBWxnqpk5hIf8A3Dxd1ybB4r\n jaA5O1pWyVOL7fBe3rHlUfDbhktcuFPQ2Xx5zkS0/5OfjsVcGqOGaCXGI7ZpR25O/T6cKD9Bh5s\n o/orrfyHS+CQtTcGlztye4ksVrUdHU3Z3cocSCk5YedQrrFNjmwNzmaSP0SgHKnKAU0LquyT4zi\n mqdNHBmOcw==","X-Received":"by 2002:a05:6871:c301:b0:40e:e5c1:8617 with SMTP id\n 586e51a60fabf-416e458ae3dmr1435750fac.47.1772813369513; Fri, 06 Mar 2026\n 08:09:29 -0800 (PST)","MIME-Version":"1.0","References":"<20260224123621.21065-1-lucas.vdias@luizalabs.com>\n <aar1WDMvTIf6UwIx@lore-desk>","In-Reply-To":"<aar1WDMvTIf6UwIx@lore-desk>","Date":"Fri, 6 Mar 2026 13:09:18 -0300","X-Gm-Features":"AaiRm50z5EwwNDGt1-FFSGiSfa0qH0yL8BGNojkE8yc0IgIXpDeF3jwQwV98MRw","Message-ID":"\n <CACAUutOYDHcJ-xC=a36QXMLzPCz8PZDWEUJqOzM4bAL=ZtquoQ@mail.gmail.com>","To":"Lorenzo Bianconi <lorenzo.bianconi@redhat.com>","Cc":"dev@openvswitch.org","X-Content-Filtered-By":"Mailman/MimeDel 2.1.30","Subject":"Re: [ovs-dev] [PATCH ovn v2] ic: Avoid learn the same prefix and\n nexthop in same TS.","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","From":"Lucas Vargas Dias via dev <ovs-dev@openvswitch.org>","Reply-To":"Lucas Vargas Dias <lucas.vdias@luizalabs.com>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"ovs-dev-bounces@openvswitch.org","Sender":"\"dev\" <ovs-dev-bounces@openvswitch.org>"}}]