summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2023-06-06 14:12:59 +0300
committerGitHub <noreply@github.com>2023-06-06 14:12:59 +0300
commitd4ec8b71bb05e6f738c524f85dc057222322f7b5 (patch)
tree877c833f6b92a2515ddc9f66d1b2fa1eb15bf082
parent298fe55a043a2ba978a10dcb4b9df214c72ccbca (diff)
parent9fd2155e60e8bb550823ed4823cc5ea19c0dc905 (diff)
Merge pull request #13694 from FRRouting/mergify/bp/stable/8.5/pr-13649
zebra: Unlock the route node when sending route notifications (backport #13649)
-rw-r--r--zebra/rib.h7
-rw-r--r--zebra/zapi_msg.c16
2 files changed, 18 insertions, 5 deletions
diff --git a/zebra/rib.h b/zebra/rib.h
index 0161063127..dd22d79835 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -483,6 +483,13 @@ extern uint8_t route_distance(int type);
extern void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq,
bool rt_delete);
+/*
+ * rib_find_rn_from_ctx
+ *
+ * Returns a lock increased route_node for the appropriate
+ * table and prefix specified by the context. Developer
+ * should unlock the node when done.
+ */
extern struct route_node *
rib_find_rn_from_ctx(const struct zebra_dplane_ctx *ctx);
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index c0945eae2d..c84e5a250a 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -812,11 +812,17 @@ int zsend_route_notify_owner(const struct route_node *rn,
int zsend_route_notify_owner_ctx(const struct zebra_dplane_ctx *ctx,
enum zapi_route_notify_owner note)
{
- return (route_notify_internal(
- rib_find_rn_from_ctx(ctx), dplane_ctx_get_type(ctx),
- dplane_ctx_get_instance(ctx), dplane_ctx_get_vrf(ctx),
- dplane_ctx_get_table(ctx), note, dplane_ctx_get_afi(ctx),
- dplane_ctx_get_safi(ctx)));
+ int result;
+ struct route_node *rn = rib_find_rn_from_ctx(ctx);
+
+ result = route_notify_internal(
+ rn, dplane_ctx_get_type(ctx), dplane_ctx_get_instance(ctx),
+ dplane_ctx_get_vrf(ctx), dplane_ctx_get_table(ctx), note,
+ dplane_ctx_get_afi(ctx), dplane_ctx_get_safi(ctx));
+
+ route_unlock_node(rn);
+
+ return result;
}
static void zread_route_notify_request(ZAPI_HANDLER_ARGS)