From patchwork Thu May 16 04:38:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indrajitt Valsaraj X-Patchwork-Id: 1935922 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" (2048-bit key; unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=XHje+tXP; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=xul+jeMi; 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 4Vg5KJ0Gdjz1ymw for ; Thu, 16 May 2024 20:04:02 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0D85C607AD; Thu, 16 May 2024 10:04:00 +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 PRD3s_cmdJgZ; Thu, 16 May 2024 10:03:57 +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 E265360754 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=XHje+tXP; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=xul+jeMi Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id E265360754; Thu, 16 May 2024 10:03:56 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7464CC0077; Thu, 16 May 2024 10:03:56 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id EDCEEC0037 for ; Thu, 16 May 2024 04:39:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id D166E4056B for ; Thu, 16 May 2024 04:39:01 +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 dd_4TZhmPh3E for ; Thu, 16 May 2024 04:39:00 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=148.163.151.68; helo=mx0a-002c1b01.pphosted.com; envelope-from=indrajitt.valsaraj@nutanix.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 2CB9640560 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=nutanix.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 2CB9640560 Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=XHje+tXP; dkim=pass (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=xul+jeMi Received: from mx0a-002c1b01.pphosted.com (mx0a-002c1b01.pphosted.com [148.163.151.68]) by smtp4.osuosl.org (Postfix) with ESMTPS id 2CB9640560 for ; Thu, 16 May 2024 04:38:58 +0000 (UTC) Received: from pps.filterd (m0127838.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44FJhi9b018988 for ; Wed, 15 May 2024 21:38:58 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= from:to:cc:subject:date:message-id:content-transfer-encoding :content-type:mime-version; s=proofpoint20171006; bh=ES6GQOoS62U CcW3DdP52qJhkMa3pnTHtzGwuYamnfJo=; b=XHje+tXPacY3oafTsn4eVq6TpHk epDNL1Tug7+/ZJ4K3NyPeuCbdh78klztJ3J4qaJnKYI/yF+V7OUB5FM5qbUzP8DF CdKKC/wsXkwyDtSVCzH1H0mGn5q3nTdEsSAvdw2yoehYzbw4i/JzU090d2qQ6fNU 3GuWhGVvk1Ol9UwcRiFk4+Ijb3LUiFE4OYllmkmp9dXS1OpoyjEFDMHTHGLw61pv lbr2GRIymwTp8V/ifNBDeRQQxYJ956/jAFE7/RP+HRDrpu3XbzwGvUWAbL1Q2kgU T9ruJ7fLTEFa1cOSZ7fNUp/uTl4Io8rxDsXILRh83kgXzwH9oByezgEF+mA== Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2172.outbound.protection.outlook.com [104.47.58.172]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3y287va66u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 May 2024 21:38:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oSMyTMrpzMxW5/tQK19FFZfG5qxOKlD72ujcvHv1fjx4zRJpAHoSA1GpUR9DkIZnodybKOkGjLv+PZ89KD8FbSHUii/BX/OySpRnCca8t0B4LFiRgp7ebh03c+dsGkEoNHGYlyRrxgTyvS+KRNZVM/Sav2ytZYgYLM7XUhgv233yyFklfOfqVxXzRaAmpvJXx36zYICOu12ESwK2pPPED/Xg/l4unf+/ZuOmMwLCr09LNlXopK7udXj8Hz5MNerTcGXk4+xySIG4ceooik617xtRzwNLfYtDZybdYupQj5v5MECFvzS37pxvVF75Eis1H2Xu7FvQfrWceVmQEELwQQ== 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=ES6GQOoS62UCcW3DdP52qJhkMa3pnTHtzGwuYamnfJo=; b=iMKnlLIQq/sMws1mG8mvVPt6B5xDd2Iowz+AxH9rycClrFWXzDXA8/Bux1L5sa2/EeM05VEgCvCMwYq55dSCsdNo3daZWuV1oK49i8wUKKEMhFStgyOs3rRgyx7y9wcjokimhgDEkr+ilHXcI1Q/X2t3NdthZnWecnA07WT/BvWtX1GJlvXREhJvhq9/s3zPQ80F/5xe9OaoI8kWeLE9NqoFHpUjL347XM59K8utJWEDy63QF7qAfu8lHRKR93QK5yd4pzIP446YiSiZin8v1unpLhklwCNwLKCLSOGScdKfk7eP1nw4/R826LLMEobJ3LXWmxX0d9NqmxW/HFi0Uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ES6GQOoS62UCcW3DdP52qJhkMa3pnTHtzGwuYamnfJo=; b=xul+jeMitqg1+LJHVm4/W6HLO5wmpJ3zFfIwaIhWT0jtUm8d24L7uE+/QhIlfBK1ko066QMIFmxj9sY0f9qzh4Bj7OxDrh35rQKOHDAfQPnbSS5MhsCPWKdxU/KQGaAMHiIRd08PBtJiMe4Am5M5LvIcGTBJgZzDbZ1HTNEp+KQc5XSn2xk1Xu6AnHUDBmEiQTPjKA1UxKansj2QAYLhfTH3Eqh1fvfL1Wx9zZEaRbbCmU2R91dpWXgNlg0Cb3f54EocJRAWNn25j5uO2IAyN21CquvXRaQMwZ/nthLoxOhiBPmA9QmKP9vZMhpr4CmAwF0vYDqezjbIbesB3DoZzw== Received: from DM6PR02MB6747.namprd02.prod.outlook.com (2603:10b6:5:220::15) by IA3PR02MB10542.namprd02.prod.outlook.com (2603:10b6:208:533::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Thu, 16 May 2024 04:38:55 +0000 Received: from DM6PR02MB6747.namprd02.prod.outlook.com ([fe80::8dba:5918:2130:6dcc]) by DM6PR02MB6747.namprd02.prod.outlook.com ([fe80::8dba:5918:2130:6dcc%3]) with mapi id 15.20.7544.052; Thu, 16 May 2024 04:38:55 +0000 From: Indrajitt Valsaraj To: dev@openvswitch.org Date: Thu, 16 May 2024 04:38:39 +0000 Message-Id: <20240516043839.23805-1-indrajitt.valsaraj@nutanix.com> X-Mailer: git-send-email 2.22.3 X-ClientProxiedBy: SJ0PR03CA0366.namprd03.prod.outlook.com (2603:10b6:a03:3a1::11) To DM6PR02MB6747.namprd02.prod.outlook.com (2603:10b6:5:220::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR02MB6747:EE_|IA3PR02MB10542:EE_ X-MS-Office365-Filtering-Correlation-Id: c5c6cc19-3174-4a9e-f304-08dc756217c1 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|366007|376005|1800799015|52116005|38350700005; X-Microsoft-Antispam-Message-Info: qB5A+BZotH03kEVcABZ58WU4J9NIoSOqHATzXF4I+hfhC5Vp2jXOl4/48b1aCZxOYzpAnvpwsV22GOS40zste7APOslhvCoJjFfSTBgVCytMIfrVd0bPr0eyWU9zspC2fWAyQ9NN0+3bPA7FYiYRzf4K3Rw80comfjCjjTSAQakZZ3rS+pp3Tw5fJ+295NC1KltwaO+WUcNVHyY2Ru08F/Ufwh5sQPAuUHPcRRAh8B/rJ6CbTQGjQlLUlpiNzODaov4GJKyq7NCU/uSXfIpKr2ZPxA9UxKssGe+BjwPHKLe46DpcqNmyanXPdCk/4AWGG624wG5YI1mPk6WBeq6WxlxyhiCUJoZRhoLcdXseNNXWahbQBdDpp3n5fvmEbb7buqM3X2W6Cms/5fDRL89sjrjRdSX4WZ0TwhtlKtxwfKshb+npUK7KEHhn1YEulP4ETjmRmmJFJPgfj75B4eVczJoFpadsaVAs0YyXgoA7mu0WI3WCIoW5X9nENcXGqOL2CkHdkGcUQKdmqfWPZAx2ppNTb840aMSvm21yPF2QsL/C24qkJNHsRQDIxRMLLa6QndKuRCDsYamd2fw/p5Xru6tsr3FZqOmuOhx8wexyp4TT/xjBsevrU6Bob6tRF+d71EhZdcm028feI+Tdh7L39jbQUbooP2PgZznRuSpzXgWZymjnDBis6dWbuZrIvscO9/8xvpp4nQcqvNuTQRe3HzBAo2eSVjkPZmnCImY0FDC06AGYPTwDk2GqejXpo0btrAjgFZJAGSiR1uaXCgna8iFWUWlhz1ns9jPMIG+YRVYhAuzjKigMUH2uQwsfykzvXro92THPxNK6R4VuMyCYZxGph4KEFaO3yUdWZh7kKADYD6Qj37vl8667Hu+9XhEipp2rjYnshxsSBLx332MXz5LLdsPlEzaxRj6GraOFDBL5MXaPnTrthHUBOaN+2Bn/W/6+HUQ8aWaZxgioOcEYRCcofCXvcLCda8VIlEfTrTAhzqtj92FcvoNt32Mwz+7JmXOtJVFfimW+YAaz+qbefcqb0raG6D2CoB/eNg88UQvvJfyC2JISO0NnryRVufdQmxhPZVQlWSINBnIHMir729hkQtSASTgMOW9HnKUu3hmPNPlxmxMgT6IkRZqrxLehE9wjIx8c8GPKGdPLd43x31HhzHFiHrBqbKnMItv3iHFVudjZhav7fjyPcThOsQYJIYTjbfJRylQdHfb19Mq/z7kIu417LGbHgR68CzC4ACvqLpRWb6xM+4Au/ijR8FytYoEH30e2zGe9UXKDtZI9vxeUDOFebBP5cQM/ejCRAAYB7z1xtiIBJ1vK97ae2c85AuB4HTcF68Yk+XhK/2UqxA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR02MB6747.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(376005)(1800799015)(52116005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZW0DDlegVgS8Ga/j0G0zSBoPAvbPjiy0jgADuEa+8aPK5cOeQQwxEBTXCy0LdlhsfStRMWUsqkz2+tQTMsG/3/AaFPvSFEyHYaINdMDaHlR4Hm54nW50ju/YEZ64d1i6gwUwO+wfWSdlvJD6hV8vnt0qw9yRIFPys97wGyYPDdRtrQgsHc3zsJze7p7iJhlNclxte2S+B8oW5HBr3WdvxHArxd/OzuS25RoqsEjUWQWk/kyXtkkzZkeXGeUuiTrbzy7cf4ipsCDwBc0p3k0IwkPUQgXtomvMx2mNtA9GEu+7upYCcBuFnO9QohasFEchGwqgErJEZKdCWhg4BOY4DBcMHVU1KkEb02uXncYOObwD1Rq64Bi9BIUqheTPGoPMr+BB5XMmal4h9PLrbKmlSpZsfDJGcdIoA16A3CG+INCKc9b6XQtPPUz4f2JAqxmdXxlpbiad+XjuQtPwx3R6MotlaRzjIGrqQk/ucPB/4WoEKTl90LHY4ZKR7MR50BWDKo8VNP50nWZT+argP42Qig6nryRttuQ1rBF/SF7fN6n+QWmlDXQQ7skpminm9K8rIbPUtgE5T4O0/L7Db0Fc0f6VfdK1PFjRhhwGT1LQ+tm1k0SRjEv8DH8lRnzvGE76PPbrRRbXJEhMYEXPJqlAKi044DXMGIpGGcRJS3s63tzLdMTUFOZGfHhmCNSLKHycTLQi7Lqm82M8QhRjW1A+357GIHht2df8GrOiq2xS50U77elU2EJc+0rZKqyIzuwYn2yOH+VDj0pKR/4UBfYLkrnVUnOFD7BD2nIExtuGSPKzKpm8fQEDE74EkzqGMM3efm+mQYc4xCO1Bnq0gUkaCtEGD+CA3Yj9TrVyFqRkjCVm8Jkm7spgAwrXZWurt0LkNo6s5W2G4mVlyvt/ceJMSUKNloEw2anXa7u0fqzIgIRELMuiVzK6FEAJZgBKxojf0j6eLNRzEM+TNBzqJAp3iHbMFAHYTnr0lAg9RSP4hd1odOaJ4u1uRPcGG9LybqLOE0MxAI8mpyc03IOrsle9bCKzrHfEpwCae4NU+f0V1LBFfRVbbe3+e9GzeQCClI4ac4KeKgojeC87xu29hceZ+76hkMpLtI9hBBONYPC4ohPOquIk0WBV08/+iWoG+lvK5JR3EMazDwSEDrbVWVJZjYq/Fh3jAa0mFx6xCfKRU7L9/F5hz7As+PBW+cja49T778D7ITYECffTBCRjgPm3Sco+whdyO3IIjfKAmcPRPM5s+axtDeVWAaMcpza3CQkat0fxwFVOTq+ZUFOF4MgzI0EKqgFul/zABTjI8KDSrcYgYtQz3wfJxS3SBXlqcMJYqfka9JSMFZWGNFRDgRdDwBt0yYkkS5azvsEeggi56WktEQAOvWI7UnZYvqrAOML/9CTErsaBHI5NoayV55FsRE6mKvFrtcWKZBYGxnP6RRat2NG/jd+fcKMInPllwP+DXupLMt7EjCZI8dlaxvgGur6t2px4tu6DMe0m+O3VJOB2xbnmyjYusZ8Bu+exP9w0XneJr84/ASZruC/74Reh/FfGfGBjNmRC2FaCgI24gNm1Wyyv7IAVaCo5RZkbGwDtGeLaVWG8qlQFpIMjjVNbR6nXqgENHTXZrfdGsS5kNBo= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5c6cc19-3174-4a9e-f304-08dc756217c1 X-MS-Exchange-CrossTenant-AuthSource: DM6PR02MB6747.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 04:38:55.0120 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WeWuGbWrhh6wpfDGAqJKtkXVhMLVPTeg9LEeeoKouvPMudikQgsUB2awsgwF6fGye+EiJoOQt2nJFlBVQJewOakihTlWLlvdGDmTuT6yW3g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR02MB10542 X-Proofpoint-ORIG-GUID: q1pEn5hi3ObfA_P4mpue2HRhQwu--6jA X-Proofpoint-GUID: q1pEn5hi3ObfA_P4mpue2HRhQwu--6jA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_01,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Reason: safe X-Mailman-Approved-At: Thu, 16 May 2024 10:03:54 +0000 Cc: Indrajitt Valsaraj Subject: [ovs-dev] [PATCH ovn] northd: Fix an issue wrt mac binding aging. 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" Issue: In case of a Logical_Router without mac_binding_age_threshold set or a Logical_Router with an incorrectly formatted mac_binding_threshold option, entries were not being purged from the Mac Binding table in SouthBound. This was because in the function `en_mac_binding_aging_run` in case of an invalid mac_binding_threshold entry or if mac_binding_threshold is not set we are returning from the loop instead of iterating through the remaining LRs. As a result, subsequent runs of the aging_waker node are also not scehduled and we end up not purging any MAC Bindings. Fix: This patch fixes this issue by changing the return to a continue so that we skip the current LR but continue processing for the remaining LRs. Fixes: 78851b6ffb58 ("northd: Support CIDR-based MAC binding aging threshold.") Signed-off-by: Indrajitt Valsaraj Acked-by: Naveen Yerramneni --- northd/aging.c | 2 +- tests/ovn.at | 111 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 74 insertions(+), 39 deletions(-) -- 2.22.3 diff --git a/northd/aging.c b/northd/aging.c index b76963a2d..9685044e7 100644 --- a/northd/aging.c +++ b/northd/aging.c @@ -421,7 +421,7 @@ en_mac_binding_aging_run(struct engine_node *node, void *data OVS_UNUSED) if (!parse_aging_threshold(smap_get(&od->nbr->options, "mac_binding_age_threshold"), &threshold_config)) { - return; + continue; } aging_context_set_threshold(&ctx, &threshold_config); diff --git a/tests/ovn.at b/tests/ovn.at index 486680649..28a62d03d 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -34407,32 +34407,40 @@ ovn_start net_add n1 AT_CHECK([ovn-nbctl ls-add public]) -AT_CHECK([ovn-nbctl ls-add internal]) +AT_CHECK([ovn-nbctl ls-add internal-1]) AT_CHECK([ovn-nbctl lsp-add public ln_port]) AT_CHECK([ovn-nbctl lsp-set-addresses ln_port unknown]) AT_CHECK([ovn-nbctl lsp-set-type ln_port localnet]) AT_CHECK([ovn-nbctl lsp-set-options ln_port network_name=physnet1]) -AT_CHECK([ovn-nbctl lsp-add public public-gw]) -AT_CHECK([ovn-nbctl lsp-set-type public-gw router]) -AT_CHECK([ovn-nbctl lsp-set-addresses public-gw 00:00:00:00:10:00 router]) -AT_CHECK([ovn-nbctl lsp-set-options public-gw router-port=gw-public]) +AT_CHECK([ovn-nbctl lsp-add public public-gw-1]) +AT_CHECK([ovn-nbctl lsp-set-type public-gw-1 router]) +AT_CHECK([ovn-nbctl lsp-set-addresses public-gw-1 00:00:00:00:10:00 router]) +AT_CHECK([ovn-nbctl lsp-set-options public-gw-1 router-port=gw-1-public]) -AT_CHECK([ovn-nbctl lsp-add internal internal-gw]) -AT_CHECK([ovn-nbctl lsp-set-type internal-gw router]) -AT_CHECK([ovn-nbctl lsp-set-addresses internal-gw 00:00:00:00:20:00 router]) -AT_CHECK([ovn-nbctl lsp-set-options internal-gw router-port=gw-internal]) +AT_CHECK([ovn-nbctl lsp-add public public-gw-2]) +AT_CHECK([ovn-nbctl lsp-set-type public-gw-2 router]) +AT_CHECK([ovn-nbctl lsp-set-addresses public-gw-2 00:00:00:00:30:00 router]) +AT_CHECK([ovn-nbctl lsp-set-options public-gw-2 router-port=gw-2-public]) -AT_CHECK([ovn-nbctl lsp-add internal vif1]) +AT_CHECK([ovn-nbctl lsp-add internal-1 internal-gw-1]) +AT_CHECK([ovn-nbctl lsp-set-type internal-gw-1 router]) +AT_CHECK([ovn-nbctl lsp-set-addresses internal-gw-1 00:00:00:00:20:00 router]) +AT_CHECK([ovn-nbctl lsp-set-options internal-gw-1 router-port=gw-internal-1]) + +AT_CHECK([ovn-nbctl lsp-add internal-1 vif1]) AT_CHECK([ovn-nbctl lsp-set-addresses vif1 "00:00:00:00:20:10 192.168.20.10"]) -AT_CHECK([ovn-nbctl lsp-add internal vif2]) +AT_CHECK([ovn-nbctl lsp-add internal-1 vif2]) AT_CHECK([ovn-nbctl lsp-set-addresses vif2 "00:00:00:00:20:20 192.168.20.20"]) -AT_CHECK([ovn-nbctl lr-add gw]) -AT_CHECK([ovn-nbctl lrp-add gw gw-public 00:00:00:00:10:00 192.168.10.1/24]) -AT_CHECK([ovn-nbctl lrp-add gw gw-internal 00:00:00:00:20:00 192.168.20.1/24]) +AT_CHECK([ovn-nbctl lr-add gw-1]) +AT_CHECK([ovn-nbctl lrp-add gw-1 gw-1-public 00:00:00:00:10:00 192.168.10.1/24]) +AT_CHECK([ovn-nbctl lrp-add gw-1 gw-internal-1 00:00:00:00:20:00 192.168.20.1/24]) + +AT_CHECK([ovn-nbctl lr-add gw-2]) +AT_CHECK([ovn-nbctl lrp-add gw-2 gw-2-public 00:00:00:00:30:00 192.168.10.2/24]) sim_add hv1 as hv1 @@ -34500,21 +34508,27 @@ send_udp() { as $hv ovs-appctl netdev-dummy/receive $dev $packet } # Check if the option is not present by default -AT_CHECK([fetch_column nb:logical_router options name="gw" | grep -q mac_binding_age_threshold], [1]) +AT_CHECK([fetch_column nb:logical_router options name="gw-1" | grep -q mac_binding_age_threshold], [1]) +AT_CHECK([fetch_column nb:logical_router options name="gw-2" | grep -q mac_binding_age_threshold], [1]) # Send GARP to populate MAC binding table records send_garp hv1 ext1 10 send_garp hv2 ext2 20 -wait_row_count mac_binding 1 ip="192.168.10.10" -wait_row_count mac_binding 1 ip="192.168.10.20" +# Two rows present for each IP, one corresponding to each logical_port +wait_row_count mac_binding 2 ip="192.168.10.10" +wait_row_count mac_binding 2 ip="192.168.10.20" -dp_key=$(printf "0x%x" $(as hv1 fetch_column datapath tunnel_key external_ids:name=gw)) -port_key=$(printf "0x%x" $(as hv1 fetch_column port_binding tunnel_key logical_port=gw-public)) +dp_key_1=$(printf "0x%x" $(as hv1 fetch_column datapath tunnel_key external_ids:name=gw-1)) +port_key_1=$(printf "0x%x" $(as hv1 fetch_column port_binding tunnel_key logical_port=gw-1-public)) +dp_key_2=$(printf "0x%x" $(as hv1 fetch_column datapath tunnel_key external_ids:name=gw-2)) +port_key_2=$(printf "0x%x" $(as hv1 fetch_column port_binding tunnel_key logical_port=gw-2-public)) AT_CHECK_UNQUOTED([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE --no-stats | strip_cookie | sort], [0], [dnl - table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key},metadata=${dp_key},dl_src=00:00:00:00:10:10,nw_src=192.168.10.10 actions=drop - table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key},metadata=${dp_key},dl_src=00:00:00:00:10:20,nw_src=192.168.10.20 actions=drop + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_1},metadata=${dp_key_1},dl_src=00:00:00:00:10:10,nw_src=192.168.10.10 actions=drop + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_1},metadata=${dp_key_1},dl_src=00:00:00:00:10:20,nw_src=192.168.10.20 actions=drop + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_2},metadata=${dp_key_2},dl_src=00:00:00:00:10:10,nw_src=192.168.10.10 actions=drop + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_2},metadata=${dp_key_2},dl_src=00:00:00:00:10:20,nw_src=192.168.10.20 actions=drop ]) timestamp=$(fetch_column mac_binding timestamp ip="192.168.10.20") @@ -34525,8 +34539,8 @@ send_udp hv2 ext2 20 OVS_WAIT_UNTIL([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE | grep "192.168.10.10" | grep -q "n_packets=1"]) OVS_WAIT_UNTIL([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE | grep "192.168.10.20" | grep -q "n_packets=1"]) -# Set the MAC binding aging threshold -AT_CHECK([ovn-nbctl set logical_router gw options:mac_binding_age_threshold=5]) +# Set the MAC binding aging threshold for gw-1 router. No option for gw-2 router. +AT_CHECK([ovn-nbctl set logical_router gw-1 options:mac_binding_age_threshold=5]) AT_CHECK([fetch_column nb:logical_router options | grep -q mac_binding_age_threshold=5]) AT_CHECK([ovn-nbctl --wait=sb sync]) @@ -34542,21 +34556,24 @@ OVS_WAIT_UNTIL([ ]) check test "$(fetch_column mac_binding timestamp ip='192.168.10.20')" != "" -# Check if the records are removed after some inactivity +# Check if the records are removed after some inactivity for gw-1. Only 1 entry should be present for gw-2. OVS_WAIT_UNTIL([ - test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" + test "1" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" ]) # The second one takes longer because it got refreshed OVS_WAIT_UNTIL([ - test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.20')" + test "1" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.20')" ]) -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE --no-stats | strip_cookie], [0], []) +AT_CHECK_UNQUOTED([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE --no-stats | strip_cookie | sort], [0], [dnl + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_2},metadata=${dp_key_2},dl_src=00:00:00:00:10:10,nw_src=192.168.10.10 actions=drop + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_2},metadata=${dp_key_2},dl_src=00:00:00:00:10:20,nw_src=192.168.10.20 actions=drop +]) # Test CIDR-based threshold configuration -check ovn-nbctl set logical_router gw options:mac_binding_age_threshold="192.168.10.0/255.255.255.0:2;192.168.10.64/26:0;192.168.10.20:0" +check ovn-nbctl set logical_router gw-1 options:mac_binding_age_threshold="192.168.10.0/255.255.255.0:2;192.168.10.64/26:0;192.168.10.20:0" check ovn-nbctl --wait=sb sync -uuid=$(fetch_column datapath _uuid external_ids:name=gw) +uuid=$(fetch_column datapath _uuid external_ids:name=gw-1) AT_CHECK([ovn-sbctl get datapath $uuid external_ids:mac_binding_age_threshold], [0], [dnl "2" ]) @@ -34566,12 +34583,12 @@ send_garp hv1 ext1 10 # belong to 192.168.10.0/24 send_garp hv2 ext2 20 # belong to 192.168.10.20/32 send_garp hv2 ext2 65 # belong to 192.168.10.64/26 -OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.10"]) -OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.20"]) -OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.65"]) +wait_row_count mac_binding 2 ip="192.168.10.10" +wait_row_count mac_binding 2 ip="192.168.10.20" +wait_row_count mac_binding 2 ip="192.168.10.65" OVS_WAIT_UNTIL([ - test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" + test "1" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" ]) # The other two should remain because the corresponding prefixes have threshold 0 AT_CHECK([ovn-sbctl list mac_binding | grep -q "192.168.10.20"]) @@ -34579,9 +34596,9 @@ AT_CHECK([ovn-sbctl list mac_binding | grep -q "192.168.10.65"]) check ovn-sbctl --all destroy mac_binding # Set the aging threshold mixed with IPv6 prefixes and default threshold -check ovn-nbctl set logical_router gw options:mac_binding_age_threshold="2;192.168.10.64/26:0;ff00:1234::/32:888;ff00::abcd:1" +check ovn-nbctl set logical_router gw-1 options:mac_binding_age_threshold="2;192.168.10.64/26:0;ff00:1234::/32:888;ff00::abcd:1" check ovn-nbctl --wait=sb sync -uuid=$(fetch_column datapath _uuid external_ids:name=gw) +uuid=$(fetch_column datapath _uuid external_ids:name=gw-1) AT_CHECK([ovn-sbctl get datapath $uuid external_ids:mac_binding_age_threshold], [0], [dnl "1" ]) @@ -34594,15 +34611,15 @@ OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.10"]) OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.65"]) OVS_WAIT_UNTIL([ - test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" + test "1" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" ]) AT_CHECK([ovn-sbctl list mac_binding | grep -q "192.168.10.65"]) check ovn-sbctl --all destroy mac_binding # Set the aging threshold with invalid format -check ovn-nbctl set logical_router gw options:mac_binding_age_threshold="1;abc/26:0" +check ovn-nbctl set logical_router gw-1 options:mac_binding_age_threshold="1;abc/26:0" check ovn-nbctl --wait=sb sync -uuid=$(fetch_column datapath _uuid external_ids:name=gw) +uuid=$(fetch_column datapath _uuid external_ids:name=gw-1) AT_CHECK([ovn-sbctl get datapath $uuid external_ids:mac_binding_age_threshold], [1], [ignore], [ignore]) # Send GARP to populate MAC binding table records @@ -34613,6 +34630,24 @@ OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.10"]) sleep 5 AT_CHECK([ovn-sbctl list mac_binding | grep -q "192.168.10.10"]) +# Set the aging threshold on both routers and ensure that they are aged out of both the routers +AT_CHECK([ovn-nbctl set logical_router gw-1 options:mac_binding_age_threshold=5]) +AT_CHECK([ovn-nbctl set logical_router gw-2 options:mac_binding_age_threshold=5]) + +# Send GARP to populate MAC binding table records +send_garp hv1 ext1 10 # belong to 192.168.10.0/24 +send_garp hv2 ext2 20 # belong to 192.168.10.20/32 + +wait_row_count mac_binding 2 ip="192.168.10.10" +wait_row_count mac_binding 2 ip="192.168.10.20" + +OVS_WAIT_UNTIL([ + test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" +]) +OVS_WAIT_UNTIL([ + test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.20')" +]) + OVN_CLEANUP([hv1], [hv2]) AT_CLEANUP ])