diff options
Diffstat (limited to 'bgpd')
| -rw-r--r-- | bgpd/bgp_ecommunity.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_evpn_vty.c | 15 | ||||
| -rw-r--r-- | bgpd/bgp_io.c | 13 | ||||
| -rw-r--r-- | bgpd/bgp_labelpool.c | 10 | ||||
| -rw-r--r-- | bgpd/bgp_mplsvpn.c | 17 | ||||
| -rw-r--r-- | bgpd/bgp_mplsvpn.h | 3 | ||||
| -rw-r--r-- | bgpd/bgp_packet.c | 3 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 32 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_vty.h | 3 |
9 files changed, 47 insertions, 51 deletions
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 62fba1f58e..04005884ae 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -699,6 +699,7 @@ static struct ecommunity *ecommunity_str2com_internal(const char *str, int type, while ((str = ecommunity_gettoken(str, (void *)&eval, &token))) { switch (token) { case ecommunity_token_rt: + case ecommunity_token_rt6: case ecommunity_token_soo: if (!keyword_included || keyword) { if (ecom) @@ -746,7 +747,6 @@ static struct ecommunity *ecommunity_str2com_internal(const char *str, int type, ecom->unit_size); break; case ecommunity_token_unknown: - default: if (ecom) ecommunity_free(&ecom); return NULL; diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 3c7fb4cb17..0b5f81ccb0 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -4807,14 +4807,13 @@ DEFUN(show_bgp_l2vpn_evpn_route, evpn_show_all_routes(vty, bgp, type, json, detail); - if (uj) { - if (detail) { - vty_out(vty, "%s\n", json_object_to_json_string(json)); - json_object_free(json); - } else { - vty_json(vty, json); - } - } + /* + * This is an extremely expensive operation at scale + * and as such we need to save as much time as is + * possible. + */ + if (uj) + vty_json_no_pretty(vty, json); return CMD_SUCCESS; } diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 49ae9816a3..f9dc64af45 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -173,12 +173,11 @@ static int read_ibuf_work(struct peer *peer) uint16_t pktsize = 0; struct stream *pkt; - /* Hold the I/O lock, we might not have space on the InQ */ - frr_mutex_lock_autounlock(&peer->io_mtx); /* ============================================== */ - - if (peer->ibuf->count >= bm->inq_limit) - return -ENOMEM; + frr_with_mutex (&peer->io_mtx) { + if (peer->ibuf->count >= bm->inq_limit) + return -ENOMEM; + } /* check that we have enough data for a header */ if (ringbuf_remain(ibw) < BGP_HEADER_SIZE) @@ -211,7 +210,9 @@ static int read_ibuf_work(struct peer *peer) stream_set_endp(pkt, pktsize); frrtrace(2, frr_bgp, packet_read, peer, pkt); - stream_fifo_push(peer->ibuf, pkt); + frr_with_mutex (&peer->io_mtx) { + stream_fifo_push(peer->ibuf, pkt); + } return pktsize; } diff --git a/bgpd/bgp_labelpool.c b/bgpd/bgp_labelpool.c index 129878451d..d60552011c 100644 --- a/bgpd/bgp_labelpool.c +++ b/bgpd/bgp_labelpool.c @@ -743,22 +743,12 @@ DEFUN(show_bgp_labelpool_summary, show_bgp_labelpool_summary_cmd, if (uj) { json = json_object_new_object(); -#if CONFDATE > 20230131 -CPP_NOTICE("Remove JSON object commands with keys starting with capital") -#endif - json_object_int_add(json, "Ledger", skiplist_count(lp->ledger)); json_object_int_add(json, "ledger", skiplist_count(lp->ledger)); - json_object_int_add(json, "InUse", skiplist_count(lp->inuse)); json_object_int_add(json, "inUse", skiplist_count(lp->inuse)); - json_object_int_add(json, "Requests", - lp_fifo_count(&lp->requests)); json_object_int_add(json, "requests", lp_fifo_count(&lp->requests)); - json_object_int_add(json, "LabelChunks", listcount(lp->chunks)); json_object_int_add(json, "labelChunks", listcount(lp->chunks)); - json_object_int_add(json, "Pending", lp->pending_count); json_object_int_add(json, "pending", lp->pending_count); - json_object_int_add(json, "Reconnects", lp->reconnect_count); json_object_int_add(json, "reconnects", lp->reconnect_count); vty_json(vty, json); } else { diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 288115f211..33e7d971ad 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -1192,7 +1192,7 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn, if (!ecommunity_cmp( bgp_attr_get_ecommunity(bpi->attr), bgp_attr_get_ecommunity(new_attr))) { - vpn_leak_to_vrf_withdraw(to_bgp, bpi); + vpn_leak_to_vrf_withdraw(bpi); bgp_aggregate_decrement(to_bgp, p, bpi, afi, safi); bgp_path_info_delete(bn, bpi); @@ -1722,7 +1722,7 @@ void vpn_leak_from_vrf_withdraw(struct bgp *to_bgp, /* to */ if (bpi) { /* withdraw from looped vrfs as well */ - vpn_leak_to_vrf_withdraw(to_bgp, bpi); + vpn_leak_to_vrf_withdraw(bpi); bgp_aggregate_decrement(to_bgp, p, bpi, afi, safi); bgp_path_info_delete(bn, bpi); @@ -1777,7 +1777,7 @@ void vpn_leak_from_vrf_withdraw_all(struct bgp *to_bgp, struct bgp *from_bgp, zlog_debug("%s: deleting it", __func__); /* withdraw from leak-to vrfs as well */ - vpn_leak_to_vrf_withdraw(to_bgp, bpi); + vpn_leak_to_vrf_withdraw(bpi); bgp_aggregate_decrement( to_bgp, bgp_dest_get_prefix(bn), bpi, afi, safi); @@ -1873,7 +1873,10 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp, /* to */ if (!vpn_leak_from_vpn_active(to_bgp, afi, &debugmsg)) { if (debug) - zlog_debug("%s: skipping: %s", __func__, debugmsg); + zlog_debug( + "%s: from vpn (%s) to vrf (%s), skipping: %s", + __func__, from_bgp->name_pretty, + to_bgp->name_pretty, debugmsg); return false; } @@ -2115,8 +2118,7 @@ bool vpn_leak_to_vrf_update(struct bgp *from_bgp, return leak_success; } -void vpn_leak_to_vrf_withdraw(struct bgp *from_bgp, /* from */ - struct bgp_path_info *path_vpn) /* route */ +void vpn_leak_to_vrf_withdraw(struct bgp_path_info *path_vpn) { const struct prefix *p; afi_t afi; @@ -2159,7 +2161,8 @@ void vpn_leak_to_vrf_withdraw(struct bgp *from_bgp, /* from */ for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp)) { if (!vpn_leak_from_vpn_active(bgp, afi, &debugmsg)) { if (debug) - zlog_debug("%s: skipping: %s", __func__, + zlog_debug("%s: from %s, skipping: %s", + __func__, bgp->name_pretty, debugmsg); continue; } diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index 7b57e4c75d..b54476e5d3 100644 --- a/bgpd/bgp_mplsvpn.h +++ b/bgpd/bgp_mplsvpn.h @@ -75,8 +75,7 @@ extern bool vpn_leak_to_vrf_update(struct bgp *from_bgp, struct bgp_path_info *path_vpn, struct prefix_rd *prd); -extern void vpn_leak_to_vrf_withdraw(struct bgp *from_bgp, - struct bgp_path_info *path_vpn); +extern void vpn_leak_to_vrf_withdraw(struct bgp_path_info *path_vpn); extern void vpn_leak_zebra_vrf_label_update(struct bgp *bgp, afi_t afi); extern void vpn_leak_zebra_vrf_label_withdraw(struct bgp *bgp, afi_t afi); diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 9e7c75318e..080cf0ae40 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -2033,7 +2033,8 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) break; case NLRI_WITHDRAW: case NLRI_MP_WITHDRAW: - nlri_ret = bgp_nlri_parse(peer, &attr, &nlris[i], 1); + nlri_ret = bgp_nlri_parse(peer, NLRI_ATTR_ARG, + &nlris[i], 1); break; default: nlri_ret = BGP_NLRI_PARSE_ERROR; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index c9cfc44da0..d7ff0e3c0a 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4456,8 +4456,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, bgp_evpn_unimport_route( bgp, afi, safi, p, pi); else /* SAFI_MPLS_VPN */ - vpn_leak_to_vrf_withdraw(bgp, - pi); + vpn_leak_to_vrf_withdraw(pi); } } } @@ -4877,7 +4876,7 @@ filtered: if ((SAFI_MPLS_VPN == safi) && (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) { - vpn_leak_to_vrf_withdraw(bgp, pi); + vpn_leak_to_vrf_withdraw(pi); } bgp_rib_remove(dest, pi, peer, afi, safi); @@ -4979,7 +4978,7 @@ void bgp_withdraw(struct peer *peer, const struct prefix *p, if ((SAFI_MPLS_VPN == safi) && (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) { - vpn_leak_to_vrf_withdraw(bgp, pi); + vpn_leak_to_vrf_withdraw(pi); } } else if (bgp_debug_update(peer, p, NULL, 1)) { bgp_debug_rdpfxpath2str(afi, safi, prd, p, label, num_labels, @@ -5419,7 +5418,7 @@ static wq_item_status bgp_clear_route_node(struct work_queue *wq, void *data) } if (SAFI_MPLS_VPN == safi && bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) { - vpn_leak_to_vrf_withdraw(bgp, pi); + vpn_leak_to_vrf_withdraw(pi); } bgp_rib_remove(dest, pi, peer, afi, safi); @@ -5688,8 +5687,7 @@ void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi) BGP_ROUTE_IMPORTED && peer->bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) - vpn_leak_to_vrf_withdraw( - peer->bgp, pi); + vpn_leak_to_vrf_withdraw(pi); bgp_rib_remove(rm, pi, peer, afi, safi); break; @@ -6384,7 +6382,7 @@ static void bgp_static_withdraw_safi(struct bgp *bgp, const struct prefix *p, #endif if (SAFI_MPLS_VPN == safi && bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) { - vpn_leak_to_vrf_withdraw(bgp, pi); + vpn_leak_to_vrf_withdraw(pi); } bgp_aggregate_decrement(bgp, p, pi, afi, safi); bgp_path_info_delete(dest, pi); @@ -9858,8 +9856,6 @@ void route_vty_out_overlay(struct vty *vty, const struct prefix *p, if (!json_path) { vty_out(vty, "?"); } else { - json_object_string_add(json_nexthop, "Error", - "Unsupported address-family"); json_object_string_add(json_nexthop, "error", "Unsupported address-family"); } @@ -10227,12 +10223,9 @@ 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]) { - json_object_string_add(json_path, "VNI", - tag_buf); + if (tag_buf[0]) json_object_string_add(json_path, "vni", tag_buf); - } } } } @@ -11593,7 +11586,16 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, else vty_out(vty, ",\"%pFX\": ", dest_p); } - vty_json(vty, json_paths); + /* + * We are using no_pretty here because under + * extremely high settings( say lots and lots of + * routes with lots and lots of ways to reach + * that route via different paths ) this can + * save several minutes of output when FRR + * is run on older cpu's or more underperforming + * routers out there + */ + vty_json_no_pretty(vty, json_paths); json_paths = NULL; first = 0; } else diff --git a/bgpd/rfapi/rfapi_vty.h b/bgpd/rfapi/rfapi_vty.h index 09e1b3c4c4..c8b8613feb 100644 --- a/bgpd/rfapi/rfapi_vty.h +++ b/bgpd/rfapi/rfapi_vty.h @@ -62,7 +62,8 @@ extern int rfapiStr2EthAddr(const char *str, struct ethaddr *ea); extern const char *rfapi_ntop(int af, const void *src, char *buf, socklen_t size); -extern int rfapiDebugPrintf(void *dummy, const char *format, ...); +extern int rfapiDebugPrintf(void *dummy, const char *format, ...) + PRINTFRR(2, 3); extern int rfapiStream2Vty(void *stream, /* input */ int (**fp)(void *, const char *, ...), /* output */ |
