diff options
| author | David Lamparter <equinox@diac24.net> | 2019-05-14 16:28:31 +0200 | 
|---|---|---|
| committer | David Lamparter <equinox@diac24.net> | 2019-06-03 18:57:31 +0200 | 
| commit | d52ec5720f6076283c561111503387781e3f3f07 (patch) | |
| tree | a2b34e7d68bfab13de321504b31e3a4b1ab0da9b /lib/srcdest_table.c | |
| parent | 807f5b98424bc52ae9f0dc249fe14becfff9bf89 (diff) | |
lib: add some printfrr specifiers
More to come - these are just the most obvious and easy.
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/srcdest_table.c')
| -rw-r--r-- | lib/srcdest_table.c | 18 | 
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/srcdest_table.c b/lib/srcdest_table.c index 80004b41ac..ee87d73077 100644 --- a/lib/srcdest_table.c +++ b/lib/srcdest_table.c @@ -28,6 +28,7 @@  #include "memory.h"  #include "prefix.h"  #include "table.h" +#include "printfrr.h"  DEFINE_MTYPE_STATIC(LIB, ROUTE_SRC_NODE, "Route source node") @@ -264,7 +265,8 @@ struct route_node *srcdest_rnode_lookup(struct route_table *table,  	return srn;  } -void srcdest_rnode_prefixes(struct route_node *rn, const struct prefix **p, +void srcdest_rnode_prefixes(const struct route_node *rn, +			    const struct prefix **p,  			    const struct prefix **src_p)  {  	if (rnode_is_srcnode(rn)) { @@ -296,10 +298,22 @@ const char *srcdest2str(const struct prefix *dst_p,  	return str;  } -const char *srcdest_rnode2str(struct route_node *rn, char *str, int size) +const char *srcdest_rnode2str(const struct route_node *rn, char *str, int size)  {  	const struct prefix *dst_p, *src_p;  	srcdest_rnode_prefixes(rn, &dst_p, &src_p);  	return srcdest2str(dst_p, (const struct prefix_ipv6 *)src_p, str, 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) +{ +	const struct route_node *rn = ptr; +	const struct prefix *dst_p, *src_p; + +	srcdest_rnode_prefixes(rn, &dst_p, &src_p); +	srcdest2str(dst_p, (const struct prefix_ipv6 *)src_p, buf, bsz); +	return 2; +}  | 
