Revert "bgpd, lib: extend the size of the prefix string buffer"

This reverts commit bdb3fa3b92.
This commit is contained in:
Donald Sharp 2023-10-10 16:44:34 -04:00
parent 85a63731dc
commit 8b3e765d19
4 changed files with 9 additions and 14 deletions

View File

@ -1581,7 +1581,7 @@ static enum filter_type bgp_input_filter(struct peer *peer,
done:
if (frrtrace_enabled(frr_bgp, input_filter)) {
char pfxprint[PREFIX_STRLEN_EXTENDED];
char pfxprint[PREFIX2STR_BUFFER];
prefix2str(p, pfxprint, sizeof(pfxprint));
frrtrace(5, frr_bgp, input_filter, peer, pfxprint, afi, safi,
@ -1638,7 +1638,7 @@ static enum filter_type bgp_output_filter(struct peer *peer,
}
if (frrtrace_enabled(frr_bgp, output_filter)) {
char pfxprint[PREFIX_STRLEN_EXTENDED];
char pfxprint[PREFIX2STR_BUFFER];
prefix2str(p, pfxprint, sizeof(pfxprint));
frrtrace(5, frr_bgp, output_filter, peer, pfxprint, afi, safi,
@ -2712,7 +2712,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest,
int paths_eq, do_mpath;
bool debug;
struct list mp_list;
char pfx_buf[PREFIX_STRLEN_EXTENDED] = {};
char pfx_buf[PREFIX2STR_BUFFER] = {};
char path_buf[PATH_ADDPATH_STR_BUFFER];
bgp_mp_list_init(&mp_list);
@ -4167,7 +4167,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
int allowas_in = 0;
if (frrtrace_enabled(frr_bgp, process_update)) {
char pfxprint[PREFIX_STRLEN_EXTENDED];
char pfxprint[PREFIX2STR_BUFFER];
prefix2str(p, pfxprint, sizeof(pfxprint));
frrtrace(6, frr_bgp, process_update, peer, pfxprint, addpath_id,
@ -8772,7 +8772,7 @@ static void route_vty_out_route(struct bgp_dest *dest, const struct prefix *p,
struct vty *vty, json_object *json, bool wide)
{
int len = 0;
char buf[PREFIX_STRLEN_EXTENDED];
char buf[INET6_ADDRSTRLEN];
if (p->family == AF_INET) {
if (!json) {

View File

@ -63,7 +63,7 @@ struct bgp_dest *bgp_dest_lock_node(struct bgp_dest *dest)
const char *bgp_dest_get_prefix_str(struct bgp_dest *dest)
{
const struct prefix *p = NULL;
static char str[PREFIX_STRLEN_EXTENDED] = {0};
static char str[PREFIX_STRLEN] = {0};
p = bgp_dest_get_prefix(dest);
if (p)

View File

@ -1166,7 +1166,7 @@ const char *bgp_linkstate_nlri_type_2str(uint16_t nlri_type)
const char *prefix2str(union prefixconstptr pu, char *str, int size)
{
const struct prefix *p = pu.p;
char buf[PREFIX_STRLEN_EXTENDED];
char buf[PREFIX2STR_BUFFER];
int byte, tmp, a, b;
bool z = false;
size_t l;
@ -1234,7 +1234,7 @@ const char *prefix2str(union prefixconstptr pu, char *str, int size)
static ssize_t prefixhost2str(struct fbuf *fbuf, union prefixconstptr pu)
{
const struct prefix *p = pu.p;
char buf[PREFIX_STRLEN_EXTENDED];
char buf[PREFIX2STR_BUFFER];
switch (p->family) {
case AF_INET:
@ -1752,7 +1752,7 @@ static ssize_t printfrr_pfx(struct fbuf *buf, struct printfrr_eargs *ea,
if (host_only)
return prefixhost2str(buf, (struct prefix *)ptr);
else {
char cbuf[PREFIX_STRLEN_EXTENDED];
char cbuf[PREFIX_STRLEN];
prefix2str(ptr, cbuf, sizeof(cbuf));
return bputs(buf, cbuf);

View File

@ -347,11 +347,6 @@ union prefixconstptr {
/* Maximum string length of the result of prefix2str */
#define PREFIX_STRLEN 80
/* Maximum string length of the result of prefix2str for
* long string prefixes (eg. BGP Link-State)
*/
#define PREFIX_STRLEN_EXTENDED 512
/*
* Longest possible length of a (S,G) string is 34 bytes
* 123.123.123.123 = 15 * 2