mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 15:27:59 +00:00
zebra: replace _rnode_zlog with %pZN ext
Since _rnode_zlog was wrapping zlog(), these messages weren't getting an unique ID assigned through the xref mechanism. Replace macro with a small extension that prints (almost) the same thing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
83187b8285
commit
9d75e30960
@ -132,40 +132,60 @@ struct wq_nhg_wrapper {
|
|||||||
#define WQ_NHG_WRAPPER_TYPE_CTX 0x01
|
#define WQ_NHG_WRAPPER_TYPE_CTX 0x01
|
||||||
#define WQ_NHG_WRAPPER_TYPE_NHG 0x02
|
#define WQ_NHG_WRAPPER_TYPE_NHG 0x02
|
||||||
|
|
||||||
static void PRINTFRR(5, 6)
|
/* %pRN is already a printer for route_nodes that just prints the prefix */
|
||||||
_rnode_zlog(const char *_func, vrf_id_t vrf_id, struct route_node *rn,
|
#ifdef _FRR_ATTRIBUTE_PRINTFRR
|
||||||
int priority, const char *msgfmt, ...)
|
#pragma FRR printfrr_ext "%pZN" (struct route_node *)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
printfrr_ext_autoreg_p("ZN", printfrr_zebra_node);
|
||||||
|
static ssize_t printfrr_zebra_node(struct fbuf *buf, struct printfrr_eargs *ea,
|
||||||
|
const void *ptr)
|
||||||
{
|
{
|
||||||
char buf[SRCDEST2STR_BUFFER + sizeof(" (MRIB)")];
|
struct route_node *rn = (struct route_node *)ptr;
|
||||||
char msgbuf[512];
|
ssize_t rv = 0;
|
||||||
va_list ap;
|
|
||||||
uint32_t table = 0;
|
|
||||||
|
|
||||||
va_start(ap, msgfmt);
|
/* just the table number? */
|
||||||
vsnprintf(msgbuf, sizeof(msgbuf), msgfmt, ap);
|
if (ea->fmt[0] == 't') {
|
||||||
va_end(ap);
|
rib_dest_t *dest;
|
||||||
|
|
||||||
if (rn) {
|
|
||||||
struct rib_table_info *info = srcdest_rnode_table_info(rn);
|
|
||||||
rib_dest_t *dest = NULL;
|
|
||||||
struct route_entry *re = NULL;
|
struct route_entry *re = NULL;
|
||||||
|
|
||||||
srcdest_rnode2str(rn, buf, sizeof(buf));
|
ea->fmt++;
|
||||||
|
|
||||||
if (info->safi == SAFI_MULTICAST)
|
if (!rn)
|
||||||
strlcat(buf, " (MRIB)", sizeof(buf));
|
return bputch(buf, '!');
|
||||||
|
|
||||||
dest = rib_dest_from_rnode(rn);
|
dest = rib_dest_from_rnode(rn);
|
||||||
if (dest)
|
if (dest)
|
||||||
re = re_list_first(&dest->routes);
|
re = re_list_first(&dest->routes);
|
||||||
if (re)
|
if (re)
|
||||||
table = re->table;
|
rv += bprintfrr(buf, "%u", re->table);
|
||||||
|
else
|
||||||
|
rv += bputch(buf, '?');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
snprintf(buf, sizeof(buf), "{(route_node *) NULL}");
|
char cbuf[PREFIX_STRLEN * 2 + 6];
|
||||||
|
struct rib_table_info *info;
|
||||||
|
|
||||||
|
if (!rn)
|
||||||
|
return bputs(buf, "{(route_node *) NULL}");
|
||||||
|
|
||||||
|
srcdest_rnode2str(rn, cbuf, sizeof(cbuf));
|
||||||
|
rv += bputs(buf, cbuf);
|
||||||
|
|
||||||
|
info = srcdest_rnode_table_info(rn);
|
||||||
|
if (info->safi == SAFI_MULTICAST)
|
||||||
|
rv += bputs(buf, " (MRIB)");
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
zlog(priority, "%s: (%u:%u):%s: %s", _func, vrf_id, table, buf, msgbuf);
|
#define rnode_debug(node, vrf_id, msg, ...) \
|
||||||
}
|
zlog_debug("%s: (%u:%pZNt):%pZN: " msg, __func__, vrf_id, node, node, \
|
||||||
|
##__VA_ARGS__)
|
||||||
|
|
||||||
|
#define rnode_info(node, vrf_id, msg, ...) \
|
||||||
|
zlog_info("%s: (%u:%pZNt):%pZN: " msg, __func__, vrf_id, node, node, \
|
||||||
|
##__VA_ARGS__)
|
||||||
|
|
||||||
static char *_dump_re_status(const struct route_entry *re, char *buf,
|
static char *_dump_re_status(const struct route_entry *re, char *buf,
|
||||||
size_t len)
|
size_t len)
|
||||||
@ -191,11 +211,6 @@ static char *_dump_re_status(const struct route_entry *re, char *buf,
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define rnode_debug(node, vrf_id, ...) \
|
|
||||||
_rnode_zlog(__func__, vrf_id, node, LOG_DEBUG, __VA_ARGS__)
|
|
||||||
#define rnode_info(node, ...) \
|
|
||||||
_rnode_zlog(__func__, vrf_id, node, LOG_INFO, __VA_ARGS__)
|
|
||||||
|
|
||||||
uint8_t route_distance(int type)
|
uint8_t route_distance(int type)
|
||||||
{
|
{
|
||||||
uint8_t distance;
|
uint8_t distance;
|
||||||
|
Loading…
Reference in New Issue
Block a user