From 2f3fb0128ee40646a4ea99a8a165cb28c55822cc Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Wed, 18 Dec 2024 18:27:55 +0100 Subject: [PATCH] bgpd: add rpki json attributes to bgp path Add missing json attribute to BGP path. Fixes: 82c298be7354 ("bgpd: Show RPKI short state in `show bgp `") Signed-off-by: Philippe Guibert --- bgpd/bgp_route.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 7c3dd234a231..e142d966186c 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9361,9 +9361,18 @@ static void route_vty_short_status_out(struct vty *vty, const struct prefix *p, json_object *json_path) { - enum rpki_states rpki_state = RPKI_NOT_BEING_USED; + enum rpki_states rpki_state; + + /* RPKI validation state */ + rpki_state = hook_call(bgp_rpki_prefix_status, path->peer, path->attr, p); if (json_path) { + if (rpki_state == RPKI_VALID) + json_object_boolean_true_add(json_path, "rpkiValid"); + else if (rpki_state == RPKI_INVALID) + json_object_boolean_true_add(json_path, "rpkiInvalid"); + else if (rpki_state == RPKI_NOTFOUND) + json_object_boolean_true_add(json_path, "rpkiNotFound"); /* Route status display. */ if (CHECK_FLAG(path->flags, BGP_PATH_REMOVED)) @@ -9411,10 +9420,6 @@ static void route_vty_short_status_out(struct vty *vty, return; } - /* RPKI validation state */ - rpki_state = - hook_call(bgp_rpki_prefix_status, path->peer, path->attr, p); - if (rpki_state == RPKI_VALID) vty_out(vty, "V"); else if (rpki_state == RPKI_INVALID)