diff options
Diffstat (limited to 'bgpd/bgp_route.c')
| -rw-r--r-- | bgpd/bgp_route.c | 211 |
1 files changed, 122 insertions, 89 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index ef8537f039..5255eb5800 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -5376,10 +5376,10 @@ void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi) bgp_attr_get_community( pi->attr), COMMUNITY_NO_LLGR)) - break; + continue; if (!CHECK_FLAG(pi->flags, BGP_PATH_STALE)) - break; + continue; /* * If this is VRF leaked route @@ -5409,9 +5409,9 @@ void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi) !community_include( bgp_attr_get_community(pi->attr), COMMUNITY_NO_LLGR)) - break; + continue; if (!CHECK_FLAG(pi->flags, BGP_PATH_STALE)) - break; + continue; if (safi == SAFI_UNICAST && (peer->bgp->inst_type == BGP_INSTANCE_TYPE_VRF || @@ -9529,6 +9529,8 @@ void route_vty_out_overlay(struct vty *vty, const struct prefix *p, } else { json_object_string_add(json_nexthop, "Error", "Unsupported address-family"); + json_object_string_add(json_nexthop, "error", + "Unsupported address-family"); } } @@ -9898,9 +9900,12 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn, if (tag_buf[0] != '\0') vty_out(vty, " VNI %s", tag_buf); } else { - if (tag_buf[0]) + if (tag_buf[0]) { json_object_string_add(json_path, "VNI", tag_buf); + json_object_string_add(json_path, "vni", + tag_buf); + } } } @@ -12458,6 +12463,8 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd, output_arg, show_flags, rpki_target_state); } else { + struct listnode *node; + struct bgp *abgp; /* show <ip> bgp ipv4 all: AFI_IP, show <ip> bgp ipv6 all: * AFI_IP6 */ @@ -12469,66 +12476,80 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd, afi = CHECK_FLAG(show_flags, BGP_SHOW_OPT_AFI_IP) ? AFI_IP : AFI_IP6; - FOREACH_SAFI (safi) { - if (!bgp_afi_safi_peer_exists(bgp, afi, safi)) - continue; + for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, abgp)) { + FOREACH_SAFI (safi) { + if (!bgp_afi_safi_peer_exists(abgp, afi, + safi)) + continue; - if (uj) { - if (first) - first = false; + if (uj) { + if (first) + first = false; + else + vty_out(vty, ",\n"); + vty_out(vty, "\"%s\":{\n", + get_afi_safi_str(afi, + safi, + true)); + } else + vty_out(vty, + "\nFor address family: %s\n", + get_afi_safi_str( + afi, safi, + false)); + + if (community) + bgp_show_community( + vty, abgp, community, + exact_match, afi, safi, + show_flags); else - vty_out(vty, ",\n"); - vty_out(vty, "\"%s\":{\n", - get_afi_safi_str(afi, safi, - true)); - } else - vty_out(vty, - "\nFor address family: %s\n", - get_afi_safi_str(afi, safi, - false)); - - if (community) - bgp_show_community(vty, bgp, community, - exact_match, afi, - safi, show_flags); - else - bgp_show(vty, bgp, afi, safi, sh_type, - output_arg, show_flags, - rpki_target_state); - if (uj) - vty_out(vty, "}\n"); + bgp_show(vty, abgp, afi, safi, + sh_type, output_arg, + show_flags, + rpki_target_state); + if (uj) + vty_out(vty, "}\n"); + } } } else { /* show <ip> bgp all: for each AFI and SAFI*/ - FOREACH_AFI_SAFI (afi, safi) { - if (!bgp_afi_safi_peer_exists(bgp, afi, safi)) - continue; - - if (uj) { - if (first) - first = false; - else - vty_out(vty, ",\n"); + for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, abgp)) { + FOREACH_AFI_SAFI (afi, safi) { + if (!bgp_afi_safi_peer_exists(abgp, afi, + safi)) + continue; - vty_out(vty, "\"%s\":{\n", - get_afi_safi_str(afi, safi, - true)); - } else - vty_out(vty, - "\nFor address family: %s\n", - get_afi_safi_str(afi, safi, - false)); + if (uj) { + if (first) + first = false; + else + vty_out(vty, ",\n"); - if (community) - bgp_show_community(vty, bgp, community, - exact_match, afi, - safi, show_flags); - else - bgp_show(vty, bgp, afi, safi, sh_type, - output_arg, show_flags, - rpki_target_state); - if (uj) - vty_out(vty, "}\n"); + vty_out(vty, "\"%s\":{\n", + get_afi_safi_str(afi, + safi, + true)); + } else + vty_out(vty, + "\nFor address family: %s\n", + get_afi_safi_str( + afi, safi, + false)); + + if (community) + bgp_show_community( + vty, abgp, community, + exact_match, afi, safi, + show_flags); + else + bgp_show(vty, abgp, afi, safi, + sh_type, output_arg, + show_flags, + rpki_target_state); + if (uj) + vty_out(vty, "}\n"); + } } } if (uj) @@ -13956,6 +13977,8 @@ DEFPY (show_ip_bgp_instance_neighbor_advertised_route, int idx = 0; bool first = true; uint16_t show_flags = 0; + struct listnode *node; + struct bgp *abgp; if (uj) { argc--; @@ -14007,42 +14030,52 @@ DEFPY (show_ip_bgp_instance_neighbor_advertised_route, || CHECK_FLAG(show_flags, BGP_SHOW_OPT_AFI_IP6)) { afi = CHECK_FLAG(show_flags, BGP_SHOW_OPT_AFI_IP) ? AFI_IP : AFI_IP6; - FOREACH_SAFI (safi) { - if (!bgp_afi_safi_peer_exists(bgp, afi, safi)) - continue; + for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, abgp)) { + FOREACH_SAFI (safi) { + if (!bgp_afi_safi_peer_exists(abgp, afi, safi)) + continue; - if (uj) { - if (first) - first = false; - else - vty_out(vty, ",\n"); - vty_out(vty, "\"%s\":", - get_afi_safi_str(afi, safi, true)); - } else - vty_out(vty, "\nFor address family: %s\n", - get_afi_safi_str(afi, safi, false)); + if (uj) { + if (first) + first = false; + else + vty_out(vty, ",\n"); + vty_out(vty, "\"%s\":", + get_afi_safi_str(afi, safi, + true)); + } else + vty_out(vty, + "\nFor address family: %s\n", + get_afi_safi_str(afi, safi, + false)); - peer_adj_routes(vty, peer, afi, safi, type, rmap_name, - show_flags); + peer_adj_routes(vty, peer, afi, safi, type, + rmap_name, show_flags); + } } } else { - FOREACH_AFI_SAFI (afi, safi) { - if (!bgp_afi_safi_peer_exists(bgp, afi, safi)) - continue; + for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, abgp)) { + FOREACH_AFI_SAFI (afi, safi) { + if (!bgp_afi_safi_peer_exists(abgp, afi, safi)) + continue; - if (uj) { - if (first) - first = false; - else - vty_out(vty, ",\n"); - vty_out(vty, "\"%s\":", - get_afi_safi_str(afi, safi, true)); - } else - vty_out(vty, "\nFor address family: %s\n", - get_afi_safi_str(afi, safi, false)); + if (uj) { + if (first) + first = false; + else + vty_out(vty, ",\n"); + vty_out(vty, "\"%s\":", + get_afi_safi_str(afi, safi, + true)); + } else + vty_out(vty, + "\nFor address family: %s\n", + get_afi_safi_str(afi, safi, + false)); - peer_adj_routes(vty, peer, afi, safi, type, rmap_name, - show_flags); + peer_adj_routes(vty, peer, afi, safi, type, + rmap_name, show_flags); + } } } if (uj) @@ -14161,7 +14194,7 @@ DEFUN (show_ip_bgp_flowspec_routes_detailed, struct bgp *bgp = NULL; int idx = 0; bool uj = use_json(argc, argv); - uint16_t show_flags = 0; + uint16_t show_flags = BGP_SHOW_OPT_DETAIL; if (uj) { argc--; |
