diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index 8153ddcd30..da2ca3181a 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -448,4 +448,8 @@ static inline const struct prefix *bgp_node_get_prefix(struct bgp_node *node) return &node->p; } +#ifdef _FRR_ATTRIBUTE_PRINTFRR +#pragma FRR printfrr_ext "%pRN" (struct bgp_node *) +#endif + #endif /* _QUAGGA_BGP_TABLE_H */ diff --git a/lib/agg_table.h b/lib/agg_table.h index 9fddc975ed..e98476f1b7 100644 --- a/lib/agg_table.h +++ b/lib/agg_table.h @@ -161,6 +161,10 @@ agg_node_get_prefix(const struct agg_node *node) return &node->p; } +#ifdef _FRR_ATTRIBUTE_PRINTFRR +#pragma FRR printfrr_ext "%pRN" (struct agg_node *) +#endif + #ifdef __cplusplus } #endif diff --git a/lib/compiler.h b/lib/compiler.h index e430925e69..217a60d888 100644 --- a/lib/compiler.h +++ b/lib/compiler.h @@ -305,7 +305,14 @@ extern "C" { #include #ifdef _FRR_ATTRIBUTE_PRINTFRR -#define PRINTFRR(a, b) __attribute__((printfrr(a, b))) +#define PRINTFRR(a, b) __attribute__((frr_format("frr_printf", a, b))) + +#undef PRIu64 +#undef PRId64 +#undef PRIx64 +#define PRIu64 "Lu" +#define PRId64 "Ld" +#define PRIx64 "Lx" #else /* !_FRR_ATTRIBUTE_PRINTFRR */ #define PRINTFRR(a, b) __attribute__((format(printf, a, b))) diff --git a/lib/nexthop.h b/lib/nexthop.h index 6710914e40..267f9f28ad 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -201,6 +201,10 @@ extern struct nexthop *nexthop_dup(const struct nexthop *nexthop, extern struct nexthop *nexthop_dup_no_recurse(const struct nexthop *nexthop, struct nexthop *rparent); +#ifdef _FRR_ATTRIBUTE_PRINTFRR +#pragma FRR printfrr_ext "%pNH" (struct nexthop *) +#endif + #ifdef __cplusplus } #endif diff --git a/lib/prefix.h b/lib/prefix.h index 51b3dacb8d..f2952c38c3 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -544,6 +544,22 @@ static inline int is_default_host_route(const struct prefix *p) return 0; } +#ifdef _FRR_ATTRIBUTE_PRINTFRR +#pragma FRR printfrr_ext "%pI4" (struct in_addr *) +#pragma FRR printfrr_ext "%pI4" (in_addr_t *) + +#pragma FRR printfrr_ext "%pI6" (struct in6_addr *) + +#pragma FRR printfrr_ext "%pFX" (struct prefix *) +#pragma FRR printfrr_ext "%pFX" (struct prefix_ipv4 *) +#pragma FRR printfrr_ext "%pFX" (struct prefix_ipv6 *) +#pragma FRR printfrr_ext "%pFX" (struct prefix_eth *) +#pragma FRR printfrr_ext "%pFX" (struct prefix_evpn *) +#pragma FRR printfrr_ext "%pFX" (struct prefix_fs *) + +#pragma FRR printfrr_ext "%pSG4" (struct prefix_sg *) +#endif + #ifdef __cplusplus } #endif diff --git a/lib/printfrr.h b/lib/printfrr.h index f9584bcacc..6fcfbe31fa 100644 --- a/lib/printfrr.h +++ b/lib/printfrr.h @@ -31,7 +31,7 @@ struct fbuf { }; #define at(a, b) \ - __attribute__((format(printf, a, b))) + PRINTFRR(a, b) #define atn(a, b) \ at(a, b) __attribute__((nonnull(1) _RET_NONNULL)) #define atm(a, b) \ @@ -75,6 +75,7 @@ char *asnprintfrr(struct memtype *mt, char *out, size_t sz, #undef at #undef atm +#undef atn /* extension specs must start with a capital letter (this is a restriction * for both performance's and human understanding's sake.) diff --git a/lib/table.h b/lib/table.h index 7743d51681..9cd9503376 100644 --- a/lib/table.h +++ b/lib/table.h @@ -331,6 +331,10 @@ static inline int route_table_iter_started(route_table_iter_t *iter) return iter->state != RT_ITER_STATE_INIT; } +#ifdef _FRR_ATTRIBUTE_PRINTFRR +#pragma FRR printfrr_ext "%pRN" (struct route_node *) +#endif + #ifdef __cplusplus } #endif diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 29d59b515f..dc54dee785 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -112,7 +112,7 @@ static const struct { /* no entry/default: 150 */ }; -static void __attribute__((format(printf, 5, 6))) +static void PRINTFRR(5, 6) _rnode_zlog(const char *_func, vrf_id_t vrf_id, struct route_node *rn, int priority, const char *msgfmt, ...) {