From patchwork Tue Aug 1 07:22:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: maximkorezkij X-Patchwork-Id: 1815386 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=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=iviGAQF8; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 4RFRQx24qqz1yZl for ; Tue, 1 Aug 2023 17:23:05 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id ECBE9408B0; Tue, 1 Aug 2023 07:23:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org ECBE9408B0 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=iviGAQF8 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cO-oJMDMfqum; Tue, 1 Aug 2023 07:23:01 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 37889401C3; Tue, 1 Aug 2023 07:23:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 37889401C3 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 109C5C0072; Tue, 1 Aug 2023 07:23:00 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2FA0BC0032 for ; Tue, 1 Aug 2023 07:22:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 080B060EB6 for ; Tue, 1 Aug 2023 07:22:59 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 080B060EB6 Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=iviGAQF8 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 cy4arx71iwzS for ; Tue, 1 Aug 2023 07:22:57 +0000 (UTC) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on0718.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0c::718]) by smtp3.osuosl.org (Postfix) with ESMTPS id 9B3AD60DFC for ; Tue, 1 Aug 2023 07:22:57 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 9B3AD60DFC ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=erjIKLTHg2c5LX9HTNrJOhVSPxTPHQ/AagHWqFDVpMsjE/0pX3J+FSbABW9UsyxICGr343jLu7Rud1CL28usGRchC1eVYmxKMRpPG8nN2txt+ArSh8I+Jn9aihr9OWOwcnfBTgrjSVPZF0bS+zRbr4e0OzWIC5XoLVELiuqRErkscSENfikBCC/NXax8iPMG8ezYLY+3tt1eeBMUpQbQgKx/FY4uf6ERMJei2WPZo6SMY0wvsc7R88jRZVy0OeT6nVSw3dOlUpT7kfwsQZpwq+Lvz7woOu7+5tH+nd5RC0pVakZx2DrDXr3iez2Xr//hy05ABnIhjsjXwUrNOtsYPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AOD+46X3NRfmb/iJaRmhz+hLH+GmGZ1eYlTF6LckKWs=; b=RHSTEbEul98nxQHOqg0cMyMHUMtDLxIkTxeJVey5w3gv2QJFmszjnAzRQ6mqGIrjhCRYrmm8H6eqON8Q0y4Uwm4sc0ICekl+AwDuyQLFc80XtBnzpfkuT+bn6Lo3LeKYPEf/4e3Y6eLVfrP+y6EeNLuzNjGpHGgj4T5I/4D2KsVr2O1ED03oGQ+f2zDfukLe7tISzjRCVkICAQvnMLLdzXkURVrjxtS7tW5G/rWU+CMANMkBFTfYALeE71PjJA68gnVjNbWtwvDc9/1zN+SAMbuK+ruGgQcbDYU/DVDc2PU4duX/zvkFyLXSIkHn5YZetuzDnrEIZfJdGv1DxqaHWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mail.schwarz; dmarc=pass action=none header.from=mail.schwarz; dkim=pass header.d=mail.schwarz; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.schwarz; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AOD+46X3NRfmb/iJaRmhz+hLH+GmGZ1eYlTF6LckKWs=; b=iviGAQF86E3N8SlRkOnK7MlX3y8uTx6JvJwI/WWOYAu2GIkn9zfkpdGBxiai7Q9N39e97VO6fvnweFjqlS4hdYYQuVkOnox1z613TCymadXKciDRG8V6Bf5dArHV3dQxemVyRcIny5BtmF7T/vostz2+TkA+tC0I9Sln7XeLYe51f0BgrJmEzmLO7xk2zzNM6QOKtJhhPchic2CyyhCeGC/UyY3lD65FLv1JjiVWx1jArPxf+ViMTbU19Ni8oM6m8vGZqJ+GQUWo3+QmtIYWaBGMNZ3QdlVSQY5LOi2oV7JTg5AG7LSTMnLhZcebMeyzd8E5p60zTAcPqsKZNOVsUA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mail.schwarz; Received: from AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:4b1::6) by PAVPR10MB7209.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:311::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.42; Tue, 1 Aug 2023 07:22:54 +0000 Received: from AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM ([fe80::350f:1888:635c:267f]) by AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM ([fe80::350f:1888:635c:267f%4]) with mapi id 15.20.6631.043; Tue, 1 Aug 2023 07:22:54 +0000 Date: Tue, 1 Aug 2023 09:22:52 +0200 To: dev@openvswitch.org Message-ID: Content-Disposition: inline X-ClientProxiedBy: FR2P281CA0078.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9a::20) To AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:4b1::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS4PR10MB5221:EE_|PAVPR10MB7209:EE_ X-MS-Office365-Filtering-Correlation-Id: 89dc3766-6810-4385-d6b8-08db92601f1b x-mp-schwarz-dsgvo2: 1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /C5bWKEhH/sNibbUFZwP/Nrg2TPI+xurVj0DQ+CONuoM1L6cz9NDUoUwqmtybiirIR3bSVliFUNFIgCvCvSvFeta48dLGWzXB8pQun21IfLQ5L7OlA4KFtVPrjWM/ZQ4DQIcJJvXeKsj5N4mH+UFNQs812CeSqF8SaVZWb9epZKBXMRMrxwCuBWhMTl4OylqPQQC5k8ZX1VtXRUQT/7rGEWbsppGNRNH0glz82se7g3HIiNKI6H4oKL19I5tFQnoIdK0B0yyiNr/aktpNpmgAVJZLZklNFGkWQR8A8Dw6SbYQtv5QFkDj+b875kRwzS6DZRREwM+Y5S7m5HeSV/8qOVHJjXM1spvgXqGDj8oiiGhKZpp0M3ymEEVfowCE0P9BorYz/pGelOkoeWSReLtdeZ2AGyM9tiasQonktrnAnU3rXYxxYImLHJhIstl2Mgut/K0nwM7G4NXUw0lPFXbxZYYGsVabbAk3cAt0bsSQ5jvotXddUnAugucvs0WoOUSD2LYJcUU+YATjnlkF2dbxq0eddzrGPIpkCsZ+H4uZFZzIliTJpJ4TsIWL1hoLiTyi1S6PSk98GFwHuirAnQMbfplfSLUbicBR9wI+KffpK4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(136003)(396003)(376002)(39860400002)(366004)(451199021)(38100700002)(82960400001)(86362001)(6512007)(9686003)(6486002)(186003)(26005)(8676002)(6506007)(8936002)(107886003)(5660300002)(4326008)(66556008)(6916009)(66476007)(2906002)(66946007)(41300700001)(316002)(478600001)(66574015)(83380400001)(43062005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Xrpf5mHOaYbsxulR1HF6bgLpq+IMMiqbQCvqzZcbDDFCZImfNFywnek4YUYuWgXT5YhofMMWNmuOrDbHP74eVl4gxquRylYzU+sci6PBcrP7p9v3pvGaytpUqW+/J9s3tMcSJpQEhzm4kGaQsiM0FeQc3nekdjoR7GeLjfDgxHuLUnjNCXxoeTNfJ3BIKiHs3xpLEA2XdT1ggk+W/pHbf4Vaj7WoDrq9xiCO40g/7cvay1yi7qXPmOkn7EB/WBgN0/DIqqPSX69P8mSWCRDXEGReqhYRqqMeaw1qKsYqgVORi6g5yg914LyveK8LcRgGMo2CDx1jdlsfrcMqf78bA2oL67xbYwQiMrZ20Oe2IhN7IVhB5PIiqvmUlEliD6chugwmdRAkJK1ZEOphP+HTID+fKW6f4dKBaWXbNpZMd3Pml5KDInzRK8z0wrmBO/JFinkJA7ovp9radcB0wzwFdcpRtyDTQzJrTWUBrJU0WA/eSO0aTjiEwzFfnKmQtZhRVVioRXmFudz9XGEv/sYCZdp5/nhGIpgkXKVFYA2su4+BrvKjK6qq2joLbLAkLl336PY6hZdOnH253boMcCVH4OeqQIUNauYC4iqhIVLeyhXpCPEAfT5tOTJj9KYOn5qQcd26eIaE20dkTKJsr/184hPjXVM42ViBUotrxmjztd/nkF8QrQ/85QXTbdLjCGxZSGlIR16J2eRGcRVd8utiKDEmVOUUGMME3JUv2exfDSM78QqbyCNK8s9rB54reVL+Wts+NNd5ulFsqeOA5Ya15/i/Z9MpEVoFpseAiQMBeNHReDoNKpUeCMdhoDodwKbSOV+Rzj9+uGp8F4XJ7JWm7OFYwW4Dwo0zvLSBtVjgyGaJxMNN2xCoCkgqTzvE7qpt8Dh0luDkXK6FqPz8IGbp+YJq+fc5N5igQjDEkU1eZf7Bv8SjPdVDm65cxioAWWcsekr2e+oHykzD88WVsORQVs6H7gSIXH1JOURuZpch8y361oR0n6px/2uzeLgLJ3yIBi7C+Q1EKQM88lLe5ACg+I5RSjmFrJFF5dMlm840B7SW/qC5XD0Q3mrm3EKBPg3e4WobktgmsOW6euMv42GJ5XYgussYwuwG19vB54FglVcs48tQmgPiZUkdz50S6Q7E+rYcpZpORaaFicMIUkGA+KJbiiy2F2VhR/zx5V+a07m03ugJp+XPl6/hEGaJk1KxcACtAD+r9h7Ax/AjGcfO0bVyZNlh8pCNgj6icKIttNbgFd+W4D7NBzbzarXtOOF8f1mrqEm5L1n0IuI3d2WgevrPO3gJBi8upbnUDo1DqV+wYBnecsJcFUD/GifDLHaq4WXICuEwAbVmZRPKmVT2CrjSbJdGTmSzxWWrsqvf8qAn5qTCYOiTRvDwKtf6Jnga82WdgwiKqyhI5KJaOBnCneDTOJiRYJbY9WggHig278GBj8k7UOPbJp7ZuIqwVnwms4AjHLITBhqZDq7nn91kK3wJ/Xk4+FOu3pNiyhhdu134sRwyCJ4IPZ5EB7U1nUDYXR4I1UtBwoVZpg5WrTI/96RNenZY7HTmv220LjoIj0d90XlIEwIjxD0ejnVPi81r5BASz/qy1BGWmC5G02m1eA== X-OriginatorOrg: mail.schwarz X-MS-Exchange-CrossTenant-Network-Message-Id: 89dc3766-6810-4385-d6b8-08db92601f1b X-MS-Exchange-CrossTenant-AuthSource: AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 07:22:54.0557 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d04f4717-5a6e-4b98-b3f9-6918e0385f4c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QVNLljBro5ALfLuSvuiEwwQtJaw5b1BKAT/2s1Sb7/gML9sROzn2wxsYZcuS+GaAju3nksX9EDZY0dBaihw62SZpYLBGRhlxrJ1ANwY8QQs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR10MB7209 Subject: [ovs-dev] [PATCH ovn 2/2] ovn-ic: support learning routes in same AZ 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: , X-Patchwork-Original-From: maximkorezkij via dev From: maximkorezkij Reply-To: maximkorezkij Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" when connecting multiple logical routers to a transit switch per az then previously the routers in the same az would not learn each others routes while the routers in the others az would learn all of them. As this is confusing and would require each user to have additional logical that configures static routing within each az. Signed-off-by: Maxim Korezkij Signed-off-by: Felix Huettner Acked-by: Mark Michelson --- ic/ovn-ic.c | 52 ++++++++++++++++++++++++++++++++++++------------- tests/ovn-ic.at | 2 ++ 2 files changed, 40 insertions(+), 14 deletions(-) -- 2.34.1 Diese E Mail enthält möglicherweise vertrauliche Inhalte und ist nur für die Verwertung durch den vorgesehenen Empfänger bestimmt. Sollten Sie nicht der vorgesehene Empfänger sein, setzen Sie den Absender bitte unverzüglich in Kenntnis und löschen diese E Mail. Hinweise zum Datenschutz finden Sie hier. This e-mail may contain confidential content and is intended only for the specified recipient/s. If you are not the intended recipient, please inform the sender immediately and delete this e-mail. Information on data protection can be found here. diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 49850954f..cea14d008 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -861,6 +861,8 @@ struct ic_route_info { const char *origin; const char *route_table; + const struct nbrec_logical_router *nb_lr; + /* Either nb_route or nb_lrp is set and the other one must be NULL. * - For a route that is learned from IC-SB, or a static route that is * generated from a route that is configured in NB, the "nb_route" @@ -937,7 +939,8 @@ parse_route(const char *s_prefix, const char *s_nexthop, /* Return false if can't be added due to bad format. */ static bool add_to_routes_learned(struct hmap *routes_learned, - const struct nbrec_logical_router_static_route *nb_route) + const struct nbrec_logical_router_static_route *nb_route, + const struct nbrec_logical_router *nb_lr) { struct in6_addr prefix, nexthop; unsigned int plen; @@ -959,6 +962,7 @@ add_to_routes_learned(struct hmap *routes_learned, ic_route->nb_route = nb_route; ic_route->origin = origin; ic_route->route_table = nb_route->route_table; + ic_route->nb_lr = nb_lr; hmap_insert(routes_learned, &ic_route->node, ic_route_hash(&prefix, plen, &nexthop, origin, nb_route->route_table)); @@ -1099,7 +1103,8 @@ add_to_routes_ad(struct hmap *routes_ad, const struct in6_addr prefix, unsigned int plen, const struct in6_addr nexthop, const char *origin, const char *route_table, const struct nbrec_logical_router_port *nb_lrp, - const struct nbrec_logical_router_static_route *nb_route) + const struct nbrec_logical_router_static_route *nb_route, + const struct nbrec_logical_router *nb_lr) { if (route_table == NULL) { route_table = ""; @@ -1117,6 +1122,7 @@ add_to_routes_ad(struct hmap *routes_ad, const struct in6_addr prefix, ic_route->origin = origin; ic_route->route_table = route_table; ic_route->nb_lrp = nb_lrp; + ic_route->nb_lr = nb_lr; hmap_insert(routes_ad, &ic_route->node, hash); } else { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); @@ -1130,6 +1136,7 @@ static void add_static_to_routes_ad( struct hmap *routes_ad, const struct nbrec_logical_router_static_route *nb_route, + const struct nbrec_logical_router *nb_lr, const struct lport_addresses *nexthop_addresses, const struct smap *nb_options) { @@ -1172,14 +1179,15 @@ add_static_to_routes_ad( } add_to_routes_ad(routes_ad, prefix, plen, nexthop, ROUTE_ORIGIN_STATIC, - nb_route->route_table, NULL, nb_route); + nb_route->route_table, NULL, nb_route, nb_lr); } static void add_network_to_routes_ad(struct hmap *routes_ad, const char *network, const struct nbrec_logical_router_port *nb_lrp, const struct lport_addresses *nexthop_addresses, - const struct smap *nb_options) + const struct smap *nb_options, + const struct nbrec_logical_router *nb_lr) { struct in6_addr prefix, nexthop; unsigned int plen; @@ -1218,7 +1226,7 @@ add_network_to_routes_ad(struct hmap *routes_ad, const char *network, /* directly-connected routes go to
route table */ add_to_routes_ad(routes_ad, prefix, plen, nexthop, ROUTE_ORIGIN_CONNECTED, - NULL, nb_lrp, NULL); + NULL, nb_lrp, NULL, nb_lr); } static bool @@ -1322,7 +1330,6 @@ lrp_is_ts_port(struct ic_context *ctx, struct ic_router_info *ic_lr, static void sync_learned_routes(struct ic_context *ctx, - const struct icsbrec_availability_zone *az, struct ic_router_info *ic_lr) { ovs_assert(ctx->ovnnb_txn); @@ -1345,7 +1352,15 @@ sync_learned_routes(struct ic_context *ctx, ICSBREC_ROUTE_FOR_EACH_EQUAL (isb_route, isb_route_key, ctx->icsbrec_route_by_ts) { - if (isb_route->availability_zone == az) { + const char *lr_id = smap_get(&isb_route->external_ids, "lr-id"); + if (lr_id == NULL) { + continue; + } + struct uuid lr_uuid; + if (!uuid_from_string(&lr_uuid, lr_id)) { + continue; + } + if (uuid_equals(&ic_lr->lr->header_.uuid, &lr_uuid)) { continue; } @@ -1435,16 +1450,24 @@ static void ad_route_sync_external_ids(const struct ic_route_info *route_adv, const struct icsbrec_route *isb_route) { - struct uuid isb_ext_id, nb_id; + struct uuid isb_ext_id, nb_id, isb_ext_lr_id, lr_id; smap_get_uuid(&isb_route->external_ids, "nb-id", &isb_ext_id); + smap_get_uuid(&isb_route->external_ids, "lr-id", &isb_ext_lr_id); nb_id = route_adv->nb_route ? route_adv->nb_route->header_.uuid : route_adv->nb_lrp->header_.uuid; + lr_id = route_adv->nb_lr->header_.uuid; if (!uuid_equals(&isb_ext_id, &nb_id)) { char *uuid_s = xasprintf(UUID_FMT, UUID_ARGS(&nb_id)); icsbrec_route_update_external_ids_setkey(isb_route, "nb-id", uuid_s); free(uuid_s); } + if (!uuid_equals(&isb_ext_lr_id, &lr_id)) { + char *uuid_s = xasprintf(UUID_FMT, UUID_ARGS(&lr_id)); + icsbrec_route_update_external_ids_setkey(isb_route, "lr-id", + uuid_s); + free(uuid_s); + } } /* Sync routes from routes_ad to IC-SB. */ @@ -1549,7 +1572,7 @@ build_ts_routes_to_adv(struct ic_context *ctx, if (smap_get_uuid(&nb_route->external_ids, "ic-learned-route", &isb_uuid)) { /* It is a learned route */ - if (!add_to_routes_learned(&ic_lr->routes_learned, nb_route)) { + if (!add_to_routes_learned(&ic_lr->routes_learned, nb_route, lr)) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); VLOG_WARN_RL(&rl, "Bad format of learned route in NB: " "%s -> %s. Delete it.", nb_route->ip_prefix, @@ -1559,7 +1582,7 @@ build_ts_routes_to_adv(struct ic_context *ctx, } } else if (!strcmp(ts_route_table, nb_route->route_table)) { /* It may be a route to be advertised */ - add_static_to_routes_ad(routes_ad, nb_route, ts_port_addrs, + add_static_to_routes_ad(routes_ad, nb_route, lr, ts_port_addrs, &nb_global->options); } } @@ -1571,7 +1594,8 @@ build_ts_routes_to_adv(struct ic_context *ctx, for (int j = 0; j < lrp->n_networks; j++) { add_network_to_routes_ad(routes_ad, lrp->networks[j], lrp, ts_port_addrs, - &nb_global->options); + &nb_global->options, + lr); } } else { /* The router port of the TS port is ignored. */ @@ -1582,7 +1606,7 @@ build_ts_routes_to_adv(struct ic_context *ctx, } static void -advertise_lr_routes(struct ic_context *ctx, +collect_lr_routes(struct ic_context *ctx, struct ic_router_info *ic_lr, struct shash *routes_ad_by_ts) { @@ -1727,8 +1751,8 @@ route_run(struct ic_context *ctx, struct ic_router_info *ic_lr; struct shash routes_ad_by_ts = SHASH_INITIALIZER(&routes_ad_by_ts); HMAP_FOR_EACH_SAFE (ic_lr, node, &ic_lrs) { - advertise_lr_routes(ctx, ic_lr, &routes_ad_by_ts); - sync_learned_routes(ctx, az, ic_lr); + collect_lr_routes(ctx, ic_lr, &routes_ad_by_ts); + sync_learned_routes(ctx, ic_lr); free(ic_lr->isb_pbs); hmap_destroy(&ic_lr->routes_learned); hmap_remove(&ic_lrs, &ic_lr->node); diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index 4b470d5c8..a49d47041 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -1233,12 +1233,14 @@ AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 | AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr21 | grep 192.168 | grep learned | awk '{print $1, $2}' | sort ], [0], [dnl 192.168.0.0/24 169.254.10.11 +192.168.2.0/24 169.254.10.22 ]) # Test direct routes from lr11 and lr21 were learned to lr22 AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr22 | grep 192.168 | grep learned | awk '{print $1, $2}' | sort ], [0], [dnl 192.168.0.0/24 169.254.10.11 +192.168.1.0/24 169.254.10.21 ]) OVN_CLEANUP_IC([az1], [az2])