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 <[email protected]>
---
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 <main>:
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 <main>:
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++;
--
2.37.2
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev