diff options
| author | Mark Stapp <mjs@voltanet.io> | 2021-03-31 09:10:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-31 09:10:30 -0400 |
| commit | e2efe13327adefb655811bdb03bb76b95db2407c (patch) | |
| tree | b9fa898013c23be16c8a50ee477af017ab52220a /lib/srcdest_table.c | |
| parent | fb639375cb2ca062f350c56c51367f2d8d5b2514 (diff) | |
| parent | 19b1a1c6a975f772b22dda9c5c42c6288e2ce459 (diff) | |
Merge pull request #8350 from opensourcerouting/printfrr-revamp
lib: `printfrr()` care package
Diffstat (limited to 'lib/srcdest_table.c')
| -rw-r--r-- | lib/srcdest_table.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/srcdest_table.c b/lib/srcdest_table.c index a115507192..d2e0682e95 100644 --- a/lib/srcdest_table.c +++ b/lib/srcdest_table.c @@ -307,20 +307,20 @@ const char *srcdest_rnode2str(const struct route_node *rn, char *str, int size) } printfrr_ext_autoreg_p("RN", printfrr_rn) -static ssize_t printfrr_rn(char *buf, size_t bsz, const char *fmt, - int prec, const void *ptr) +static ssize_t printfrr_rn(struct fbuf *buf, struct printfrr_eargs *ea, + const void *ptr) { const struct route_node *rn = ptr; const struct prefix *dst_p, *src_p; + char cbuf[PREFIX_STRLEN * 2 + 6]; - if (rn) { - srcdest_rnode_prefixes(rn, &dst_p, &src_p); - srcdest2str(dst_p, (const struct prefix_ipv6 *)src_p, buf, bsz); - } else { - strlcpy(buf, "NULL", bsz); - } + if (!rn) + return bputs(buf, "(null)"); - return 2; + srcdest_rnode_prefixes(rn, &dst_p, &src_p); + srcdest2str(dst_p, (const struct prefix_ipv6 *)src_p, + cbuf, sizeof(cbuf)); + return bputs(buf, cbuf); } struct route_table *srcdest_srcnode_table(struct route_node *rn) |
