diff options
author | Louis Scalbert <louis.scalbert@6wind.com> | 2023-04-21 11:56:07 +0200 |
---|---|---|
committer | Louis Scalbert <louis.scalbert@6wind.com> | 2023-09-18 14:57:03 +0200 |
commit | bdb3fa3b9216aede64c5b982011fb04ef25c67f7 (patch) | |
tree | 57ca5e4069208043238c4fa518a23bd2e32630d2 /lib | |
parent | bgpd: send bgp link-state prefixes (diff) | |
download | frr-bdb3fa3b9216aede64c5b982011fb04ef25c67f7.tar.xz frr-bdb3fa3b9216aede64c5b982011fb04ef25c67f7.zip |
bgpd, lib: extend the size of the prefix string buffer
BGP Link-State prefixes are special prefixes that contains a lot of
data.
Extend the length of the prefix string buffer in order to display
properly this type of prefixes with the next commits.
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/prefix.c | 6 | ||||
-rw-r--r-- | lib/prefix.h | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/prefix.c b/lib/prefix.c index 59acc7c22..35bc3b3b6 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -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[PREFIX2STR_BUFFER]; + char buf[PREFIX_STRLEN_EXTENDED]; 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[PREFIX2STR_BUFFER]; + char buf[PREFIX_STRLEN_EXTENDED]; 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]; + char cbuf[PREFIX_STRLEN_EXTENDED]; prefix2str(ptr, cbuf, sizeof(cbuf)); return bputs(buf, cbuf); diff --git a/lib/prefix.h b/lib/prefix.h index dacdbf905..f1aff4368 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -347,6 +347,11 @@ 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 |