diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | bgpd/bgp_evpn_vty.c | 126 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 6 | ||||
| -rwxr-xr-x | configure.ac | 2 | ||||
| -rw-r--r-- | doc/user/bgp.rst | 20 | ||||
| -rw-r--r-- | pimd/pim_upstream.c | 12 |
6 files changed, 97 insertions, 70 deletions
diff --git a/.gitignore b/.gitignore index 7a1378d588..df2b0a6bf3 100644 --- a/.gitignore +++ b/.gitignore @@ -88,5 +88,6 @@ GSYMS GRTAGS GPATH compile_commands.json +.ccls-cache .dirstamp refix diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 63b3145b53..1bd153639b 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -1010,14 +1010,17 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd, struct bgp_path_info *pi; int rd_header; int header = 1; + char rd_str[BUFSIZ]; + char buf[BUFSIZ]; unsigned long output_count = 0; unsigned long total_count = 0; json_object *json = NULL; json_object *json_nroute = NULL; json_object *json_array = NULL; - json_object *json_scode = NULL; - json_object *json_ocode = NULL; + json_object *json_prefix_info = NULL; + + memset(rd_str, 0, BUFSIZ); bgp = bgp_get_evpn(); if (bgp == NULL) { @@ -1028,31 +1031,13 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd, return CMD_WARNING; } - if (use_json) { - json_scode = json_object_new_object(); - json_ocode = json_object_new_object(); + if (use_json) json = json_object_new_object(); - json_nroute = json_object_new_object(); - - json_object_string_add(json_scode, "suppressed", "s"); - json_object_string_add(json_scode, "damped", "d"); - json_object_string_add(json_scode, "history", "h"); - json_object_string_add(json_scode, "valid", "*"); - json_object_string_add(json_scode, "best", ">"); - json_object_string_add(json_scode, "internal", "i"); - - json_object_string_add(json_ocode, "igp", "i"); - json_object_string_add(json_ocode, "egp", "e"); - json_object_string_add(json_ocode, "incomplete", "?"); - } for (rn = bgp_table_top(bgp->rib[afi][SAFI_EVPN]); rn; rn = bgp_route_next(rn)) { uint64_t tbl_ver; - if (use_json) - continue; /* XXX json TODO */ - if (prd && memcmp(rn->p.u.val, prd->val, 8) != 0) continue; @@ -1075,28 +1060,23 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd, pi->peer->su_remote, su)) continue; } - if (header == 0) { + if (header) { if (use_json) { - if (option - == SHOW_DISPLAY_TAGS) { - json_object_int_add( - json, - "bgpTableVersion", - tbl_ver); - json_object_string_add( - json, - "bgpLocalRouterId", - inet_ntoa( - bgp->router_id)); - json_object_object_add( - json, - "bgpStatusCodes", - json_scode); - json_object_object_add( - json, - "bgpOriginCodes", - json_ocode); - } + json_object_int_add( + json, "bgpTableVersion", + tbl_ver); + json_object_string_add( + json, + "bgpLocalRouterId", + inet_ntoa( + bgp->router_id)); + json_object_int_add( + json, + "defaultLocPrf", + bgp->default_local_pref); + json_object_int_add( + json, "localAS", + bgp->as); } else { if (option == SHOW_DISPLAY_TAGS) vty_out(vty, @@ -1139,21 +1119,39 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd, else if (type == RD_TYPE_IP) decode_rd_ip(pnt + 2, &rd_ip); if (use_json) { - char buffer[BUFSIZ]; + json_nroute = + json_object_new_object(); + json_prefix_info = + json_object_new_object(); + json_array = + json_object_new_array(); if (type == RD_TYPE_AS || type == RD_TYPE_AS4) - sprintf(buffer, "%u:%d", + sprintf(rd_str, "%u:%d", rd_as.as, rd_as.val); else if (type == RD_TYPE_IP) - sprintf(buffer, "%s:%d", + sprintf(rd_str, "%s:%d", inet_ntoa( rd_ip.ip), rd_ip.val); json_object_string_add( json_nroute, - "routeDistinguisher", - buffer); + "rd", + rd_str); + + json_object_string_add( + json_prefix_info, + "prefix", + bgp_evpn_route2str( + (struct prefix_evpn *) + &rm->p, buf, BUFSIZ)); + + json_object_int_add( + json_prefix_info, + "prefixLen", + rm->p.prefixlen); + } else { vty_out(vty, "Route Distinguisher: "); @@ -1176,10 +1174,6 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd, } rd_header = 0; } - if (use_json) - json_array = json_object_new_array(); - else - json_array = NULL; if (option == SHOW_DISPLAY_TAGS) route_vty_out_tag(vty, &rm->p, pi, 0, SAFI_EVPN, @@ -1192,13 +1186,31 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd, SAFI_EVPN, json_array); output_count++; } - /* XXX json */ + + if (use_json) { + json_object_object_add(json_prefix_info, "paths", + json_array); + json_object_object_add(json_nroute, buf, + json_prefix_info); + json_object_object_add(json, rd_str, json_nroute); + } + } + + if (use_json) { + json_object_int_add(json, "numPrefix", output_count); + json_object_int_add(json, "totalPrefix", total_count); + vty_out(vty, "%s\n", json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + } else { + if (output_count == 0) + vty_out(vty, "No prefixes displayed, %ld exist\n", + total_count); + else + vty_out(vty, + "\nDisplayed %ld out of %ld total prefixes\n", + output_count, total_count); } - if (output_count == 0) - vty_out(vty, "No prefixes displayed, %ld exist\n", total_count); - else - vty_out(vty, "\nDisplayed %ld out of %ld total prefixes\n", - output_count, total_count); return CMD_SUCCESS; } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 01144f5c78..9a8da359ab 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -14951,14 +14951,16 @@ static void lcommunity_list_show(struct vty *vty, struct community_list *list) if (entry == list->head) { if (all_digit(list->name)) vty_out(vty, "Large community %s list %s\n", - entry->style == EXTCOMMUNITY_LIST_STANDARD + entry->style == + LARGE_COMMUNITY_LIST_STANDARD ? "standard" : "(expanded) access", list->name); else vty_out(vty, "Named large community %s list %s\n", - entry->style == EXTCOMMUNITY_LIST_STANDARD + entry->style == + LARGE_COMMUNITY_LIST_STANDARD ? "standard" : "expanded", list->name); diff --git a/configure.ac b/configure.ac index fe60ba2a74..86168a8487 100755 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ ## AC_PREREQ([2.60]) -AC_INIT([frr], [7.1-dev], [https://github.com/frrouting/frr/issues]) +AC_INIT([frr], [7.2-dev], [https://github.com/frrouting/frr/issues]) PACKAGE_URL="https://frrouting.org/" AC_SUBST([PACKAGE_URL]) PACKAGE_FULLNAME="FRRouting" diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst index 35e42d95cb..d663b4fc10 100644 --- a/doc/user/bgp.rst +++ b/doc/user/bgp.rst @@ -942,14 +942,18 @@ Configuring Peers .. index:: [no] neighbor PEER maximum-prefix NUMBER .. clicmd:: [no] neighbor PEER maximum-prefix NUMBER -.. index:: [no] neighbor PEER local-as AS-NUMBER no-prepend -.. clicmd:: [no] neighbor PEER local-as AS-NUMBER no-prepend - -.. index:: [no] neighbor PEER local-as AS-NUMBER no-prepend replace-as -.. clicmd:: [no] neighbor PEER local-as AS-NUMBER no-prepend replace-as - -.. index:: [no] neighbor PEER local-as AS-NUMBER -.. clicmd:: [no] neighbor PEER local-as AS-NUMBER + Sets a maximum number of prefixes we can receive from a given peer. If this + number is exceeded, the BGP session will be destroyed. + + In practice, it is generally preferable to use a prefix-list to limit what + prefixes are received from the peer instead of using this knob. Tearing down + the BGP session when a limit is exceeded is far more destructive than merely + rejecting undesired prefixes. The prefix-list method is also much more + granular and offers much smarter matching criterion than number of received + prefixes, making it more suited to implementing policy. + +.. index:: [no] neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as] +.. clicmd:: [no] neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as] Specify an alternate AS for this BGP process when interacting with the specified peer. With no modifiers, the specified local-as is prepended to diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index b708e86a20..d829d01347 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -1181,8 +1181,16 @@ struct pim_upstream *pim_upstream_keep_alive_timer_proc( "kat expired on %s[%s]; remove stream reference", up->sg_str, pim->vrf->name); PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(up->flags); - up = pim_upstream_del(pim, up, __PRETTY_FUNCTION__); - } else if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(up->flags)) { + + /* Return if upstream entry got deleted.*/ + if (!pim_upstream_del(pim, up, __PRETTY_FUNCTION__)) + return NULL; + } + /* upstream reference would have been added to track the local + * membership if it is LHR. We have to clear it when KAT expires. + * Otherwise would result in stale entry with uncleared ref count. + */ + if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(up->flags)) { struct pim_upstream *parent = up->parent; PIM_UPSTREAM_FLAG_UNSET_SRC_LHR(up->flags); |
