From patchwork Fri Dec 2 20:36:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frode Nordahl X-Patchwork-Id: 1711578 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.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=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=j2vNSqsv; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4NP4Vj1K64z23nB for ; Sat, 3 Dec 2022 07:37:00 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id EE7D940604; Fri, 2 Dec 2022 20:36:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org EE7D940604 Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=j2vNSqsv X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d2xqn56gRTzB; Fri, 2 Dec 2022 20:36:58 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id D59C5400CB; Fri, 2 Dec 2022 20:36:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D59C5400CB Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B427AC0033; Fri, 2 Dec 2022 20:36:56 +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 7550CC0032 for ; Fri, 2 Dec 2022 20:36:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 3D9B760AA4 for ; Fri, 2 Dec 2022 20:36:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3D9B760AA4 Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=j2vNSqsv 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 uI3vg4MjHWHQ for ; Fri, 2 Dec 2022 20:36:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 208E46061B Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by smtp3.osuosl.org (Postfix) with ESMTPS id 208E46061B for ; Fri, 2 Dec 2022 20:36:52 +0000 (UTC) Received: from frode-threadripper.. (ti0189a330-0102.bb.online.no [88.91.31.103]) (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 smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 936713F140 for ; Fri, 2 Dec 2022 20:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1670013410; bh=qyvbIlSyGymoHzUoWRLwAc13ZUI/UK9Miy0HnlvPkPY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=j2vNSqsvPrtV6/KsRj41xo5uJzKptlz4nr4KHjyvRKaxhvZmaSRiVpIgIHEjA+7lh boNcEri+5VHzapX5/MJyPSZCd3c5UsqScvbpJgtTIgrRKh0cUz+/oDi7lKSEbc4465 Yh7jbY7ycramMWrzJvaD2GvgibBTFDesKTB4ZfFeD5topn0l7Hc9d6jYWwWlf4Lmvf oN1vCmTHQFnsjn1AQk2QUfu+5vXGhJzqBSCAjivkpWoiuBgYeC8DIRJ43odVFYqB4H JMr0H0kYmET3oWtlSf4fjAwbuliXQzo6BmzLtHIIhDi3qkSI1BOP46qru63xJTTd08 Ik5M2s19rlYkg== From: Frode Nordahl To: dev@openvswitch.org Date: Fri, 2 Dec 2022 21:36:49 +0100 Message-Id: <20221202203649.2070337-1-frode.nordahl@canonical.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn] ovn-nbctl: Fix removal of BFD entry on route deletion X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When creating a route with BFD, ovn-nbctl creates an entry both in the Logical_Router_Static_Route and BFD tables. However, before this patch, removing a route does not remove the corresponding entry in the BFD table. Fixes: c23a46839c44 ("ovn-nbctl: add --bfd option to lr-route-add") Reported-at: https://bugs.launchpad.net/ubuntu/+source/ovn/+bug/1998617 Signed-off-by: Frode Nordahl Acked-by: Dumitru Ceara --- tests/ovn-nbctl.at | 6 ++++++ utilities/ovn-nbctl.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at index 9da7c26b3..91d8d338e 100644 --- a/tests/ovn-nbctl.at +++ b/tests/ovn-nbctl.at @@ -1614,6 +1614,7 @@ AT_CHECK([ovn-nbctl lr-route-add lr0 0.0.0.0/0 192.168.0.1]) AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.1.0/24 11.0.1.1 lp0]) AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.0.1/24 11.0.0.2]) AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.10.0/24 lp0]) +AT_CHECK([ovn-nbctl --bfd lr-route-add lr0 10.0.20.0/24 11.0.2.1 lp0]) AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.10.0/24 lp1], [1], [], [ovn-nbctl: bad IPv4 nexthop argument: lp1 ]) @@ -1667,6 +1668,7 @@ Route Table
: 10.0.0.0/24 11.0.0.1 dst-ip 10.0.1.0/24 11.0.1.1 dst-ip lp0 10.0.10.0/24 dst-ip lp0 + 10.0.20.0/24 11.0.2.1 dst-ip lp0 bfd 20.0.0.0/24 discard dst-ip 9.16.1.0/24 11.0.0.1 src-ip 10.0.0.0/24 11.0.0.2 src-ip @@ -1674,6 +1676,10 @@ Route Table
: 0.0.0.0/0 192.168.0.1 dst-ip ]) +check_row_count nb:BFD 1 +AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.20.0/24]) +check_row_count nb:BFD 0 + AT_CHECK([ovn-nbctl lrp-add lr0 lp1 f0:00:00:00:00:02 11.0.0.254/24]) AT_CHECK([ovn-nbctl --may-exist lr-route-add lr0 10.0.0.111/24 11.0.0.1 lp1]) AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c index 9e9b83ef1..3bc4a8d82 100644 --- a/utilities/ovn-nbctl.c +++ b/utilities/ovn-nbctl.c @@ -4426,6 +4426,8 @@ nbctl_pre_lr_route_del(struct ctl_context *ctx) ovsdb_idl_add_column(ctx->idl, &nbrec_logical_router_static_route_col_policy); + ovsdb_idl_add_column(ctx->idl, + &nbrec_logical_router_static_route_col_bfd); ovsdb_idl_add_column(ctx->idl, &nbrec_logical_router_static_route_col_ip_prefix); ovsdb_idl_add_column(ctx->idl, @@ -4438,7 +4440,7 @@ nbctl_pre_lr_route_del(struct ctl_context *ctx) } static void -nbctl_lr_route_del(struct ctl_context *ctx) + nbctl_lr_route_del(struct ctl_context *ctx) { const struct nbrec_logical_router *lr; char *error = lr_by_name_or_uuid(ctx, ctx->argv[1], true, &lr); @@ -4555,6 +4557,10 @@ nbctl_lr_route_del(struct ctl_context *ctx) } /* Everything matched. Removing. */ + if (lr->static_routes[i]->bfd) { + nbrec_bfd_delete(lr->static_routes[i]->bfd); + } + nbrec_logical_router_update_static_routes_delvalue( lr, lr->static_routes[i]); n_removed++;