From 1608ff7715ba135c2ccac34b80871512c7f658c4 Mon Sep 17 00:00:00 2001 From: Sarita Patra Date: Mon, 13 May 2019 10:27:54 -0700 Subject: bgpd : add prefix-length in show ip bgp neighbor advertised routes key Issue: ip route 15.1.1.0/24 10.112.158.15 ip route 15.1.1.0/32 10.112.158.15 Brought up ebgp session between two FRR routers and redistributed static routes via BGP and verfied the advertising routes in the peer. Verify the command "show ip bgp neighbors advertised-routes json". It only shows 15.1.1.0/32 route details. Root casue: For both the routes "15.1.1.0/24" and "15.1.1.0/32" the advertised routes key is the prefix i.e. "15.1.1.0". Fix: Modify the key to prefix/prefix-length. Signed-off-by: Sarita Patra --- bgpd/bgp_route.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4de73f124..db3bb2f63 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7504,10 +7504,9 @@ void route_vty_out_tmp(struct vty *vty, struct prefix *p, struct attr *attr, json_object_object_add(json_net, "appliedStatusSymbols", json_status); char buf_cut[BUFSIZ]; - json_object_object_add( - json_ar, - inet_ntop(p->family, &p->u.prefix, buf_cut, BUFSIZ), - json_net); + + prefix2str(p, buf_cut, PREFIX_STRLEN); + json_object_object_add(json_ar, buf_cut, json_net); } else vty_out(vty, "\n"); } -- cgit v1.2.3