summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2020-10-18 13:33:54 +0200
committerDonatas Abraitis <donatas.abraitis@gmail.com>2020-10-22 08:07:41 +0200
commit2dbe669bdf0f0bcbf0228ccdab7b631bd8b934f1 (patch)
tree69c38032b07630b46d2d5852200789b13392153c
parentMerge pull request #7353 from AnuradhaKaruppiah/mh-cleanup-fix-1 (diff)
downloadfrr-2dbe669bdf0f0bcbf0228ccdab7b631bd8b934f1.tar.xz
frr-2dbe669bdf0f0bcbf0228ccdab7b631bd8b934f1.zip
:* Convert prefix2str to %pFX
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
-rw-r--r--bfdd/ptm_adapter.c5
-rw-r--r--bgpd/bgp_bfd.c19
-rw-r--r--bgpd/bgp_debug.c42
-rw-r--r--bgpd/bgp_evpn.c121
-rw-r--r--bgpd/bgp_evpn_mh.c11
-rw-r--r--bgpd/bgp_flowspec_util.c11
-rw-r--r--bgpd/bgp_label.c11
-rw-r--r--bgpd/bgp_mplsvpn.c10
-rw-r--r--bgpd/bgp_nht.c19
-rw-r--r--bgpd/bgp_pbr.c19
-rw-r--r--bgpd/bgp_route.c48
-rw-r--r--bgpd/bgp_rpki.c19
-rw-r--r--bgpd/bgp_updgrp_packet.c16
-rw-r--r--bgpd/bgp_vty.c13
-rw-r--r--bgpd/bgp_zebra.c88
-rw-r--r--bgpd/bgpd.c13
-rw-r--r--bgpd/rfapi/bgp_rfapi_cfg.c32
-rw-r--r--bgpd/rfapi/rfapi.c46
-rw-r--r--bgpd/rfapi/rfapi_import.c38
-rw-r--r--bgpd/rfapi/rfapi_monitor.c28
-rw-r--r--bgpd/rfapi/rfapi_rib.c45
-rw-r--r--bgpd/rfapi/rfapi_vty.c19
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c152
-rw-r--r--bgpd/rfapi/vnc_zebra.c20
-rw-r--r--eigrpd/eigrp_dump.c4
-rw-r--r--eigrpd/eigrp_reply.c7
-rw-r--r--eigrpd/eigrp_topology.c10
-rw-r--r--eigrpd/eigrp_update.c6
-rw-r--r--eigrpd/eigrp_zebra.c32
-rw-r--r--isisd/isis_circuit.c60
-rw-r--r--isisd/isis_lsp.c23
-rw-r--r--isisd/isis_redist.c18
-rw-r--r--isisd/isis_route.c21
-rw-r--r--isisd/isis_zebra.c22
-rw-r--r--lib/routemap.c24
-rw-r--r--lib/zclient.c50
-rw-r--r--nhrpd/nhrp_interface.c14
-rw-r--r--nhrpd/nhrp_route.c27
-rw-r--r--nhrpd/nhrp_shortcut.c28
-rw-r--r--ospf6d/ospf6_abr.c101
-rw-r--r--ospf6d/ospf6_area.c5
-rw-r--r--ospf6d/ospf6_asbr.c100
-rw-r--r--ospf6d/ospf6_bfd.c9
-rw-r--r--ospf6d/ospf6_interface.c13
-rw-r--r--ospf6d/ospf6_intra.c29
-rw-r--r--ospf6d/ospf6_lsa.h20
-rw-r--r--ospf6d/ospf6_lsdb.c6
-rw-r--r--ospf6d/ospf6_route.c8
-rw-r--r--ospf6d/ospf6_spf.c9
-rw-r--r--ospf6d/ospf6_top.c10
-rw-r--r--ospf6d/ospf6_zebra.c21
-rw-r--r--ospfd/ospf_abr.c24
-rw-r--r--ospfd/ospf_bfd.c9
-rw-r--r--ospfd/ospf_zebra.c97
-rw-r--r--pbrd/pbr_nht.c6
-rw-r--r--pbrd/pbr_vty.c15
-rw-r--r--pbrd/pbr_zebra.c37
-rw-r--r--pimd/pim_bfd.c9
-rw-r--r--pimd/pim_bsm.c45
-rw-r--r--pimd/pim_cmd.c23
-rw-r--r--pimd/pim_iface.c18
-rw-r--r--pimd/pim_nht.c64
-rw-r--r--pimd/pim_rp.c130
-rw-r--r--pimd/pim_upstream.c19
-rw-r--r--pimd/pim_zebra.c25
-rw-r--r--sharpd/sharp_nht.c11
-rw-r--r--sharpd/sharp_vty.c10
-rw-r--r--staticd/static_zebra.c15
-rw-r--r--tests/bgpd/test_bgp_table.c5
-rw-r--r--tests/lib/cli/test_cli.c6
-rw-r--r--tests/lib/test_table.c4
-rw-r--r--zebra/connected.c30
-rw-r--r--zebra/interface.c18
-rw-r--r--zebra/irdp_main.c10
-rw-r--r--zebra/redistribute.c60
-rw-r--r--zebra/rt_netlink.c12
-rw-r--r--zebra/rt_socket.c22
-rw-r--r--zebra/rtadv.c4
-rw-r--r--zebra/rule_netlink.c29
-rw-r--r--zebra/zapi_msg.c55
-rw-r--r--zebra/zebra_dplane.c40
-rw-r--r--zebra/zebra_evpn.c4
-rw-r--r--zebra/zebra_fpm.c5
-rw-r--r--zebra/zebra_gr.c10
-rw-r--r--zebra/zebra_mpls.c39
-rw-r--r--zebra/zebra_nb_config.c12
-rw-r--r--zebra/zebra_rib.c43
-rw-r--r--zebra/zebra_rnh.c5
-rw-r--r--zebra/zebra_vxlan.c34
-rw-r--r--zebra/zserv.c8
90 files changed, 860 insertions, 1674 deletions
diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c
index 48e55bce3..3a80d9203 100644
--- a/bfdd/ptm_adapter.c
+++ b/bfdd/ptm_adapter.c
@@ -783,17 +783,16 @@ static void bfdd_sessions_enable_address(struct connected *ifc)
static int bfdd_interface_address_update(ZAPI_CALLBACK_ARGS)
{
struct connected *ifc;
- char buf[64];
ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (ifc == NULL)
return 0;
if (bglobal.debug_zebra)
- zlog_debug("zclient: %s local address %s",
+ zlog_debug("zclient: %s local address %pFX",
cmd == ZEBRA_INTERFACE_ADDRESS_ADD ? "add"
: "delete",
- prefix2str(ifc->address, buf, sizeof(buf)));
+ ifc->address);
bfdd_sessions_enable_address(ifc);
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c
index 1e1c97c2d..7e1d64056 100644
--- a/bgpd/bgp_bfd.c
+++ b/bgpd/bgp_bfd.c
@@ -385,24 +385,21 @@ static int bgp_bfd_dest_update(ZAPI_CALLBACK_ARGS)
if (BGP_DEBUG(zebra, ZEBRA)) {
struct vrf *vrf;
- char buf[2][PREFIX2STR_BUFFER];
vrf = vrf_lookup_by_id(vrf_id);
- prefix2str(&dp, buf[0], sizeof(buf[0]));
- if (ifp) {
+
+ if (ifp)
zlog_debug(
- "Zebra: vrf %s(%u) interface %s bfd destination %s %s %s",
- VRF_LOGNAME(vrf), vrf_id, ifp->name,
- buf[0], bfd_get_status_str(status),
+ "Zebra: vrf %s(%u) interface %s bfd destination %pFX %s %s",
+ VRF_LOGNAME(vrf), vrf_id, ifp->name, &dp,
+ bfd_get_status_str(status),
remote_cbit ? "(cbit on)" : "");
- } else {
- prefix2str(&sp, buf[1], sizeof(buf[1]));
+ else
zlog_debug(
- "Zebra: vrf %s(%u) source %s bfd destination %s %s %s",
- VRF_LOGNAME(vrf), vrf_id, buf[1], buf[0],
+ "Zebra: vrf %s(%u) source %pFX bfd destination %pFX %s %s",
+ VRF_LOGNAME(vrf), vrf_id, &sp, &dp,
bfd_get_status_str(status),
remote_cbit ? "(cbit on)" : "");
- }
}
/* Bring the peer down if BFD is enabled in BGP */
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index e7e349daa..a513bc493 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -237,7 +237,6 @@ static void bgp_debug_list_print(struct vty *vty, const char *desc,
{
struct bgp_debug_filter *filter;
struct listnode *node, *nnode;
- char buf[PREFIX2STR_BUFFER];
vty_out(vty, "%s", desc);
@@ -249,10 +248,8 @@ static void bgp_debug_list_print(struct vty *vty, const char *desc,
if (filter->p && filter->p->family == AF_EVPN)
bgp_debug_print_evpn_prefix(vty, "", filter->p);
- else if (filter->p) {
- prefix2str(filter->p, buf, sizeof(buf));
- vty_out(vty, " %s", buf);
- }
+ else if (filter->p)
+ vty_out(vty, " %pFX", filter->p);
}
}
@@ -268,7 +265,6 @@ static int bgp_debug_list_conf_print(struct vty *vty, const char *desc,
{
struct bgp_debug_filter *filter;
struct listnode *node, *nnode;
- char buf[PREFIX2STR_BUFFER];
int write = 0;
if (list && !list_isempty(list)) {
@@ -283,8 +279,7 @@ static int bgp_debug_list_conf_print(struct vty *vty, const char *desc,
filter->p);
write++;
} else if (filter->p) {
- prefix2str(filter->p, buf, sizeof(buf));
- vty_out(vty, "%s %s\n", desc, buf);
+ vty_out(vty, "%s %pFX\n", desc, filter->p);
write++;
}
}
@@ -1416,7 +1411,6 @@ DEFPY (debug_bgp_update_prefix_afi_safi,
{
struct prefix *argv_p;
int ret = CMD_SUCCESS;
- char buf[PREFIX2STR_BUFFER];
argv_p = prefix_new();
@@ -1429,12 +1423,10 @@ DEFPY (debug_bgp_update_prefix_afi_safi,
if (!bgp_debug_update_prefixes)
bgp_debug_update_prefixes = list_new();
- prefix2str(argv_p, buf, sizeof(buf));
-
if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL, argv_p)) {
vty_out(vty,
- "BGP updates debugging is already enabled for %s\n",
- buf);
+ "BGP updates debugging is already enabled for %pFX\n",
+ argv_p);
prefix_free(&argv_p);
return CMD_SUCCESS;
}
@@ -1445,7 +1437,7 @@ DEFPY (debug_bgp_update_prefix_afi_safi,
DEBUG_ON(update, UPDATE_PREFIX);
} else {
TERM_DEBUG_ON(update, UPDATE_PREFIX);
- vty_out(vty, "BGP updates debugging is on for %s\n", buf);
+ vty_out(vty, "BGP updates debugging is on for %pFX\n", argv_p);
}
prefix_free(&argv_p);
@@ -1484,7 +1476,6 @@ DEFPY (no_debug_bgp_update_prefix_afi_safi,
struct prefix *argv_p;
bool found_prefix = false;
int ret = CMD_SUCCESS;
- char buf[PREFIX2STR_BUFFER];
argv_p = prefix_new();
@@ -1510,13 +1501,11 @@ DEFPY (no_debug_bgp_update_prefix_afi_safi,
}
}
- prefix2str(argv_p, buf, sizeof(buf));
-
if (found_prefix)
- vty_out(vty, "BGP updates debugging is off for %s\n", buf);
+ vty_out(vty, "BGP updates debugging is off for %pFX\n", argv_p);
else
- vty_out(vty, "BGP updates debugging was not enabled for %s\n",
- buf);
+ vty_out(vty, "BGP updates debugging was not enabled for %pFX\n",
+ argv_p);
prefix_free(&argv_p);
@@ -2643,7 +2632,6 @@ const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi,
char *str, int size)
{
char rd_buf[RD_ADDRSTRLEN];
- char pfx_buf[PREFIX_STRLEN];
char tag_buf[30];
/* ' with addpath ID ' 17
* max strlen of uint32 + 10
@@ -2681,10 +2669,9 @@ const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi,
}
if (prd)
- snprintf(str, size, "RD %s %s%s%s %s %s",
- prefix_rd2str(prd, rd_buf, sizeof(rd_buf)),
- prefix2str(pu, pfx_buf, sizeof(pfx_buf)), tag_buf,
- pathid_buf, afi2str(afi), safi2str(safi));
+ snprintfrr(str, size, "RD %s %pFX%s%s %s %s",
+ prefix_rd2str(prd, rd_buf, sizeof(rd_buf)), pu.p,
+ tag_buf, pathid_buf, afi2str(afi), safi2str(safi));
else if (safi == SAFI_FLOWSPEC) {
char return_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
const struct prefix_fs *fs = pu.fs;
@@ -2697,9 +2684,8 @@ const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi,
snprintf(str, size, "FS %s Match{%s}", afi2str(afi),
return_string);
} else
- snprintf(str, size, "%s%s%s %s %s",
- prefix2str(pu, pfx_buf, sizeof(pfx_buf)), tag_buf,
- pathid_buf, afi2str(afi), safi2str(safi));
+ snprintfrr(str, size, "%pFX%s%s %s %s", pu.p, tag_buf,
+ pathid_buf, afi2str(afi), safi2str(safi));
return str;
}
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index e58bb7c67..67d0a95cb 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -1034,19 +1034,17 @@ static void evpn_delete_old_local_route(struct bgp *bgp, struct bgpevpn *vpn,
safi_t safi = SAFI_EVPN;
if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) {
- char prefix_buf[PREFIX_STRLEN];
char esi_buf[ESI_STR_LEN];
char esi_buf2[ESI_STR_LEN];
struct prefix_evpn *evp =
(struct prefix_evpn *)bgp_dest_get_prefix(dest);
- zlog_debug("local path deleted %s es %s; new-path-es %s",
- prefix2str(evp,
- prefix_buf, sizeof(prefix_buf)),
- esi_to_str(&old_local->attr->esi,
- esi_buf, sizeof(esi_buf)),
- new_select ? esi_to_str(&new_select->attr->esi,
- esi_buf2, sizeof(esi_buf2)) : "");
+ zlog_debug("local path deleted %pFX es %s; new-path-es %s", evp,
+ esi_to_str(&old_local->attr->esi, esi_buf,
+ sizeof(esi_buf)),
+ new_select ? esi_to_str(&new_select->attr->esi,
+ esi_buf2, sizeof(esi_buf2))
+ : "");
}
/* Locate route node in the global EVPN routing table. Note that
@@ -1313,23 +1311,18 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp,
attr.nexthop = bgp_vrf->evpn_info->pip_ip;
attr.mp_nexthop_global_in = bgp_vrf->evpn_info->pip_ip;
} else if (bgp_vrf->evpn_info->pip_ip.s_addr == INADDR_ANY)
- if (bgp_debug_zebra(NULL)) {
- char buf1[PREFIX_STRLEN];
-
- zlog_debug("VRF %s evp %s advertise-pip primary ip is not configured",
- vrf_id_to_name(bgp_vrf->vrf_id),
- prefix2str(evp, buf1, sizeof(buf1)));
- }
+ if (bgp_debug_zebra(NULL))
+ zlog_debug(
+ "VRF %s evp %pFX advertise-pip primary ip is not configured",
+ vrf_id_to_name(bgp_vrf->vrf_id), evp);
}
if (bgp_debug_zebra(NULL)) {
char buf[ETHER_ADDR_STRLEN];
- char buf1[PREFIX_STRLEN];
char buf2[INET6_ADDRSTRLEN];
- zlog_debug("VRF %s type-5 route evp %s RMAC %s nexthop %s",
- vrf_id_to_name(bgp_vrf->vrf_id),
- prefix2str(evp, buf1, sizeof(buf1)),
+ zlog_debug("VRF %s type-5 route evp %pFX RMAC %s nexthop %s",
+ vrf_id_to_name(bgp_vrf->vrf_id), evp,
prefix_mac2str(&attr.rmac, buf, sizeof(buf)),
inet_ntop(AF_INET, &attr.nexthop, buf2,
INET_ADDRSTRLEN));
@@ -1461,21 +1454,23 @@ static void update_evpn_route_entry_sync_info(struct bgp *bgp,
attr->es_flags &= ~ATTR_ES_PEER_ROUTER;
if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) {
- char prefix_buf[PREFIX_STRLEN];
char esi_buf[ESI_STR_LEN];
- zlog_debug("setup sync info for %s es %s max_seq %d %s%s%s",
- prefix2str(evp, prefix_buf,
- sizeof(prefix_buf)),
+ zlog_debug(
+ "setup sync info for %pFX es %s max_seq %d %s%s%s",
+ evp,
esi_to_str(esi, esi_buf,
- sizeof(esi_buf)),
+ sizeof(esi_buf)),
max_sync_seq,
- (attr->es_flags & ATTR_ES_PEER_ACTIVE) ?
- "peer-active " : "",
- (attr->es_flags & ATTR_ES_PEER_PROXY) ?
- "peer-proxy " : "",
- (attr->es_flags & ATTR_ES_PEER_ROUTER) ?
- "peer-router " : "");
+ (attr->es_flags & ATTR_ES_PEER_ACTIVE)
+ ? "peer-active "
+ : "",
+ (attr->es_flags & ATTR_ES_PEER_PROXY)
+ ? "peer-proxy "
+ : "",
+ (attr->es_flags & ATTR_ES_PEER_ROUTER)
+ ? "peer-router "
+ : "");
}
}
} else {
@@ -1721,14 +1716,13 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
if (bgp_debug_zebra(NULL)) {
char buf[ETHER_ADDR_STRLEN];
- char buf1[PREFIX_STRLEN];
char buf3[ESI_STR_LEN];
zlog_debug(
- "VRF %s vni %u type-2 route evp %s RMAC %s nexthop %pI4 esi %s",
+ "VRF %s vni %u type-2 route evp %pFX RMAC %s nexthop %pI4 esi %s",
vpn->bgp_vrf ? vrf_id_to_name(vpn->bgp_vrf->vrf_id)
: " ",
- vpn->vni, prefix2str(p, buf1, sizeof(buf1)),
+ vpn->vni, p,
prefix_mac2str(&attr.rmac, buf, sizeof(buf)),
&attr.mp_nexthop_global_in,
esi_to_str(esi, buf3, sizeof(buf3)));
@@ -2001,14 +1995,13 @@ static void bgp_evpn_update_type2_route_entry(struct bgp *bgp,
if (bgp_debug_zebra(NULL)) {
char buf[ETHER_ADDR_STRLEN];
- char buf1[PREFIX_STRLEN];
char buf3[ESI_STR_LEN];
zlog_debug(
- "VRF %s vni %u evp %s RMAC %s nexthop %pI4 esi %s esf 0x%x from %s",
+ "VRF %s vni %u evp %pFX RMAC %s nexthop %pI4 esi %s esf 0x%x from %s",
vpn->bgp_vrf ? vrf_id_to_name(vpn->bgp_vrf->vrf_id)
: " ",
- vpn->vni, prefix2str(evp, buf1, sizeof(buf1)),
+ vpn->vni, evp,
prefix_mac2str(&attr.rmac, buf, sizeof(buf)),
&attr.mp_nexthop_global_in,
esi_to_str(&attr.esi, buf3, sizeof(buf3)),
@@ -2391,19 +2384,16 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
struct prefix *pp = &p;
afi_t afi = 0;
safi_t safi = 0;
- char buf[PREFIX_STRLEN];
bool new_pi = false;
memset(pp, 0, sizeof(struct prefix));
ip_prefix_from_evpn_prefix(evp, pp);
- if (bgp_debug_zebra(NULL)) {
+ if (bgp_debug_zebra(NULL))
zlog_debug(
- "vrf %s: import evpn prefix %s parent %p flags 0x%x",
- vrf_id_to_name(bgp_vrf->vrf_id),
- prefix2str(evp, buf, sizeof(buf)),
- parent_pi, parent_pi->flags);
- }
+ "vrf %s: import evpn prefix %pFX parent %p flags 0x%x",
+ vrf_id_to_name(bgp_vrf->vrf_id), evp, parent_pi,
+ parent_pi->flags);
/* Create (or fetch) route within the VRF. */
/* NOTE: There is no RD here. */
@@ -2582,18 +2572,15 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
struct prefix *pp = &p;
afi_t afi = 0;
safi_t safi = 0;
- char buf[PREFIX_STRLEN];
memset(pp, 0, sizeof(struct prefix));
ip_prefix_from_evpn_prefix(evp, pp);
- if (bgp_debug_zebra(NULL)) {
+ if (bgp_debug_zebra(NULL))
zlog_debug(
- "vrf %s: unimport evpn prefix %s parent %p flags 0x%x",
- vrf_id_to_name(bgp_vrf->vrf_id),
- prefix2str(evp, buf, sizeof(buf)),
- parent_pi, parent_pi->flags);
- }
+ "vrf %s: unimport evpn prefix %pFX parent %p flags 0x%x",
+ vrf_id_to_name(bgp_vrf->vrf_id), evp, parent_pi,
+ parent_pi->flags);
/* Locate route within the VRF. */
/* NOTE: There is no RD here. */
@@ -2850,15 +2837,13 @@ static int bgp_evpn_route_rmac_self_check(struct bgp *bgp_vrf,
*/
if (memcmp(&bgp_vrf->rmac, &pi->attr->rmac, ETH_ALEN) == 0) {
if (bgp_debug_update(pi->peer, NULL, NULL, 1)) {
- char buf1[PREFIX_STRLEN];
char attr_str[BUFSIZ] = {0};
bgp_dump_attr(pi->attr, attr_str, sizeof(attr_str));
- zlog_debug("%s: bgp %u prefix %s with attr %s - DENIED due to self mac",
- __func__, bgp_vrf->vrf_id,
- prefix2str(evp, buf1, sizeof(buf1)),
- attr_str);
+ zlog_debug(
+ "%s: bgp %u prefix %pFX with attr %s - DENIED due to self mac",
+ __func__, bgp_vrf->vrf_id, evp, attr_str);
}
return 1;
@@ -2879,7 +2864,6 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install)
struct bgp_table *table;
struct bgp_path_info *pi;
int ret;
- char buf[PREFIX_STRLEN];
struct bgp *bgp_evpn = NULL;
afi = AFI_L2VPN;
@@ -2940,11 +2924,10 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install)
if (ret) {
flog_err(
EC_BGP_EVPN_FAIL,
- "Failed to %s EVPN %s route in VRF %s",
+ "Failed to %s EVPN %pFX route in VRF %s",
install ? "install"
: "uninstall",
- prefix2str(evp, buf,
- sizeof(buf)),
+ evp,
vrf_id_to_name(
bgp_vrf->vrf_id));
return ret;
@@ -3113,7 +3096,6 @@ static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi,
struct bgp_path_info *pi,
struct list *vrfs, int install)
{
- char buf[PREFIX2STR_BUFFER];
struct bgp *bgp_vrf;
struct listnode *node, *nnode;
@@ -3139,10 +3121,9 @@ static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi,
if (ret) {
flog_err(EC_BGP_EVPN_FAIL,
- "%u: Failed to %s prefix %s in VRF %s",
+ "%u: Failed to %s prefix %pFX in VRF %s",
bgp_def->vrf_id,
- install ? "install" : "uninstall",
- prefix2str(evp, buf, sizeof(buf)),
+ install ? "install" : "uninstall", evp,
vrf_id_to_name(bgp_vrf->vrf_id));
return ret;
}
@@ -4100,17 +4081,14 @@ void bgp_evpn_withdraw_type5_route(struct bgp *bgp_vrf, const struct prefix *p,
{
int ret = 0;
struct prefix_evpn evp;
- char buf[PREFIX_STRLEN];
build_type5_prefix_from_ip_prefix(&evp, p);
ret = delete_evpn_type5_route(bgp_vrf, &evp);
- if (ret) {
+ if (ret)
flog_err(
EC_BGP_EVPN_ROUTE_DELETE,
- "%u failed to delete type-5 route for prefix %s in vrf %s",
- bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)),
- vrf_id_to_name(bgp_vrf->vrf_id));
- }
+ "%u failed to delete type-5 route for prefix %pFX in vrf %s",
+ bgp_vrf->vrf_id, p, vrf_id_to_name(bgp_vrf->vrf_id));
}
/* withdraw all type-5 routes for an address family */
@@ -4172,14 +4150,13 @@ void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, const struct prefix *p,
{
int ret = 0;
struct prefix_evpn evp;
- char buf[PREFIX_STRLEN];
build_type5_prefix_from_ip_prefix(&evp, p);
ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr);
if (ret)
flog_err(EC_BGP_EVPN_ROUTE_CREATE,
- "%u: Failed to create type-5 route for prefix %s",
- bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)));
+ "%u: Failed to create type-5 route for prefix %pFX",
+ bgp_vrf->vrf_id, p);
}
/* Inject all prefixes of a particular address-family (currently, IPv4 or
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c
index b7b251483..1a58541a7 100644
--- a/bgpd/bgp_evpn_mh.c
+++ b/bgpd/bgp_evpn_mh.c
@@ -699,7 +699,6 @@ static int bgp_evpn_type4_remote_routes_import(struct bgp *bgp,
int ret;
afi_t afi;
safi_t safi;
- char buf[PREFIX_STRLEN];
struct bgp_dest *rd_dest, *dest;
struct bgp_table *table;
struct bgp_path_info *pi;
@@ -744,13 +743,11 @@ static int bgp_evpn_type4_remote_routes_import(struct bgp *bgp,
if (ret) {
flog_err(
- EC_BGP_EVPN_FAIL,
- "Failed to %s EVPN %s route in ESI %s",
- install ? "install"
+ EC_BGP_EVPN_FAIL,
+ "Failed to %s EVPN %pFX route in ESI %s",
+ install ? "install"
: "uninstall",
- prefix2str(evp, buf,
- sizeof(buf)),
- es->esi_str);
+ evp, es->esi_str);
return ret;
}
}
diff --git a/bgpd/bgp_flowspec_util.c b/bgpd/bgp_flowspec_util.c
index 90e923638..55e7973f8 100644
--- a/bgpd/bgp_flowspec_util.c
+++ b/bgpd/bgp_flowspec_util.c
@@ -20,6 +20,8 @@
#include "zebra.h"
+#include "lib/printfrr.h"
+
#include "prefix.h"
#include "lib_errors.h"
@@ -211,14 +213,11 @@ int bgp_flowspec_ip_address(enum bgp_flowspec_util_nlri_t type,
switch (type) {
case BGP_FLOWSPEC_RETURN_STRING:
if (prefix_local.family == AF_INET6) {
- char str[BGP_FLOWSPEC_STRING_DISPLAY_MAX];
int ret;
- prefix2str(&prefix_local, str,
- BGP_FLOWSPEC_STRING_DISPLAY_MAX);
- ret = snprintf(display, BGP_FLOWSPEC_STRING_DISPLAY_MAX,
- "%s/off %u",
- str, prefix_offset);
+ ret = snprintfrr(
+ display, BGP_FLOWSPEC_STRING_DISPLAY_MAX,
+ "%pFX/off %u", &prefix_local, prefix_offset);
if (ret < 0) {
*error = -1;
break;
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index 075dbe1cc..4f440cd1f 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -215,7 +215,6 @@ void bgp_reg_dereg_for_label(struct bgp_dest *dest, struct bgp_path_info *pi,
int command;
uint16_t flags = 0;
size_t flags_pos = 0;
- char addr[PREFIX_STRLEN];
p = bgp_dest_get_prefix(dest);
local_label = &(dest->local_label);
@@ -242,11 +241,11 @@ void bgp_reg_dereg_for_label(struct bgp_dest *dest, struct bgp_path_info *pi,
* always takes precedence over auto-assigned labels.
*/
if (!have_label_to_reg) {
- if (BGP_DEBUG(labelpool, LABELPOOL)) {
- prefix2str(p, addr, PREFIX_STRLEN);
- zlog_debug("%s: Requesting label from LP for %s",
- __func__, addr);
- }
+ if (BGP_DEBUG(labelpool, LABELPOOL))
+ zlog_debug(
+ "%s: Requesting label from LP for %pFX",
+ __func__, p);
+
/* bgp_reg_for_label_callback() will call back
* __func__ when it gets a label from the pool.
* This means we'll never register FECs without
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 67885cbf7..f1aeafced 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -1106,13 +1106,9 @@ vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
return;
}
- if (debug) {
- char buf_prefix[PREFIX_STRLEN];
-
- prefix2str(p, buf_prefix, sizeof(buf_prefix));
- zlog_debug("%s: updating %s to vrf %s", __func__,
- buf_prefix, bgp_vrf->name_pretty);
- }
+ if (debug)
+ zlog_debug("%s: updating %pFX to vrf %s", __func__, p,
+ bgp_vrf->name_pretty);
/* shallow copy */
static_attr = *path_vpn->attr;
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 6cd38ec78..64b10c025 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -315,15 +315,12 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
bnc->change_flags = 0;
/* debug print the input */
- if (BGP_DEBUG(nht, NHT)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&nhr->prefix, buf, sizeof(buf));
+ if (BGP_DEBUG(nht, NHT))
zlog_debug(
- "%s(%u): Rcvd NH update %s(%u) - metric %d/%d #nhops %d/%d flags 0x%x",
- bnc->bgp->name_pretty, bnc->bgp->vrf_id, buf,
+ "%s(%u): Rcvd NH update %pFX(%u) - metric %d/%d #nhops %d/%d flags 0x%x",
+ bnc->bgp->name_pretty, bnc->bgp->vrf_id, &nhr->prefix,
bnc->srte_color, nhr->metric, bnc->metric,
nhr->nexthop_num, bnc->nexthop_num, bnc->flags);
- }
if (nhr->metric != bnc->metric)
bnc->change_flags |= BGP_NEXTHOP_METRIC_CHANGED;
@@ -454,14 +451,10 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
bnc = bnc_find(tree, &nhr.prefix, nhr.srte_color);
if (!bnc) {
- if (BGP_DEBUG(nht, NHT)) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&nhr.prefix, buf, sizeof(buf));
+ if (BGP_DEBUG(nht, NHT))
zlog_debug(
- "parse nexthop update(%s(%u)(%s)): bnc info not found",
- buf, nhr.srte_color, bgp->name_pretty);
- }
+ "parse nexthop update(%pFX(%u)(%s)): bnc info not found",
+ &nhr.prefix, nhr.srte_color, bgp->name_pretty);
return;
}
diff --git a/bgpd/bgp_pbr.c b/bgpd/bgp_pbr.c
index f6e5c196c..f7dd08443 100644
--- a/bgpd/bgp_pbr.c
+++ b/bgpd/bgp_pbr.c
@@ -23,6 +23,8 @@
#include "jhash.h"
#include "pbr.h"
+#include "lib/printfrr.h"
+
#include "bgpd/bgpd.h"
#include "bgpd/bgp_pbr.h"
#include "bgpd/bgp_debug.h"
@@ -1438,7 +1440,6 @@ void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api)
int i = 0;
char return_string[512];
char *ptr = return_string;
- char buff[64];
int nb_items = 0;
int delta, len = sizeof(return_string);
@@ -1449,12 +1450,10 @@ void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api)
struct prefix *p = &(api->src_prefix);
if (api->src_prefix_offset)
- delta = snprintf(ptr, len, "@src %s/off%u",
- prefix2str(p, buff, 64),
- api->src_prefix_offset);
+ delta = snprintfrr(ptr, len, "@src %pFX/off%u", p,
+ api->src_prefix_offset);
else
- delta = snprintf(ptr, len, "@src %s",
- prefix2str(p, buff, 64));
+ delta = snprintfrr(ptr, len, "@src %pFX", p);
len -= delta;
ptr += delta;
INCREMENT_DISPLAY(ptr, nb_items, len);
@@ -1464,12 +1463,10 @@ void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api)
INCREMENT_DISPLAY(ptr, nb_items, len);
if (api->dst_prefix_offset)
- delta = snprintf(ptr, len, "@dst %s/off%u",
- prefix2str(p, buff, 64),
- api->dst_prefix_offset);
+ delta = snprintfrr(ptr, len, "@dst %pFX/off%u", p,
+ api->dst_prefix_offset);
else
- delta = snprintf(ptr, len, "@dst %s",
- prefix2str(p, buff, 64));
+ delta = snprintfrr(ptr, len, "@dst %pFX", p);
len -= delta;
ptr += delta;
}
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 68ba73caa..2e1f2536a 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2428,12 +2428,8 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp,
onlypeer = ((SUBGRP_PCOUNT(subgrp) == 1) ? (SUBGRP_PFIRST(subgrp))->peer
: NULL);
- if (BGP_DEBUG(update, UPDATE_OUT)) {
- char buf_prefix[PREFIX_STRLEN];
- prefix2str(p, buf_prefix, sizeof(buf_prefix));
- zlog_debug("%s: p=%s, selected=%p", __func__, buf_prefix,
- selected);
- }
+ if (BGP_DEBUG(update, UPDATE_OUT))
+ zlog_debug("%s: p=%pFX, selected=%p", __func__, p, selected);
/* First update is deferred until ORF or ROUTE-REFRESH is received */
if (onlypeer && CHECK_FLAG(onlypeer->af_sflags[afi][safi],
@@ -7617,13 +7613,10 @@ static void route_vty_out_route(const struct prefix *p, struct vty *vty,
json_object_string_add(json, "network", buf2);
}
} else if (p->family == AF_ETHERNET) {
- prefix2str(p, buf, PREFIX_STRLEN);
len = vty_out(vty, "%pFX", p);
} else if (p->family == AF_EVPN) {
if (!json)
- len = vty_out(vty, "%s",
- prefix2str((struct prefix_evpn *)p, buf,
- BUFSIZ));
+ len = vty_out(vty, "%pFX", (struct prefix_evpn *)p);
else
bgp_evpn_route2json((struct prefix_evpn *)p, json);
} else if (p->family == AF_FLOWSPEC) {
@@ -8951,7 +8944,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
{
char buf[INET6_ADDRSTRLEN];
char buf1[BUFSIZ];
- char buf2[EVPN_ROUTE_STRLEN];
struct attr *attr = path->attr;
int sockunion_vty_out(struct vty *, union sockunion *);
time_t tbuf;
@@ -8989,7 +8981,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
if (path->extra) {
char tag_buf[30];
- buf2[0] = '\0';
tag_buf[0] = '\0';
if (path->extra && path->extra->num_labels) {
bgp_evpn_label2str(path->extra->label,
@@ -8998,10 +8989,9 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
}
if (safi == SAFI_EVPN) {
if (!json_paths) {
- prefix2str((struct prefix_evpn *)
- bgp_dest_get_prefix(bn),
- buf2, sizeof(buf2));
- vty_out(vty, " Route %s", buf2);
+ vty_out(vty, " Route %pFX",
+ (struct prefix_evpn *)
+ bgp_dest_get_prefix(bn));
if (tag_buf[0] != '\0')
vty_out(vty, " VNI %s", tag_buf);
vty_out(vty, "\n");
@@ -9025,13 +9015,20 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
pdest),
buf1, sizeof(buf1));
if (is_pi_family_evpn(parent_ri)) {
- prefix2str((struct prefix_evpn *)
- bgp_dest_get_prefix(
- dest),
- buf2, sizeof(buf2));
- vty_out(vty, " Imported from %s:%s, VNI %s\n", buf1, buf2, tag_buf);
+ vty_out(vty,
+ " Imported from %s:%pFX, VNI %s\n",
+ buf1,
+ (struct prefix_evpn *)
+ bgp_dest_get_prefix(
+ dest),
+ tag_buf);
} else
- vty_out(vty, " Imported from %s:%s\n", buf1, buf2);
+ vty_out(vty,
+ " Imported from %s:%pFX\n",
+ buf1,
+ (struct prefix_evpn *)
+ bgp_dest_get_prefix(
+ dest));
}
}
}
@@ -10363,7 +10360,6 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
struct peer *peer;
struct listnode *node, *nnode;
char buf1[RD_ADDRSTRLEN];
- char buf3[EVPN_ROUTE_STRLEN];
char prefix_str[BUFSIZ];
int count = 0;
int best = 0;
@@ -10395,12 +10391,10 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
if (safi == SAFI_EVPN) {
if (!json) {
- vty_out(vty, "BGP routing table entry for %s%s%s\n",
+ vty_out(vty, "BGP routing table entry for %s%s%pFX\n",
prd ? prefix_rd2str(prd, buf1, sizeof(buf1))
: "",
- prd ? ":" : "",
- prefix2str((struct prefix_evpn *)p, buf3,
- sizeof(buf3)));
+ prd ? ":" : "", (struct prefix_evpn *)p);
} else {
json_object_string_add(json, "rd",
prd ? prefix_rd2str(prd, buf1, sizeof(buf1)) :
diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c
index ca47fb316..0f0aff7ea 100644
--- a/bgpd/bgp_rpki.c
+++ b/bgpd/bgp_rpki.c
@@ -702,8 +702,6 @@ static int rpki_validate_prefix(struct peer *peer, struct attr *attr,
as_t as_number = 0;
struct lrtr_ip_addr ip_addr_prefix;
enum pfxv_state result;
- char buf[BUFSIZ];
- const char *prefix_string;
if (!is_synchronized())
return 0;
@@ -754,27 +752,26 @@ static int rpki_validate_prefix(struct peer *peer, struct attr *attr,
prefix->prefixlen, &result);
// Print Debug output
- prefix_string = prefix2str(prefix, buf, sizeof(buf));
switch (result) {
case BGP_PFXV_STATE_VALID:
RPKI_DEBUG(
- "Validating Prefix %s from asn %u Result: VALID",
- prefix_string, as_number);
+ "Validating Prefix %pFX from asn %u Result: VALID",
+ prefix, as_number);
return RPKI_VALID;
case BGP_PFXV_STATE_NOT_FOUND:
RPKI_DEBUG(
- "Validating Prefix %s from asn %u Result: NOT FOUND",
- prefix_string, as_number);
+ "Validating Prefix %pFX from asn %u Result: NOT FOUND",
+ prefix, as_number);
return RPKI_NOTFOUND;
case BGP_PFXV_STATE_INVALID:
RPKI_DEBUG(
- "Validating Prefix %s from asn %u Result: INVALID",
- prefix_string, as_number);
+ "Validating Prefix %pFX from asn %u Result: INVALID",
+ prefix, as_number);
return RPKI_INVALID;
default:
RPKI_DEBUG(
- "Validating Prefix %s from asn %u Result: CANNOT VALIDATE",
- prefix_string, as_number);
+ "Validating Prefix %pFX from asn %u Result: CANNOT VALIDATE",
+ prefix, as_number);
break;
}
return 0;
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index d1ddfd7a7..c3edb9e9a 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -1137,7 +1137,6 @@ void subgroup_default_update_packet(struct update_subgroup *subgrp,
/* Logging the attribute. */
if (bgp_debug_update(NULL, &p, subgrp->update_group, 0)) {
char attrstr[BUFSIZ];
- char buf[PREFIX_STRLEN];
/* ' with addpath ID ' 17
* max strlen of uint32 + 10
* +/- (just in case) + 1
@@ -1156,10 +1155,9 @@ void subgroup_default_update_packet(struct update_subgroup *subgrp,
else
tx_id_buf[0] = '\0';
- zlog_debug("u%" PRIu64 ":s%" PRIu64 " send UPDATE %s%s %s",
- (SUBGRP_UPDGRP(subgrp))->id, subgrp->id,
- prefix2str(&p, buf, sizeof(buf)), tx_id_buf,
- attrstr);
+ zlog_debug("u%" PRIu64 ":s%" PRIu64 " send UPDATE %pFX%s %s",
+ (SUBGRP_UPDGRP(subgrp))->id, subgrp->id, &p,
+ tx_id_buf, attrstr);
}
s = stream_new(BGP_MAX_PACKET_SIZE);
@@ -1222,7 +1220,6 @@ void subgroup_default_withdraw_packet(struct update_subgroup *subgrp)
p.prefixlen = 0;
if (bgp_debug_update(NULL, &p, subgrp->update_group, 0)) {
- char buf[PREFIX_STRLEN];
/* ' with addpath ID ' 17
* max strlen of uint32 + 10
* +/- (just in case) + 1
@@ -1235,9 +1232,10 @@ void subgroup_default_withdraw_packet(struct update_subgroup *subgrp)
" with addpath ID %u",
BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE);
- zlog_debug("u%" PRIu64 ":s%" PRIu64" send UPDATE %s%s -- unreachable",
- (SUBGRP_UPDGRP(subgrp))->id, subgrp->id,
- prefix2str(&p, buf, sizeof(buf)), tx_id_buf);
+ zlog_debug("u%" PRIu64 ":s%" PRIu64
+ " send UPDATE %pFX%s -- unreachable",
+ (SUBGRP_UPDGRP(subgrp))->id, subgrp->id, &p,
+ tx_id_buf);
}
s = stream_new(BGP_MAX_PACKET_SIZE);
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 13dd50aa8..a1ef8e23f 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -3883,7 +3883,6 @@ void bgp_config_write_listen(struct vty *vty, struct bgp *bgp)
struct listnode *node, *nnode, *rnode, *nrnode;
struct prefix *range;
afi_t afi;
- char buf[PREFIX2STR_BUFFER];
if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT)
vty_out(vty, " bgp listen limit %d\n",
@@ -3893,10 +3892,9 @@ void bgp_config_write_listen(struct vty *vty, struct bgp *bgp)
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
for (ALL_LIST_ELEMENTS(group->listen_range[afi], rnode,
nrnode, range)) {
- prefix2str(range, buf, sizeof(buf));
vty_out(vty,
- " bgp listen range %s peer-group %s\n",
- buf, group->name);
+ " bgp listen range %pFX peer-group %s\n",
+ range, group->name);
}
}
}
@@ -14112,7 +14110,6 @@ static int bgp_show_one_peer_group(struct vty *vty, struct peer_group *group)
struct prefix *range;
struct peer *conf;
struct peer *peer;
- char buf[PREFIX2STR_BUFFER];
afi_t afi;
safi_t safi;
const char *peer_status;
@@ -14166,10 +14163,8 @@ static int bgp_show_one_peer_group(struct vty *vty, struct peer_group *group)
for (ALL_LIST_ELEMENTS(group->listen_range[afi], node,
- nnode, range)) {
- prefix2str(range, buf, sizeof(buf));
- vty_out(vty, " %s\n", buf);
- }
+ nnode, range))
+ vty_out(vty, " %pFX\n", range);
}
}
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index efc167218..d4a69af4f 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -91,11 +91,9 @@ static int bgp_router_id_update(ZAPI_CALLBACK_ARGS)
zebra_router_id_update_read(zclient->ibuf, &router_id);
- if (BGP_DEBUG(zebra, ZEBRA)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&router_id, buf, sizeof(buf));
- zlog_debug("Rx Router Id update VRF %u Id %s", vrf_id, buf);
- }
+ if (BGP_DEBUG(zebra, ZEBRA))
+ zlog_debug("Rx Router Id update VRF %u Id %pFX", vrf_id,
+ &router_id);
bgp_router_id_zebra_bump(vrf_id, &router_id);
return 0;
@@ -313,12 +311,9 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS)
if (ifc == NULL)
return 0;
- if (bgp_debug_zebra(ifc->address)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(ifc->address, buf, sizeof(buf));
- zlog_debug("Rx Intf address add VRF %u IF %s addr %s", vrf_id,
- ifc->ifp->name, buf);
- }
+ if (bgp_debug_zebra(ifc->address))
+ zlog_debug("Rx Intf address add VRF %u IF %s addr %pFX", vrf_id,
+ ifc->ifp->name, ifc->address);
if (!bgp)
return 0;
@@ -350,12 +345,9 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS)
if (ifc == NULL)
return 0;
- if (bgp_debug_zebra(ifc->address)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(ifc->address, buf, sizeof(buf));
- zlog_debug("Rx Intf address del VRF %u IF %s addr %s", vrf_id,
- ifc->ifp->name, buf);
- }
+ if (bgp_debug_zebra(ifc->address))
+ zlog_debug("Rx Intf address del VRF %u IF %s addr %pFX", vrf_id,
+ ifc->ifp->name, ifc->address);
if (bgp && if_is_operative(ifc->ifp)) {
bgp_connected_delete(bgp, ifc);
@@ -376,12 +368,9 @@ static int bgp_interface_nbr_address_add(ZAPI_CALLBACK_ARGS)
if (ifc == NULL)
return 0;
- if (bgp_debug_zebra(ifc->address)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(ifc->address, buf, sizeof(buf));
- zlog_debug("Rx Intf neighbor add VRF %u IF %s addr %s", vrf_id,
- ifc->ifp->name, buf);
- }
+ if (bgp_debug_zebra(ifc->address))
+ zlog_debug("Rx Intf neighbor add VRF %u IF %s addr %pFX",
+ vrf_id, ifc->ifp->name, ifc->address);
if (if_is_operative(ifc->ifp)) {
bgp = bgp_lookup_by_vrf_id(vrf_id);
@@ -402,12 +391,9 @@ static int bgp_interface_nbr_address_delete(ZAPI_CALLBACK_ARGS)
if (ifc == NULL)
return 0;
- if (bgp_debug_zebra(ifc->address)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(ifc->address, buf, sizeof(buf));
- zlog_debug("Rx Intf neighbor del VRF %u IF %s addr %s", vrf_id,
- ifc->ifp->name, buf);
- }
+ if (bgp_debug_zebra(ifc->address))
+ zlog_debug("Rx Intf neighbor del VRF %u IF %s addr %pFX",
+ vrf_id, ifc->ifp->name, ifc->address);
if (if_is_operative(ifc->ifp)) {
bgp = bgp_lookup_by_vrf_id(vrf_id);
@@ -534,22 +520,20 @@ static int zebra_read_route(ZAPI_CALLBACK_ARGS)
}
if (bgp_debug_zebra(&api.prefix)) {
- char buf[2][PREFIX_STRLEN];
+ char buf[PREFIX_STRLEN];
- prefix2str(&api.prefix, buf[0], sizeof(buf[0]));
if (add) {
- inet_ntop(api.prefix.family, &nexthop, buf[1],
- sizeof(buf[1]));
+ inet_ntop(api.prefix.family, &nexthop, buf,
+ sizeof(buf));
zlog_debug(
- "Rx route ADD VRF %u %s[%d] %s nexthop %s (type %d if %u) metric %u tag %" ROUTE_TAG_PRI,
+ "Rx route ADD VRF %u %s[%d] %pFX nexthop %s (type %d if %u) metric %u tag %" ROUTE_TAG_PRI,
vrf_id, zebra_route_string(api.type),
- api.instance, buf[0], buf[1], nhtype,
- ifindex, api.metric, api.tag);
+ api.instance, &api.prefix, buf, nhtype, ifindex,
+ api.metric, api.tag);
} else {
- zlog_debug(
- "Rx route DEL VRF %u %s[%d] %s",
- vrf_id, zebra_route_string(api.type),
- api.instance, buf[0]);
+ zlog_debug("Rx route DEL VRF %u %s[%d] %s", vrf_id,
+ zebra_route_string(api.type), api.instance,
+ buf);
}
}
@@ -1436,18 +1420,17 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
}
if (bgp_debug_zebra(p)) {
- char prefix_buf[PREFIX_STRLEN];
char nh_buf[INET6_ADDRSTRLEN];
char eth_buf[ETHER_ADDR_STRLEN + 7] = {'\0'};
char buf1[ETHER_ADDR_STRLEN];
char label_buf[20];
int i;
- prefix2str(&api.prefix, prefix_buf, sizeof(prefix_buf));
- zlog_debug("Tx route %s VRF %u %s metric %u tag %" ROUTE_TAG_PRI
- " count %d",
- valid_nh_count ? "add" : "delete", bgp->vrf_id,
- prefix_buf, api.metric, api.tag, api.nexthop_num);
+ zlog_debug(
+ "Tx route %s VRF %u %pFX metric %u tag %" ROUTE_TAG_PRI
+ " count %d",
+ valid_nh_count ? "add" : "delete", bgp->vrf_id,
+ &api.prefix, api.metric, api.tag, api.nexthop_num);
for (i = 0; i < api.nexthop_num; i++) {
api_nh = &api.nexthops[i];
@@ -1596,12 +1579,9 @@ void bgp_zebra_withdraw(const struct prefix *p, struct bgp_path_info *info,
if (is_route_parent_evpn(info))
SET_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE);
- if (bgp_debug_zebra(p)) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf, sizeof(buf));
- zlog_debug("Tx route delete VRF %u %s", bgp->vrf_id, buf);
- }
+ if (bgp_debug_zebra(p))
+ zlog_debug("Tx route delete VRF %u %pFX", bgp->vrf_id,
+ &api.prefix);
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
}
@@ -2787,7 +2767,6 @@ static void bgp_zebra_process_local_ip_prefix(ZAPI_CALLBACK_ARGS)
struct stream *s = NULL;
struct bgp *bgp_vrf = NULL;
struct prefix p;
- char buf[PREFIX_STRLEN];
memset(&p, 0, sizeof(struct prefix));
s = zclient->ibuf;
@@ -2798,8 +2777,7 @@ static void bgp_zebra_process_local_ip_prefix(ZAPI_CALLBACK_ARGS)
return;
if (BGP_DEBUG(zebra, ZEBRA))
- zlog_debug("Recv prefix %s %s on vrf %s",
- prefix2str(&p, buf, sizeof(buf)),
+ zlog_debug("Recv prefix %pFX %s on vrf %s", &p,
(cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) ? "ADD" : "DEL",
vrf_id_to_name(vrf_id));
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 03a5854d0..bb426e96d 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -2738,7 +2738,6 @@ int peer_group_listen_range_del(struct peer_group *group, struct prefix *range)
struct listnode *node, *nnode;
struct peer *peer;
afi_t afi;
- char buf[PREFIX2STR_BUFFER];
afi = family2afi(range->family);
@@ -2751,8 +2750,6 @@ int peer_group_listen_range_del(struct peer_group *group, struct prefix *range)
if (!prefix)
return BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_NOT_FOUND;
- prefix2str(prefix, buf, sizeof(buf));
-
/* Dispose off any dynamic neighbors that exist due to this listen range
*/
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, peer)) {
@@ -2763,8 +2760,8 @@ int peer_group_listen_range_del(struct peer_group *group, struct prefix *range)
if (prefix_match(prefix, &prefix2)) {
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "Deleting dynamic neighbor %s group %s upon delete of listen range %s",
- peer->host, group->name, buf);
+ "Deleting dynamic neighbor %s group %s upon delete of listen range %pFX",
+ peer->host, group->name, prefix);
peer_delete(peer);
}
}
@@ -3770,7 +3767,6 @@ struct peer *peer_lookup_dynamic_neighbor(struct bgp *bgp, union sockunion *su)
struct prefix *listen_range;
int dncount;
char buf[PREFIX2STR_BUFFER];
- char buf1[PREFIX2STR_BUFFER];
sockunion2hostprefix(su, &prefix);
@@ -3787,12 +3783,11 @@ struct peer *peer_lookup_dynamic_neighbor(struct bgp *bgp, union sockunion *su)
return NULL;
prefix2str(&prefix, buf, sizeof(buf));
- prefix2str(listen_range, buf1, sizeof(buf1));
if (bgp_debug_neighbor_events(NULL))
zlog_debug(
- "Dynamic Neighbor %s matches group %s listen range %s",
- buf, group->name, buf1);
+ "Dynamic Neighbor %s matches group %s listen range %pFX",
+ buf, group->name, listen_range);
/* Are we within the listen limit? */
dncount = gbgp->dynamic_neighbors_count;
diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c
index 2bcef97fc..88c92f795 100644
--- a/bgpd/rfapi/bgp_rfapi_cfg.c
+++ b/bgpd/rfapi/bgp_rfapi_cfg.c
@@ -170,14 +170,8 @@ struct rfapi_nve_group_cfg *bgp_rfapi_cfg_match_group(struct rfapi_cfg *hc,
#ifdef BGP_VNC_DEBUG_MATCH_GROUP
{
- char buf[PREFIX_STRLEN];
-
- prefix2str(vn, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s: vn prefix: %s", __func__, buf);
-
- prefix2str(un, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s: un prefix: %s", __func__, buf);
-
+ vnc_zlog_debug_verbose("%s: vn prefix: %pFX", __func__, vn);
+ vnc_zlog_debug_verbose("%s: un prefix: %pFX", __func__, un);
vnc_zlog_debug_verbose(
"%s: rn_vn=%p, rn_un=%p, rfg_vn=%p, rfg_un=%p",
__func__, rn_vn, rn_un, rfg_vn, rfg_un);
@@ -4215,23 +4209,13 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
++write;
vty_out(vty, " vnc nve-group %s\n", rfg->name);
- if (rfg->vn_prefix.family && rfg->vn_node) {
- char buf[PREFIX_STRLEN];
+ if (rfg->vn_prefix.family && rfg->vn_node)
+ vty_out(vty, " prefix %s %pFX\n", "vn",
+ &rfg->vn_prefix);
- prefix2str(&rfg->vn_prefix, buf,
- sizeof(buf));
- vty_out(vty, " prefix %s %s\n", "vn",
- buf);
- }
-
- if (rfg->un_prefix.family && rfg->un_node) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(&rfg->un_prefix, buf,
- sizeof(buf));
- vty_out(vty, " prefix %s %s\n", "un",
- buf);
- }
+ if (rfg->un_prefix.family && rfg->un_node)
+ vty_out(vty, " prefix %s %pFX\n", "un",
+ &rfg->un_prefix);
if (rfg->rd.prefixlen) {
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 0ff4b2c82..2d81a6ce6 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -362,12 +362,9 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
afi_t afi; /* of the VN address */
struct bgp_dest *bn;
struct bgp_path_info *bpi;
- char buf[PREFIX_STRLEN];
char buf2[RD_ADDRSTRLEN];
struct prefix_rd prd0;
- prefix2str(p, buf, sizeof(buf));
-
afi = family2afi(p->family);
assert(afi == AFI_IP || afi == AFI_IP6);
@@ -380,9 +377,9 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
bn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd);
vnc_zlog_debug_verbose(
- "%s: peer=%p, prefix=%s, prd=%s afi=%d, safi=%d bn=%p, bn->info=%p",
- __func__, peer, buf, prefix_rd2str(prd, buf2, sizeof(buf2)),
- afi, safi, bn, (bn ? bgp_dest_get_bgp_path_info(bn) : NULL));
+ "%s: peer=%p, prefix=%pFX, prd=%s afi=%d, safi=%d bn=%p, bn->info=%p",
+ __func__, peer, p, prefix_rd2str(prd, buf2, sizeof(buf2)), afi,
+ safi, bn, (bn ? bgp_dest_get_bgp_path_info(bn) : NULL));
for (bpi = (bn ? bgp_dest_get_bgp_path_info(bn) : NULL); bpi;
bpi = bpi->next) {
@@ -418,8 +415,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
* no local nexthops
*/
vnc_zlog_debug_verbose(
- "%s: lnh list already empty at prefix %s",
- __func__, buf);
+ "%s: lnh list already empty at prefix %pFX",
+ __func__, p);
goto done;
}
@@ -445,8 +442,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
* list->del on data */
rfapi_nexthop_free(pLnh);
} else {
- vnc_zlog_debug_verbose("%s: desired lnh not found %s",
- __func__, buf);
+ vnc_zlog_debug_verbose("%s: desired lnh not found %pFX",
+ __func__, p);
}
goto done;
}
@@ -459,10 +456,9 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
rfapiProcessWithdraw(peer, rfd, p, prd, NULL, afi, safi, type, kill);
if (bpi) {
- prefix2str(p, buf, sizeof(buf));
vnc_zlog_debug_verbose(
- "%s: Found route (safi=%d) to delete at prefix %s",
- __func__, safi, buf);
+ "%s: Found route (safi=%d) to delete at prefix %pFX",
+ __func__, safi, p);
if (safi == SAFI_MPLS_VPN) {
struct bgp_dest *pdest = NULL;
@@ -488,8 +484,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
bgp_process(bgp, bn, afi, safi);
} else {
vnc_zlog_debug_verbose(
- "%s: Couldn't find route (safi=%d) at prefix %s",
- __func__, safi, buf);
+ "%s: Couldn't find route (safi=%d) at prefix %pFX",
+ __func__, safi, p);
}
done:
bgp_dest_unlock_node(bn);
@@ -1577,12 +1573,10 @@ rfapi_query_inner(void *handle, struct rfapi_ip_addr *target,
}
{
- char buf[PREFIX_STRLEN];
char *s;
- prefix2str(&p, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s(rfd=%p, target=%s, ppNextHop=%p)",
- __func__, rfd, buf, ppNextHopEntry);
+ vnc_zlog_debug_verbose("%s(rfd=%p, target=%pFX, ppNextHop=%p)",
+ __func__, rfd, &p, ppNextHopEntry);
s = ecommunity_ecom2str(rfd->import_table->rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
@@ -2397,16 +2391,10 @@ int rfapi_register(void *handle, struct rfapi_ip_prefix *prefix,
afi = family2afi(prefix->prefix.addr_family);
assert(afi);
-
- {
- char buf[PREFIX_STRLEN];
-
- prefix2str(&p, buf, sizeof(buf));
- vnc_zlog_debug_verbose(
- "%s(rfd=%p, pfx=%s, lifetime=%d, opts_un=%p, opts_vn=%p, action=%s)",
- __func__, rfd, buf, lifetime, options_un, options_vn,
- action_str);
- }
+ vnc_zlog_debug_verbose(
+ "%s(rfd=%p, pfx=%pFX, lifetime=%d, opts_un=%p, opts_vn=%p, action=%s)",
+ __func__, rfd, &p, lifetime, options_un, options_vn,
+ action_str);
/*
* These tests come after the prefix conversion so that we can
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 1e8a381e2..68d4f622e 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -612,11 +612,8 @@ rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset)
#ifdef DEBUG_MONITOR_MOVE_SHORTER
{
- char buf[PREFIX_STRLEN];
-
- prefix2str(&original_vpn_node->p, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s: called with node pfx=%s", __func__,
- buf);
+ vnc_zlog_debug_verbose("%s: called with node pfx=%pFX",
+ __func__, &original_vpn_node->p);
}
#endif
@@ -751,11 +748,8 @@ rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset)
#ifdef DEBUG_MONITOR_MOVE_SHORTER
{
- char buf[PREFIX_STRLEN];
-
- prefix2str(&par->p, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s: moved to node pfx=%s", __func__,
- buf);
+ vnc_zlog_debug_verbose("%s: moved to node pfx=%pFX", __func__,
+ &par->p);
}
#endif
@@ -1556,12 +1550,9 @@ static int rfapiNhlAddNodeRoutes(
}
if (!skiplist_search(seen_nexthops, &pfx_vn, NULL)) {
#ifdef DEBUG_RETURNED_NHL
- char buf[PREFIX_STRLEN];
-
- prefix2str(&pfx_vn, buf, sizeof(buf));
vnc_zlog_debug_verbose(
- "%s: already put VN/nexthop %s, skip", __func__,
- buf);
+ "%s: already put VN/nexthop %pFX, skip",
+ __func__, &pfx_vn);
#endif
continue;
}
@@ -3634,12 +3625,9 @@ void rfapiBgpInfoFilteredImportVPN(
rfapiCopyUnEncap2VPN(ern->info, info_new);
agg_unlock_node(ern); /* undo lock in route_note_match */
} else {
- char bpf[PREFIX_STRLEN];
-
- prefix2str(&vn_prefix, bpf, sizeof(bpf));
/* Not a big deal, just means VPN route got here first */
- vnc_zlog_debug_verbose("%s: no encap route for vn addr %s",
- __func__, bpf);
+ vnc_zlog_debug_verbose("%s: no encap route for vn addr %pFX",
+ __func__, &vn_prefix);
info_new->extra->vnc.import.un_family = 0;
}
@@ -4441,13 +4429,9 @@ static void rfapiDeleteRemotePrefixesIt(
struct bgp_path_info *next;
const struct prefix *rn_p = agg_node_get_prefix(rn);
- if (p && VNC_DEBUG(IMPORT_DEL_REMOTE)) {
- char p1line[PREFIX_STRLEN];
-
- prefix2str(p, p1line, sizeof(p1line));
- vnc_zlog_debug_any("%s: want %s, have %pRN",
- __func__, p1line, rn);
- }
+ if (p && VNC_DEBUG(IMPORT_DEL_REMOTE))
+ vnc_zlog_debug_any("%s: want %pFX, have %pRN",
+ __func__, p, rn);
if (p && prefix_cmp(p, rn_p))
continue;
diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c
index cd26892b8..a4b0eff03 100644
--- a/bgpd/rfapi/rfapi_monitor.c
+++ b/bgpd/rfapi/rfapi_monitor.c
@@ -846,9 +846,6 @@ void rfapiMonitorItNodeChanged(
struct bgp *bgp = bgp_get_default();
const struct prefix *p = agg_node_get_prefix(rn);
afi_t afi = family2afi(p->family);
-#if DEBUG_L2_EXTRA
- char buf_prefix[PREFIX_STRLEN];
-#endif
assert(bgp);
assert(import_table);
@@ -856,9 +853,8 @@ void rfapiMonitorItNodeChanged(
nves_seen = skiplist_new(0, NULL, NULL);
#if DEBUG_L2_EXTRA
- prefix2str(&it_node->p, buf_prefix, sizeof(buf_prefix));
- vnc_zlog_debug_verbose("%s: it=%p, it_node=%p, it_node->prefix=%s",
- __func__, import_table, it_node, buf_prefix);
+ vnc_zlog_debug_verbose("%s: it=%p, it_node=%p, it_node->prefix=%pFX",
+ __func__, import_table, it_node, &it_node->p);
#endif
if (AFI_L2VPN == afi) {
@@ -934,14 +930,10 @@ void rfapiMonitorItNodeChanged(
assert(!skiplist_insert(nves_seen,
m->rfd, NULL));
- char buf_target_pfx[PREFIX_STRLEN];
-
- prefix2str(&m->p, buf_target_pfx,
- sizeof(buf_target_pfx));
vnc_zlog_debug_verbose(
- "%s: update rfd %p attached to pfx %pRN (targ=%s)",
+ "%s: update rfd %p attached to pfx %pRN (targ=%pFX)",
__func__, m->rfd, m->node,
- buf_target_pfx);
+ &m->p);
/*
* update its RIB
@@ -1269,21 +1261,15 @@ static void rfapiMonitorEthDetachImport(
rn = agg_node_get(it->imported_vpn[AFI_L2VPN], &pfx_mac_buf);
assert(rn);
-#if DEBUG_L2_EXTRA
- char buf_prefix[PREFIX_STRLEN];
-
- prefix2str(agg_node_get_prefix(rn), buf_prefix, sizeof(buf_prefix));
-#endif
-
/*
* Get sl to detach from
*/
sl = RFAPI_MONITOR_ETH(rn);
#if DEBUG_L2_EXTRA
vnc_zlog_debug_verbose(
- "%s: it=%p, rn=%p, rn->lock=%d, sl=%p, pfx=%s, LNI=%d, detaching eth mon %p",
- __func__, it, rn, rn->lock, sl, buf_prefix, mon->logical_net_id,
- mon);
+ "%s: it=%p, rn=%p, rn->lock=%d, sl=%p, pfx=%pFX, LNI=%d, detaching eth mon %p",
+ __func__, it, rn, rn->lock, sl, agg_node_get_prefix(rn),
+ mon->logical_net_id, mon);
#endif
assert(sl);
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index 8109e7e3d..09832b32a 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -907,10 +907,6 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
delete_list = list_new();
while (0
== skiplist_first(slRibPt, NULL, (void **)&ri)) {
-
- char buf[PREFIX_STRLEN];
- char buf2[PREFIX_STRLEN];
-
listnode_add(delete_list, ri);
vnc_zlog_debug_verbose(
"%s: after listnode_add, delete_list->count=%d",
@@ -927,12 +923,10 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
ri->timer = NULL;
}
- prefix2str(&ri->rk.vn, buf, sizeof(buf));
- prefix2str(&ri->un, buf2, sizeof(buf2));
vnc_zlog_debug_verbose(
- "%s: put dl pfx=%pRN vn=%s un=%s cost=%d life=%d vn_options=%p",
- __func__, pn, buf, buf2, ri->cost,
- ri->lifetime, ri->vn_options);
+ "%s: put dl pfx=%pRN vn=%pFX un=%pFX cost=%d life=%d vn_options=%p",
+ __func__, pn, &ri->rk.vn, &ri->un,
+ ri->cost, ri->lifetime, ri->vn_options);
skiplist_delete_first(slRibPt);
}
@@ -1589,7 +1583,6 @@ void rfapiRibUpdatePendingNode(
afi_t afi;
uint32_t queued_flag;
int count = 0;
- char buf[PREFIX_STRLEN];
vnc_zlog_debug_verbose("%s: entry", __func__);
@@ -1602,8 +1595,7 @@ void rfapiRibUpdatePendingNode(
prefix = agg_node_get_prefix(it_node);
afi = family2afi(prefix->family);
- prefix2str(prefix, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s: prefix=%s", __func__, buf);
+ vnc_zlog_debug_verbose("%s: prefix=%pFX", __func__, prefix);
pn = agg_node_get(rfd->rib_pending[afi], prefix);
assert(pn);
@@ -1809,11 +1801,8 @@ int rfapiRibFTDFilterRecentPrefix(
#ifdef DEBUG_FTD_FILTER_RECENT
{
- char buf_pfx[PREFIX_STRLEN];
-
- prefix2str(agg_node_get_prefix(it_rn), buf_pfx,
- sizeof(buf_pfx));
- vnc_zlog_debug_verbose("%s: prefix %s", __func__, buf_pfx);
+ vnc_zlog_debug_verbose("%s: prefix %pFX", __func__,
+ agg_node_get_prefix(it_rn));
}
#endif
@@ -1974,21 +1963,18 @@ rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd,
#if DEBUG_NHL
{
- char str_vn[PREFIX_STRLEN];
char str_aux_prefix[PREFIX_STRLEN];
- str_vn[0] = 0;
str_aux_prefix[0] = 0;
- prefix2str(&rk.vn, str_vn, sizeof(str_vn));
prefix2str(&rk.aux_prefix, str_aux_prefix,
sizeof(str_aux_prefix));
if (!rk.aux_prefix.family) {
}
vnc_zlog_debug_verbose(
- "%s: rk.vn=%s rk.aux_prefix=%s", __func__,
- str_vn,
+ "%s: rk.vn=%pFX rk.aux_prefix=%s", __func__,
+ &rk.vn,
(rk.aux_prefix.family ? str_aux_prefix : "-"));
}
vnc_zlog_debug_verbose(
@@ -2072,17 +2058,10 @@ rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd,
if (agg_node_get_lock_count(trn) > 1)
agg_unlock_node(trn);
- {
- char str_pfx[PREFIX_STRLEN];
- char str_pfx_vn[PREFIX_STRLEN];
-
- prefix2str(&pfx, str_pfx, sizeof(str_pfx));
- prefix2str(&rk.vn, str_pfx_vn, sizeof(str_pfx_vn));
- vnc_zlog_debug_verbose(
- "%s: added pfx=%s nh[vn]=%s, cost=%u, lifetime=%u, allowed=%d",
- __func__, str_pfx, str_pfx_vn, nhp->prefix.cost,
- nhp->lifetime, allowed);
- }
+ vnc_zlog_debug_verbose(
+ "%s: added pfx=%pFX nh[vn]=%pFX, cost=%u, lifetime=%u, allowed=%d",
+ __func__, &pfx, &rk.vn, nhp->prefix.cost, nhp->lifetime,
+ allowed);
if (allowed) {
if (tail)
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index 850e8325c..b9a6c4ddc 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -1596,7 +1596,6 @@ void rfapiPrintDescriptor(struct vty *vty, struct rfapi_descriptor *rfd)
int rc;
afi_t afi;
struct rfapi_adb *adb;
- char buf[PREFIX_STRLEN];
vty_out(vty, "%-10p ", rfd);
rfapiPrintRfapiIpAddr(vty, &rfd->un_addr);
@@ -1648,9 +1647,8 @@ void rfapiPrintDescriptor(struct vty *vty, struct rfapi_descriptor *rfd)
if (family != adb->u.s.prefix_ip.family)
continue;
- prefix2str(&adb->u.s.prefix_ip, buf, sizeof(buf));
-
- vty_out(vty, " Adv Pfx: %s%s", buf, HVTYNL);
+ vty_out(vty, " Adv Pfx: %pFX%s", &adb->u.s.prefix_ip,
+ HVTYNL);
rfapiPrintAdvertisedInfo(vty, rfd, SAFI_MPLS_VPN,
&adb->u.s.prefix_ip);
}
@@ -1659,10 +1657,7 @@ void rfapiPrintDescriptor(struct vty *vty, struct rfapi_descriptor *rfd)
(void **)&adb, &cursor);
rc == 0; rc = skiplist_next(rfd->advertised.ip0_by_ether, NULL,
(void **)&adb, &cursor)) {
-
- prefix2str(&adb->u.s.prefix_eth, buf, sizeof(buf));
-
- vty_out(vty, " Adv Pfx: %s%s", buf, HVTYNL);
+ vty_out(vty, " Adv Pfx: %pFX%s", &adb->u.s.prefix_eth, HVTYNL);
/* TBD update the following function to print ethernet info */
/* Also need to pass/use rd */
@@ -1863,11 +1858,9 @@ void rfapiPrintNhl(void *stream, struct rfapi_next_hop_entry *next_hops)
break;
case RFAPI_VN_OPTION_TYPE_LOCAL_NEXTHOP:
- prefix2str(&vo->v.local_nexthop.addr,
- pbuf, sizeof(pbuf));
- fp(out, "%sLNH %s cost=%d%s", offset,
- pbuf, vo->v.local_nexthop.cost,
- HVTYNL);
+ fp(out, "%sLNH %pFX cost=%d%s", offset,
+ &vo->v.local_nexthop.addr,
+ vo->v.local_nexthop.cost, HVTYNL);
break;
default:
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 85d64b5a7..0b6b39b96 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -206,19 +206,11 @@ static void print_rhn_list(const char *tag1, const char *tag2)
/* XXX uses secret knowledge of skiplist structure */
for (p = sl->header->forward[0]; p; p = p->forward[0]) {
- char kbuf[PREFIX_STRLEN];
- char hbuf[PREFIX_STRLEN];
- char ubuf[PREFIX_STRLEN];
-
pb = p->value;
- prefix2str(p->key, kbuf, sizeof(kbuf));
- prefix2str(&pb->hpfx, hbuf, sizeof(hbuf));
- prefix2str(&pb->upfx, ubuf, sizeof(ubuf));
-
vnc_zlog_debug_verbose(
- "RHN Entry %d (q=%p): kpfx=%s, upfx=%s, hpfx=%s, ubpi=%p",
- ++count, p, kbuf, ubuf, hbuf, pb->ubpi);
+ "RHN Entry %d (q=%p): kpfx=%pFX, upfx=%pFX, hpfx=%pFX, ubpi=%p",
+ ++count, p, p->key, &pb->upfx, &pb->hpfx, pb->ubpi);
}
}
#endif
@@ -260,15 +252,9 @@ static void vnc_rhnck(char *tag)
* pfx */
assert(!vnc_prefix_cmp(&pb->hpfx, pkey));
if (vnc_prefix_cmp(&pb->hpfx, &pfx_orig_nexthop)) {
- char str_onh[PREFIX_STRLEN];
- char str_nve_pfx[PREFIX_STRLEN];
-
- prefix2str(&pfx_orig_nexthop, str_onh, sizeof(str_onh));
- prefix2str(&pb->hpfx, str_nve_pfx, sizeof(str_nve_pfx));
-
vnc_zlog_debug_verbose(
- "%s: %s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
- __func__, tag, str_onh, str_nve_pfx);
+ "%s: %s: FATAL: resolve_nve_nexthop list item bpi nexthop %pFX != nve pfx %pFX",
+ __func__, tag, &pfx_orig_nexthop, &pb->hpfx);
assert(0);
}
}
@@ -529,13 +515,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
if (!table_rd)
return;
- {
- char str_nh[PREFIX_STRLEN];
-
- prefix2str(ubpi_nexthop, str_nh, sizeof(str_nh));
-
- vnc_zlog_debug_verbose("%s: ubpi_nexthop=%s", __func__, str_nh);
- }
+ vnc_zlog_debug_verbose("%s: ubpi_nexthop=%pFX", __func__, ubpi_nexthop);
/* exact match */
bd = bgp_node_lookup(table_rd, ubpi_nexthop);
@@ -574,12 +554,9 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
/*debugging */
if (VNC_DEBUG(VERBOSE)) {
- char str_pfx[PREFIX_STRLEN];
char str_nh[PREFIX_STRLEN];
struct prefix nh;
- prefix2str(prefix, str_pfx, sizeof(str_pfx));
-
nh.prefixlen = 0;
rfapiUnicastNexthop2Prefix(afi, info->attr, &nh);
if (nh.prefixlen) {
@@ -590,8 +567,8 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
}
vnc_zlog_debug_verbose(
- "%s(bgp=%p, unicast prefix=%s, unicast nh=%s)",
- __func__, bgp, str_pfx, str_nh);
+ "%s(bgp=%p, unicast prefix=%pFX, unicast nh=%s)",
+ __func__, bgp, prefix, str_nh);
}
if (info->type != ZEBRA_ROUTE_BGP) {
@@ -713,12 +690,7 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
uint32_t local_pref;
uint32_t *med = NULL;
- {
- char buf[PREFIX_STRLEN];
-
- prefix2str(prefix, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s(prefix=%s) entry", __func__, buf);
- }
+ vnc_zlog_debug_verbose("%s(prefix=%pFX) entry", __func__, prefix);
if (!afi) {
flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of prefix",
@@ -783,12 +755,8 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
ahr_flags |= RFAPI_AHR_NO_TUNNEL_SUBTLV;
}
- if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(vn_pfx, buf, sizeof(buf));
- vnc_zlog_debug_any("%s vn_pfx=%s", __func__, buf);
- }
+ if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE))
+ vnc_zlog_debug_any("%s vn_pfx=%pFX", __func__, vn_pfx);
/*
* Compute VN address
@@ -899,12 +867,7 @@ static void vnc_import_bgp_add_route_mode_nvegroup(
struct route_map *rmap = NULL;
uint32_t local_pref;
- {
- char buf[PREFIX_STRLEN];
-
- prefix2str(prefix, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s(prefix=%s) entry", __func__, buf);
- }
+ vnc_zlog_debug_verbose("%s(prefix=%pFX) entry", __func__, prefix);
assert(rfg);
@@ -985,12 +948,8 @@ static void vnc_import_bgp_add_route_mode_nvegroup(
vncHDBgpDirect.un_addr = pfx_un.prefix;
}
- if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(vn_pfx, buf, sizeof(buf));
- vnc_zlog_debug_any("%s vn_pfx=%s", __func__, buf);
- }
+ if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE))
+ vnc_zlog_debug_any("%s vn_pfx=%pFX", __func__, vn_pfx);
/*
* Compute VN address
@@ -1288,12 +1247,7 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
if (!table_rd)
return;
- {
- char str_nh[PREFIX_STRLEN];
-
- prefix2str(ubpi_nexthop, str_nh, sizeof(str_nh));
- vnc_zlog_debug_verbose("%s: ubpi_nexthop=%s", __func__, str_nh);
- }
+ vnc_zlog_debug_verbose("%s: ubpi_nexthop=%pFX", __func__, ubpi_nexthop);
/* exact match */
@@ -1467,17 +1421,11 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
memset(&pfx_unicast_nexthop, 0,
sizeof(struct prefix)); /* keep valgrind happy */
- if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) {
- char hbuf[PREFIX_STRLEN];
- char ubuf[PREFIX_STRLEN];
-
- prefix2str(&pb->hpfx, hbuf, sizeof(hbuf));
- prefix2str(&pb->upfx, ubuf, sizeof(ubuf));
-
+ if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE))
vnc_zlog_debug_any(
- "%s: examining RHN Entry (q=%p): upfx=%s, hpfx=%s, ubpi=%p",
- __func__, cursor, ubuf, hbuf, pb->ubpi);
- }
+ "%s: examining RHN Entry (q=%p): upfx=%pFX, hpfx=%pFX, ubpi=%p",
+ __func__, cursor, &pb->upfx, &pb->hpfx,
+ pb->ubpi);
if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubpi, &ecom,
&pfx_unicast_nexthop)) {
@@ -1497,16 +1445,9 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
* Sanity check
*/
if (vnc_prefix_cmp(&pfx_unicast_nexthop, prefix)) {
- char str_unh[PREFIX_STRLEN];
- char str_nve_pfx[PREFIX_STRLEN];
-
- prefix2str(&pfx_unicast_nexthop, str_unh,
- sizeof(str_unh));
- prefix2str(prefix, str_nve_pfx, sizeof(str_nve_pfx));
-
vnc_zlog_debug_verbose(
- "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
- __func__, str_unh, str_nve_pfx);
+ "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %pFX != nve pfx %pFX",
+ __func__, &pfx_unicast_nexthop, prefix);
assert(0);
}
@@ -1521,13 +1462,9 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
#if DEBUG_RHN_LIST
/* debug */
{
- char pbuf[PREFIX_STRLEN];
-
- prefix2str(prefix, pbuf, sizeof(pbuf));
-
vnc_zlog_debug_verbose(
- "%s: advancing past RHN Entry (q=%p): with prefix %s",
- __func__, cursor, pbuf);
+ "%s: advancing past RHN Entry (q=%p): with prefix %pFX",
+ __func__, cursor, prefix);
print_rhn_list(__func__, NULL); /* debug */
}
#endif
@@ -1550,14 +1487,8 @@ void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
struct rfapi_cfg *hc = NULL;
int rc;
- {
- char str_pfx[PREFIX_STRLEN];
-
- prefix2str(prefix, str_pfx, sizeof(str_pfx));
-
- vnc_zlog_debug_verbose("%s(bgp=%p, nve prefix=%s)", __func__,
- bgp, str_pfx);
- }
+ vnc_zlog_debug_verbose("%s(bgp=%p, nve prefix=%pFX)", __func__, bgp,
+ prefix);
if (afi != AFI_IP && afi != AFI_IP6)
return;
@@ -1621,16 +1552,9 @@ void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
* Sanity check
*/
if (vnc_prefix_cmp(&pfx_unicast_nexthop, prefix)) {
- char str_unh[PREFIX_STRLEN];
- char str_nve_pfx[PREFIX_STRLEN];
-
- prefix2str(&pfx_unicast_nexthop, str_unh,
- sizeof(str_unh));
- prefix2str(prefix, str_nve_pfx, sizeof(str_nve_pfx));
-
vnc_zlog_debug_verbose(
- "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
- __func__, str_unh, str_nve_pfx);
+ "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %pFX != nve pfx %pFX",
+ __func__, &pfx_unicast_nexthop, prefix);
assert(0);
}
@@ -2305,13 +2229,11 @@ void vnc_import_bgp_exterior_add_route_interior(
(void **)&pfx_exterior, &cursor)) {
struct prefix pfx_nexthop;
- char buf[PREFIX_STRLEN];
afi_t afi_exterior = family2afi(pfx_exterior->family);
- prefix2str(pfx_exterior, buf, sizeof(buf));
vnc_zlog_debug_verbose(
- "%s: checking exterior orphan at prefix %s", __func__,
- buf);
+ "%s: checking exterior orphan at prefix %pFX", __func__,
+ pfx_exterior);
if (afi_exterior != afi) {
vnc_zlog_debug_verbose(
@@ -2602,15 +2524,10 @@ void vnc_import_bgp_add_route(struct bgp *bgp, const struct prefix *prefix,
if (VNC_DEBUG(VERBOSE)) {
struct prefix pfx_nexthop;
- char buf[PREFIX_STRLEN];
- char buf_nh[PREFIX_STRLEN];
- prefix2str(prefix, buf, sizeof(buf));
rfapiUnicastNexthop2Prefix(afi, info->attr, &pfx_nexthop);
- prefix2str(&pfx_nexthop, buf_nh, sizeof(buf_nh));
-
- vnc_zlog_debug_verbose("%s: pfx %s, nh %s", __func__, buf,
- buf_nh);
+ vnc_zlog_debug_verbose("%s: pfx %pFX, nh %pFX", __func__,
+ prefix, &pfx_nexthop);
}
#if DEBUG_RHN_LIST
print_rhn_list(__func__, "ENTER ");
@@ -2673,15 +2590,10 @@ void vnc_import_bgp_del_route(struct bgp *bgp, const struct prefix *prefix,
{
struct prefix pfx_nexthop;
- char buf[PREFIX_STRLEN];
- char buf_nh[PREFIX_STRLEN];
- prefix2str(prefix, buf, sizeof(buf));
rfapiUnicastNexthop2Prefix(afi, info->attr, &pfx_nexthop);
- prefix2str(&pfx_nexthop, buf_nh, sizeof(buf_nh));
-
- vnc_zlog_debug_verbose("%s: pfx %s, nh %s", __func__, buf,
- buf_nh);
+ vnc_zlog_debug_verbose("%s: pfx %pFX, nh %pFX", __func__,
+ prefix, &pfx_nexthop);
}
#if DEBUG_RHN_LIST
print_rhn_list(__func__, "ENTER ");
diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c
index 008c7b28b..b254f11ce 100644
--- a/bgpd/rfapi/vnc_zebra.c
+++ b/bgpd/rfapi/vnc_zebra.c
@@ -363,15 +363,11 @@ static int vnc_zebra_read_route(ZAPI_CALLBACK_ARGS)
else
vnc_redistribute_delete(&api.prefix, api.type);
- if (BGP_DEBUG(zebra, ZEBRA)) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf, sizeof(buf));
+ if (BGP_DEBUG(zebra, ZEBRA))
vnc_zlog_debug_verbose(
- "%s: Zebra rcvd: route delete %s %s metric %u",
- __func__, zebra_route_string(api.type), buf,
+ "%s: Zebra rcvd: route delete %s %pFX metric %u",
+ __func__, zebra_route_string(api.type), &api.prefix,
api.metric);
- }
return 0;
}
@@ -425,14 +421,10 @@ static void vnc_zebra_route_msg(const struct prefix *p, unsigned int nhp_count,
}
}
- if (BGP_DEBUG(zebra, ZEBRA)) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf, sizeof(buf));
+ if (BGP_DEBUG(zebra, ZEBRA))
vnc_zlog_debug_verbose(
- "%s: Zebra send: route %s %s, nhp_count=%d", __func__,
- (add ? "add" : "del"), buf, nhp_count);
- }
+ "%s: Zebra send: route %s %pFX, nhp_count=%d", __func__,
+ (add ? "add" : "del"), &api.prefix, nhp_count);
zclient_route_send((add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE),
zclient_vnc, &api);
diff --git a/eigrpd/eigrp_dump.c b/eigrpd/eigrp_dump.c
index 97de73116..fa11106a4 100644
--- a/eigrpd/eigrp_dump.c
+++ b/eigrpd/eigrp_dump.c
@@ -240,12 +240,10 @@ void show_ip_eigrp_topology_header(struct vty *vty, struct eigrp *eigrp)
void show_ip_eigrp_prefix_entry(struct vty *vty, struct eigrp_prefix_entry *tn)
{
struct list *successors = eigrp_topology_get_successor(tn);
- char buffer[PREFIX_STRLEN];
vty_out(vty, "%-3c", (tn->state > 0) ? 'A' : 'P');
- vty_out(vty, "%s, ",
- prefix2str(tn->destination, buffer, PREFIX_STRLEN));
+ vty_out(vty, "%pFX, ", tn->destination);
vty_out(vty, "%u successors, ", (successors) ? successors->count : 0);
vty_out(vty, "FD is %u, serno: %" PRIu64 " \n", tn->fdistance,
tn->serno);
diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c
index 79405efbb..26bb27d7a 100644
--- a/eigrpd/eigrp_reply.c
+++ b/eigrpd/eigrp_reply.c
@@ -168,13 +168,10 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph,
* Destination must exists
*/
if (!dest) {
- char buf[PREFIX_STRLEN];
-
flog_err(
EC_EIGRP_PACKET,
- "%s: Received prefix %s which we do not know about",
- __func__,
- prefix2str(&dest_addr, buf, sizeof(buf)));
+ "%s: Received prefix %pFX which we do not know about",
+ __func__, &dest_addr);
eigrp_IPv4_InternalTLV_free(tlv);
continue;
}
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index 7676af15f..2dbee1669 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -133,14 +133,10 @@ void eigrp_prefix_entry_add(struct route_table *topology,
rn = route_node_get(topology, pe->destination);
if (rn->info) {
- if (IS_DEBUG_EIGRP_EVENT) {
- char buf[PREFIX_STRLEN];
-
+ if (IS_DEBUG_EIGRP_EVENT)
zlog_debug(
- "%s: %s Should we have found this entry in the topo table?",
- __func__,
- prefix2str(pe->destination, buf, sizeof(buf)));
- }
+ "%s: %pFX Should we have found this entry in the topo table?",
+ __func__, pe->destination);
route_unlock_node(rn);
}
diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c
index 6e2a81e32..16140ec1d 100644
--- a/eigrpd/eigrp_update.c
+++ b/eigrpd/eigrp_update.c
@@ -141,10 +141,8 @@ static void eigrp_update_receive_GR_ask(struct eigrp *eigrp,
/* iterate over all prefixes which weren't advertised by neighbor */
for (ALL_LIST_ELEMENTS_RO(nbr_prefixes, node1, prefix)) {
- char buffer[PREFIX_STRLEN];
- zlog_debug(
- "GR receive: Neighbor not advertised %s",
- prefix2str(prefix->destination, buffer, PREFIX_STRLEN));
+ zlog_debug("GR receive: Neighbor not advertised %pFX",
+ prefix->destination);
fsm_msg.metrics = prefix->reported_metric;
/* set delay to MAX */
diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c
index 3205f1392..473cc75a2 100644
--- a/eigrpd/eigrp_zebra.c
+++ b/eigrpd/eigrp_zebra.c
@@ -150,12 +150,9 @@ static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS)
if (c == NULL)
return 0;
- if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) {
- char buf[128];
- prefix2str(c->address, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s address add %s", c->ifp->name,
- buf);
- }
+ if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: interface %s address add %pFX", c->ifp->name,
+ c->address);
eigrp_if_update(c->ifp);
@@ -173,12 +170,9 @@ static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS)
if (c == NULL)
return 0;
- if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) {
- char buf[128];
- prefix2str(c->address, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s address delete %s",
- c->ifp->name, buf);
- }
+ if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: interface %s address delete %pFX",
+ c->ifp->name, c->address);
ifp = c->ifp;
ei = ifp->info;
@@ -234,10 +228,9 @@ void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p,
api.nexthop_num = count;
if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[2][PREFIX_STRLEN];
- zlog_debug("Zebra: Route add %s nexthop %s",
- prefix2str(p, buf[0], PREFIX_STRLEN),
- inet_ntop(AF_INET, 0, buf[1], PREFIX_STRLEN));
+ char buf[PREFIX_STRLEN];
+ zlog_debug("Zebra: Route add %pFX nexthop %s", p,
+ inet_ntop(AF_INET, 0, buf, PREFIX_STRLEN));
}
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
@@ -257,11 +250,8 @@ void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p)
memcpy(&api.prefix, p, sizeof(*p));
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
- if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX_STRLEN];
- zlog_debug("Zebra: Route del %s",
- prefix2str(p, buf, PREFIX_STRLEN));
- }
+ if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE))
+ zlog_debug("Zebra: Route del %pFX", p);
return;
}
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index 695e1318a..3eb3b900a 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -253,9 +253,6 @@ void isis_circuit_add_addr(struct isis_circuit *circuit,
{
struct listnode *node;
struct prefix_ipv4 *ipv4;
-#if defined(EXTREME_DEBUG)
- char buf[PREFIX2STR_BUFFER];
-#endif
struct prefix_ipv6 *ipv6;
if (connected->address->family == AF_INET) {
@@ -287,9 +284,8 @@ void isis_circuit_add_addr(struct isis_circuit *circuit,
0);
#ifdef EXTREME_DEBUG
- prefix2str(connected->address, buf, sizeof(buf));
- zlog_debug("Added IP address %s to circuit %s", buf,
- circuit->interface->name);
+ zlog_debug("Added IP address %pFX to circuit %s",
+ connected->address, circuit->interface->name);
#endif /* EXTREME_DEBUG */
}
if (connected->address->family == AF_INET6) {
@@ -318,9 +314,8 @@ void isis_circuit_add_addr(struct isis_circuit *circuit,
0);
#ifdef EXTREME_DEBUG
- prefix2str(connected->address, buf, sizeof(buf));
- zlog_debug("Added IPv6 address %s to circuit %s", buf,
- circuit->interface->name);
+ zlog_debug("Added IPv6 address %pFX to circuit %s",
+ connected->address, circuit->interface->name);
#endif /* EXTREME_DEBUG */
}
return;
@@ -331,7 +326,6 @@ void isis_circuit_del_addr(struct isis_circuit *circuit,
{
struct prefix_ipv4 *ipv4, *ip = NULL;
struct listnode *node;
- char buf[PREFIX2STR_BUFFER];
struct prefix_ipv6 *ipv6, *ip6 = NULL;
int found = 0;
@@ -352,16 +346,14 @@ void isis_circuit_del_addr(struct isis_circuit *circuit,
lsp_regenerate_schedule(circuit->area,
circuit->is_type, 0);
} else {
- prefix2str(connected->address, buf, sizeof(buf));
zlog_warn(
- "Nonexistent ip address %s removal attempt from circuit %s",
- buf, circuit->interface->name);
+ "Nonexistent ip address %pFX removal attempt from circuit %s",
+ connected->address, circuit->interface->name);
zlog_warn("Current ip addresses on %s:",
circuit->interface->name);
for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node,
ip)) {
- prefix2str(ip, buf, sizeof(buf));
- zlog_warn(" %s", buf);
+ zlog_warn(" %pFX", ip);
}
zlog_warn("End of addresses");
}
@@ -400,25 +392,18 @@ void isis_circuit_del_addr(struct isis_circuit *circuit,
}
if (!found) {
- prefix2str(connected->address, buf, sizeof(buf));
zlog_warn(
- "Nonexistent ip address %s removal attempt from circuit %s",
- buf, circuit->interface->name);
+ "Nonexistent ip address %pFX removal attempt from circuit %s",
+ connected->address, circuit->interface->name);
zlog_warn("Current ip addresses on %s:",
circuit->interface->name);
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node,
- ip6)) {
- prefix2str((struct prefix *)ip6, (char *)buf,
- sizeof(buf));
- zlog_warn(" %s", buf);
- }
+ ip6))
+ zlog_warn(" %pFX", (struct prefix *)ip6);
zlog_warn(" -----");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node,
- ip6)) {
- prefix2str((struct prefix *)ip6, (char *)buf,
- sizeof(buf));
- zlog_warn(" %s", buf);
- }
+ ip6))
+ zlog_warn(" %pFX", (struct prefix *)ip6);
zlog_warn("End of addresses");
} else if (circuit->area)
lsp_regenerate_schedule(circuit->area, circuit->is_type,
@@ -895,7 +880,6 @@ void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty,
if (detail == ISIS_UI_LEVEL_DETAIL) {
struct listnode *node;
struct prefix *ip_addr;
- char buf[BUFSIZ];
vty_out(vty, " Interface: %s", circuit->interface->name);
vty_out(vty, ", State: %s",
@@ -980,27 +964,21 @@ void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty,
if (circuit->ip_addrs && listcount(circuit->ip_addrs) > 0) {
vty_out(vty, " IP Prefix(es):\n");
for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node,
- ip_addr)) {
- prefix2str(ip_addr, buf, sizeof(buf));
- vty_out(vty, " %s\n", buf);
- }
+ ip_addr))
+ vty_out(vty, " %pFX\n", ip_addr);
}
if (circuit->ipv6_link && listcount(circuit->ipv6_link) > 0) {
vty_out(vty, " IPv6 Link-Locals:\n");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node,
- ip_addr)) {
- prefix2str(ip_addr, (char *)buf, BUFSIZ);
- vty_out(vty, " %s\n", buf);
- }
+ ip_addr))
+ vty_out(vty, " %pFX\n", ip_addr);
}
if (circuit->ipv6_non_link
&& listcount(circuit->ipv6_non_link) > 0) {
vty_out(vty, " IPv6 Prefixes:\n");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node,
- ip_addr)) {
- prefix2str(ip_addr, (char *)buf, BUFSIZ);
- vty_out(vty, " %s\n", buf);
- }
+ ip_addr))
+ vty_out(vty, " %pFX\n", ip_addr);
}
vty_out(vty, "\n");
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 7abfbe63c..2e38663d3 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -852,7 +852,6 @@ static struct isis_lsp *lsp_next_frag(uint8_t frag_num, struct isis_lsp *lsp0,
static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
{
int level = lsp->level;
- char buf[PREFIX2STR_BUFFER];
struct listnode *node;
struct isis_lsp *frag;
@@ -964,9 +963,8 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
*/
if (area->isis->router_id != 0) {
struct in_addr id = {.s_addr = area->isis->router_id};
- inet_ntop(AF_INET, &id, buf, sizeof(buf));
- lsp_debug("ISIS (%s): Adding router ID %s as IPv4 tlv.",
- area->area_tag, buf);
+ lsp_debug("ISIS (%s): Adding router ID %pI4 as IPv4 tlv.",
+ area->area_tag, &id);
isis_tlvs_add_ipv4_address(lsp->tlvs, &id);
/* If new style TLV's are in use, add TE router ID TLV
@@ -1033,10 +1031,8 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
ipv4)) {
if (area->oldmetric) {
lsp_debug(
- "ISIS (%s): Adding old-style IP reachability for %s",
- area->area_tag,
- prefix2str(ipv4, buf,
- sizeof(buf)));
+ "ISIS (%s): Adding old-style IP reachability for %pFX",
+ area->area_tag, ipv4);
isis_tlvs_add_oldstyle_ip_reach(
lsp->tlvs, ipv4, metric);
}
@@ -1045,10 +1041,8 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
struct sr_prefix_cfg *pcfg = NULL;
lsp_debug(
- "ISIS (%s): Adding te-style IP reachability for %s",
- area->area_tag,
- prefix2str(ipv4, buf,
- sizeof(buf)));
+ "ISIS (%s): Adding te-style IP reachability for %pFX",
+ area->area_tag, ipv4);
if (area->srdb.enabled)
pcfg = isis_sr_cfg_prefix_find(
@@ -1071,9 +1065,8 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
struct sr_prefix_cfg *pcfg = NULL;
lsp_debug(
- "ISIS (%s): Adding IPv6 reachability for %s",
- area->area_tag,
- prefix2str(ipv6, buf, sizeof(buf)));
+ "ISIS (%s): Adding IPv6 reachability for %pFX",
+ area->area_tag, ipv6);
if (area->srdb.enabled)
pcfg = isis_sr_cfg_prefix_find(area,
diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c
index 44422ff66..e6c7a734b 100644
--- a/isisd/isis_redist.c
+++ b/isisd/isis_redist.c
@@ -231,11 +231,8 @@ void isis_redist_add(struct isis *isis, int type, struct prefix *p,
int level;
struct isis_redist *redist;
- char debug_buf[BUFSIZ];
- prefix2str(p, debug_buf, sizeof(debug_buf));
-
- zlog_debug("%s: New route %s from %s: distance %d.", __func__,
- debug_buf, zebra_route_string(type), distance);
+ zlog_debug("%s: New route %pFX from %s: distance %d.", __func__, p,
+ zebra_route_string(type), distance);
if (!ei_table) {
zlog_warn("%s: External information table not initialized.",
@@ -282,10 +279,7 @@ void isis_redist_delete(struct isis *isis, int type, struct prefix *p,
int level;
struct isis_redist *redist;
- char debug_buf[BUFSIZ];
- prefix2str(p, debug_buf, sizeof(debug_buf));
-
- zlog_debug("%s: Removing route %s from %s.", __func__, debug_buf,
+ zlog_debug("%s: Removing route %pFX from %s.", __func__, p,
zebra_route_string(type));
if (is_default_prefix(p)
@@ -307,11 +301,9 @@ void isis_redist_delete(struct isis *isis, int type, struct prefix *p,
ei_node = srcdest_rnode_lookup(ei_table, p, src_p);
if (!ei_node || !ei_node->info) {
- char buf[BUFSIZ];
- prefix2str(p, buf, sizeof(buf));
zlog_warn(
- "%s: Got a delete for %s route %s, but that route was never added.",
- __func__, zebra_route_string(type), buf);
+ "%s: Got a delete for %s route %pFX, but that route was never added.",
+ __func__, zebra_route_string(type), p);
if (ei_node)
route_unlock_node(ei_node);
return;
diff --git a/isisd/isis_route.c b/isisd/isis_route.c
index 0868ab487..7e8c877bd 100644
--- a/isisd/isis_route.c
+++ b/isisd/isis_route.c
@@ -313,12 +313,8 @@ struct isis_route_info *isis_route_create(struct prefix *prefix,
{
struct route_node *route_node;
struct isis_route_info *rinfo_new, *rinfo_old, *route_info = NULL;
- char buff[PREFIX2STR_BUFFER];
char change_buf[64];
- /* for debugs */
- prefix2str(prefix, buff, sizeof(buff));
-
if (!table)
return NULL;
@@ -329,31 +325,32 @@ struct isis_route_info *isis_route_create(struct prefix *prefix,
rinfo_old = route_node->info;
if (!rinfo_old) {
if (IS_DEBUG_RTE_EVENTS)
- zlog_debug("ISIS-Rte (%s) route created: %s",
- area->area_tag, buff);
+ zlog_debug("ISIS-Rte (%s) route created: %pFX",
+ area->area_tag, prefix);
route_info = rinfo_new;
UNSET_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
} else {
route_unlock_node(route_node);
#ifdef EXTREME_DEBUG
if (IS_DEBUG_RTE_EVENTS)
- zlog_debug("ISIS-Rte (%s) route already exists: %s",
- area->area_tag, buff);
+ zlog_debug("ISIS-Rte (%s) route already exists: %pFX",
+ area->area_tag, prefix);
#endif /* EXTREME_DEBUG */
if (isis_route_info_same(rinfo_new, rinfo_old, change_buf,
sizeof(change_buf))) {
#ifdef EXTREME_DEBUG
if (IS_DEBUG_RTE_EVENTS)
- zlog_debug("ISIS-Rte (%s) route unchanged: %s",
- area->area_tag, buff);
+ zlog_debug(
+ "ISIS-Rte (%s) route unchanged: %pFX",
+ area->area_tag, prefix);
#endif /* EXTREME_DEBUG */
isis_route_info_delete(rinfo_new);
route_info = rinfo_old;
} else {
if (IS_DEBUG_RTE_EVENTS)
zlog_debug(
- "ISIS-Rte (%s): route changed: %s, change: %s",
- area->area_tag, buff, change_buf);
+ "ISIS-Rte (%s): route changed: %pFX, change: %s",
+ area->area_tag, prefix, change_buf);
isis_route_info_delete(rinfo_old);
route_info = rinfo_new;
UNSET_FLAG(route_info->flag,
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index 0e92dc2a8..aeb54fce2 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -87,10 +87,6 @@ static int isis_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
{
struct isis_circuit *circuit;
struct connected *c;
-#ifdef EXTREME_DEBUG
- struct prefix *p;
- char buf[PREFIX2STR_BUFFER];
-#endif /* EXTREME_DEBUG */
c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_ADD,
zclient->ibuf, vrf_id);
@@ -99,13 +95,10 @@ static int isis_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
return 0;
#ifdef EXTREME_DEBUG
- p = c->address;
- prefix2str(p, buf, sizeof(buf));
-
if (p->family == AF_INET)
- zlog_debug("connected IP address %s", buf);
+ zlog_debug("connected IP address %pFX", c->address);
if (p->family == AF_INET6)
- zlog_debug("connected IPv6 address %s", buf);
+ zlog_debug("connected IPv6 address %pFX", c->address);
#endif /* EXTREME_DEBUG */
if (if_is_operative(c->ifp)) {
@@ -121,10 +114,6 @@ static int isis_zebra_if_address_del(ZAPI_CALLBACK_ARGS)
{
struct isis_circuit *circuit;
struct connected *c;
-#ifdef EXTREME_DEBUG
- struct prefix *p;
- char buf[PREFIX2STR_BUFFER];
-#endif /* EXTREME_DEBUG */
c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_DELETE,
zclient->ibuf, vrf_id);
@@ -133,13 +122,10 @@ static int isis_zebra_if_address_del(ZAPI_CALLBACK_ARGS)
return 0;
#ifdef EXTREME_DEBUG
- p = c->address;
- prefix2str(p, buf, sizeof(buf));
-
if (p->family == AF_INET)
- zlog_debug("disconnected IP address %s", buf);
+ zlog_debug("disconnected IP address %pFX", c->address);
if (p->family == AF_INET6)
- zlog_debug("disconnected IPv6 address %s", buf);
+ zlog_debug("disconnected IPv6 address %pFX", c->address);
#endif /* EXTREME_DEBUG */
if (if_is_operative(c->ifp)) {
diff --git a/lib/routemap.c b/lib/routemap.c
index 1352bae58..0eb54a479 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -2377,7 +2377,6 @@ route_map_result_t route_map_apply(struct route_map *map,
route_map_result_t ret = RMAP_PERMITMATCH;
struct route_map_index *index = NULL;
struct route_map_rule *set = NULL;
- char buf[PREFIX_STRLEN];
bool skip_match_clause = false;
if (recursion > RMAP_RECURSION_LIMIT) {
@@ -2403,16 +2402,14 @@ route_map_result_t route_map_apply(struct route_map *map,
if (index) {
if (rmap_debug)
zlog_debug(
- "Best match route-map: %s, sequence: %d for pfx: %s, result: %s",
- map->name, index->pref,
- prefix2str(prefix, buf, sizeof(buf)),
+ "Best match route-map: %s, sequence: %d for pfx: %pFX, result: %s",
+ map->name, index->pref, prefix,
route_map_cmd_result_str(match_ret));
} else {
if (rmap_debug)
zlog_debug(
- "No best match sequence for pfx: %s in route-map: %s, result: %s",
- prefix2str(prefix, buf, sizeof(buf)),
- map->name,
+ "No best match sequence for pfx: %pFX in route-map: %s, result: %s",
+ prefix, map->name,
route_map_cmd_result_str(match_ret));
/*
* No index matches this prefix. Return deny unless,
@@ -2437,9 +2434,8 @@ route_map_result_t route_map_apply(struct route_map *map,
prefix, type, object);
if (rmap_debug) {
zlog_debug(
- "Route-map: %s, sequence: %d, prefix: %s, result: %s",
- map->name, index->pref,
- prefix2str(prefix, buf, sizeof(buf)),
+ "Route-map: %s, sequence: %d, prefix: %pFX, result: %s",
+ map->name, index->pref, prefix,
route_map_cmd_result_str(match_ret));
}
} else
@@ -2549,12 +2545,10 @@ route_map_result_t route_map_apply(struct route_map *map,
}
route_map_apply_end:
- if (rmap_debug) {
- zlog_debug("Route-map: %s, prefix: %s, result: %s",
- (map ? map->name : "null"),
- prefix2str(prefix, buf, sizeof(buf)),
+ if (rmap_debug)
+ zlog_debug("Route-map: %s, prefix: %pFX, result: %s",
+ (map ? map->name : "null"), prefix,
route_map_result_str(ret));
- }
return (ret);
}
diff --git a/lib/zclient.c b/lib/zclient.c
index 914b02749..d0144279e 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -1116,13 +1116,11 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
if (CHECK_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP)) {
/* limit the number of nexthops if necessary */
if (api->nexthop_num > MULTIPATH_NUM) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&api->prefix, buf, sizeof(buf));
flog_err(
EC_LIB_ZAPI_ENCODE,
- "%s: prefix %s: can't encode %u nexthops (maximum is %u)",
- __func__, buf, api->nexthop_num, MULTIPATH_NUM);
+ "%s: prefix %pFX: can't encode %u nexthops (maximum is %u)",
+ __func__, &api->prefix, api->nexthop_num,
+ MULTIPATH_NUM);
return -1;
}
@@ -1139,15 +1137,11 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
/* MPLS labels for BGP-LU or Segment Routing */
if (api_nh->label_num > MPLS_MAX_LABELS) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&api->prefix, buf, sizeof(buf));
-
- flog_err(EC_LIB_ZAPI_ENCODE,
- "%s: prefix %s: can't encode %u labels (maximum is %u)",
- __func__, buf,
- api_nh->label_num,
- MPLS_MAX_LABELS);
+ flog_err(
+ EC_LIB_ZAPI_ENCODE,
+ "%s: prefix %pFX: can't encode %u labels (maximum is %u)",
+ __func__, &api->prefix,
+ api_nh->label_num, MPLS_MAX_LABELS);
return -1;
}
@@ -1162,13 +1156,10 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
if (CHECK_FLAG(api->message, ZAPI_MESSAGE_BACKUP_NEXTHOPS)) {
/* limit the number of nexthops if necessary */
if (api->backup_nexthop_num > MULTIPATH_NUM) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&api->prefix, buf, sizeof(buf));
flog_err(
EC_LIB_ZAPI_ENCODE,
- "%s: prefix %s: can't encode %u backup nexthops (maximum is %u)",
- __func__, buf, api->backup_nexthop_num,
+ "%s: prefix %pFX: can't encode %u backup nexthops (maximum is %u)",
+ __func__, &api->prefix, api->backup_nexthop_num,
MULTIPATH_NUM);
return -1;
}
@@ -1185,15 +1176,11 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
/* MPLS labels for BGP-LU or Segment Routing */
if (api_nh->label_num > MPLS_MAX_LABELS) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&api->prefix, buf, sizeof(buf));
-
- flog_err(EC_LIB_ZAPI_ENCODE,
- "%s: prefix %s: backup: can't encode %u labels (maximum is %u)",
- __func__, buf,
- api_nh->label_num,
- MPLS_MAX_LABELS);
+ flog_err(
+ EC_LIB_ZAPI_ENCODE,
+ "%s: prefix %pFX: backup: can't encode %u labels (maximum is %u)",
+ __func__, &api->prefix,
+ api_nh->label_num, MPLS_MAX_LABELS);
return -1;
}
@@ -2319,13 +2306,10 @@ struct connected *zebra_interface_address_read(int type, struct stream *s,
else if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) {
/* carp interfaces on OpenBSD with 0.0.0.0/0 as
* "peer" */
- char buf[PREFIX_STRLEN];
flog_err(
EC_LIB_ZAPI_ENCODE,
- "warning: interface %s address %s with peer flag set, but no peer address!",
- ifp->name,
- prefix2str(ifc->address, buf,
- sizeof(buf)));
+ "warning: interface %s address %pFX with peer flag set, but no peer address!",
+ ifp->name, ifc->address);
UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
}
}
diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c
index 1e576fc5a..0ed2371eb 100644
--- a/nhrpd/nhrp_interface.c
+++ b/nhrpd/nhrp_interface.c
@@ -220,8 +220,8 @@ static void nhrp_interface_update_address(struct interface *ifp, afi_t afi,
/* On NHRP interfaces a host prefix is required */
if (best && if_ad->configured
&& best->address->prefixlen != 8 * prefix_blen(best->address)) {
- zlog_notice("%s: %s is not a host prefix", ifp->name,
- prefix2str(best->address, buf, sizeof(buf)));
+ zlog_notice("%s: %pFX is not a host prefix", ifp->name,
+ best->address);
best = NULL;
}
@@ -335,14 +335,13 @@ int nhrp_ifp_down(struct interface *ifp)
int nhrp_interface_address_add(ZAPI_CALLBACK_ARGS)
{
struct connected *ifc;
- char buf[PREFIX_STRLEN];
ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (ifc == NULL)
return 0;
- debugf(NHRP_DEBUG_IF, "if-addr-add: %s: %s", ifc->ifp->name,
- prefix2str(ifc->address, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_IF, "if-addr-add: %s: %pFX", ifc->ifp->name,
+ ifc->address);
nhrp_interface_update_address(
ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0);
@@ -353,14 +352,13 @@ int nhrp_interface_address_add(ZAPI_CALLBACK_ARGS)
int nhrp_interface_address_delete(ZAPI_CALLBACK_ARGS)
{
struct connected *ifc;
- char buf[PREFIX_STRLEN];
ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (ifc == NULL)
return 0;
- debugf(NHRP_DEBUG_IF, "if-addr-del: %s: %s", ifc->ifp->name,
- prefix2str(ifc->address, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_IF, "if-addr-del: %s: %pFX", ifc->ifp->name,
+ ifc->address);
nhrp_interface_update_address(
ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0);
diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c
index 0c5513b89..2bc2d9159 100644
--- a/nhrpd/nhrp_route.c
+++ b/nhrpd/nhrp_route.c
@@ -166,14 +166,13 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type,
}
if (unlikely(debug_flags & NHRP_DEBUG_ROUTE)) {
- char buf[2][PREFIX_STRLEN];
+ char buf[PREFIX_STRLEN];
- prefix2str(&api.prefix, buf[0], sizeof(buf[0]));
zlog_debug(
- "Zebra send: route %s %s nexthop %s metric %u count %d dev %s",
- add ? "add" : "del", buf[0],
+ "Zebra send: route %s %pFX nexthop %s metric %u count %d dev %s",
+ add ? "add" : "del", &api.prefix,
nexthop ? inet_ntop(api.prefix.family, &api_nh->gate,
- buf[1], sizeof(buf[1]))
+ buf, sizeof(buf))
: "<onlink>",
api.metric, api.nexthop_num, ifp ? ifp->name : "none");
}
@@ -188,7 +187,7 @@ int nhrp_route_read(ZAPI_CALLBACK_ARGS)
struct zapi_nexthop *api_nh;
struct interface *ifp = NULL;
union sockunion nexthop_addr;
- char buf[2][PREFIX_STRLEN];
+ char buf[PREFIX_STRLEN];
int added;
if (zapi_route_decode(zclient->ibuf, &api) < 0)
@@ -221,10 +220,9 @@ int nhrp_route_read(ZAPI_CALLBACK_ARGS)
}
added = (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD);
- debugf(NHRP_DEBUG_ROUTE, "if-route-%s: %s via %s dev %s",
- added ? "add" : "del",
- prefix2str(&api.prefix, buf[0], sizeof(buf[0])),
- sockunion2str(&nexthop_addr, buf[1], sizeof(buf[1])),
+ debugf(NHRP_DEBUG_ROUTE, "if-route-%s: %pFX via %s dev %s",
+ added ? "add" : "del", &api.prefix,
+ sockunion2str(&nexthop_addr, buf, sizeof(buf)),
ifp ? ifp->name : "(none)");
nhrp_route_update_zebra(&api.prefix, &nexthop_addr, ifp);
@@ -240,7 +238,6 @@ int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p,
struct route_info *ri;
struct prefix lookup;
afi_t afi = family2afi(sockunion_family(addr));
- char buf[PREFIX_STRLEN];
sockunion2hostprefix(addr, &lookup);
@@ -250,8 +247,7 @@ int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p,
ri = rn->info;
if (ri->nhrp_ifp) {
- debugf(NHRP_DEBUG_ROUTE, "lookup %s: nhrp_if=%s",
- prefix2str(&lookup, buf, sizeof(buf)),
+ debugf(NHRP_DEBUG_ROUTE, "lookup %pFX: nhrp_if=%s", &lookup,
ri->nhrp_ifp->name);
if (via)
@@ -259,9 +255,8 @@ int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p,
if (ifp)
*ifp = ri->nhrp_ifp;
} else {
- debugf(NHRP_DEBUG_ROUTE, "lookup %s: zebra route dev %s",
- prefix2str(&lookup, buf, sizeof(buf)),
- ri->ifp ? ri->ifp->name : "(none)");
+ debugf(NHRP_DEBUG_ROUTE, "lookup %pFX: zebra route dev %s",
+ &lookup, ri->ifp ? ri->ifp->name : "(none)");
if (via)
*via = ri->via;
diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c
index 1c2b2b28f..9a6f77334 100644
--- a/nhrpd/nhrp_shortcut.c
+++ b/nhrpd/nhrp_shortcut.c
@@ -28,11 +28,9 @@ static void nhrp_shortcut_send_resolution_req(struct nhrp_shortcut *s);
static void nhrp_shortcut_check_use(struct nhrp_shortcut *s)
{
- char buf[PREFIX_STRLEN];
-
if (s->expiring && s->cache && s->cache->used) {
- debugf(NHRP_DEBUG_ROUTE, "Shortcut %s used and expiring",
- prefix2str(s->p, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX used and expiring",
+ s->p);
nhrp_shortcut_send_resolution_req(s);
}
}
@@ -53,8 +51,6 @@ static int nhrp_shortcut_do_expire(struct thread *t)
static void nhrp_shortcut_cache_notify(struct notifier_block *n,
unsigned long cmd)
{
- char buf[PREFIX_STRLEN];
-
struct nhrp_shortcut *s =
container_of(n, struct nhrp_shortcut, cache_notifier);
@@ -62,9 +58,8 @@ static void nhrp_shortcut_cache_notify(struct notifier_block *n,
case NOTIFY_CACHE_UP:
if (!s->route_installed) {
debugf(NHRP_DEBUG_ROUTE,
- "Shortcut: route install %s nh (unspec) dev %s",
- prefix2str(s->p, buf, sizeof(buf)),
- s->cache->ifp->name);
+ "Shortcut: route install %pFX nh (unspec) dev %s",
+ s->p, s->cache->ifp->name);
nhrp_route_announce(1, s->type, s->p, s->cache->ifp,
NULL, 0);
@@ -152,13 +147,11 @@ static void nhrp_shortcut_delete(struct nhrp_shortcut *s)
{
struct route_node *rn;
afi_t afi = family2afi(PREFIX_FAMILY(s->p));
- char buf[PREFIX_STRLEN];
THREAD_OFF(s->t_timer);
nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid);
- debugf(NHRP_DEBUG_ROUTE, "Shortcut %s purged",
- prefix2str(s->p, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX purged", s->p);
nhrp_shortcut_update_binding(s, NHRP_CACHE_INVALID, NULL, 0);
@@ -184,7 +177,6 @@ static struct nhrp_shortcut *nhrp_shortcut_get(struct prefix *p)
{
struct nhrp_shortcut *s;
struct route_node *rn;
- char buf[PREFIX_STRLEN];
afi_t afi = family2afi(PREFIX_FAMILY(p));
if (!shortcut_rib[afi])
@@ -197,8 +189,7 @@ static struct nhrp_shortcut *nhrp_shortcut_get(struct prefix *p)
s->type = NHRP_CACHE_INVALID;
s->p = &rn->p;
- debugf(NHRP_DEBUG_ROUTE, "Shortcut %s created",
- prefix2str(s->p, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX created", s->p);
} else {
s = rn->info;
route_unlock_node(rn);
@@ -219,7 +210,7 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid,
union sockunion *proto, cie_proto, *nbma, cie_nbma, nat_nbma;
struct prefix prefix, route_prefix;
struct zbuf extpl;
- char bufp[PREFIX_STRLEN], buf[4][SU_ADDRSTRLEN];
+ char buf[4][SU_ADDRSTRLEN];
int holding_time = pp->if_ad->holdtime;
nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid);
@@ -287,9 +278,8 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid,
}
debugf(NHRP_DEBUG_COMMON,
- "Shortcut: %s is at proto %s dst_proto %s cie-nbma %s nat-nbma %s cie-holdtime %d",
- prefix2str(&prefix, bufp, sizeof(bufp)),
- sockunion2str(proto, buf[0], sizeof(buf[0])),
+ "Shortcut: %pFX is at proto %s dst_proto %s cie-nbma %s nat-nbma %s cie-holdtime %d",
+ &prefix, sockunion2str(proto, buf[0], sizeof(buf[0])),
sockunion2str(&pp->dst_proto, buf[1], sizeof(buf[1])),
sockunion2str(&cie_nbma, buf[2], sizeof(buf[2])),
sockunion2str(&nat_nbma, buf[3], sizeof(buf[3])),
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index 6fe3a289c..cbb80b668 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -153,7 +153,6 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
struct ospf6_inter_router_lsa *router_lsa;
struct ospf6_route_table *summary_table = NULL;
uint16_t type;
- char buf[PREFIX2STR_BUFFER];
int is_debug = 0;
/* Only destination type network, range or ASBR are considered */
@@ -196,12 +195,10 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
if (route->type == OSPF6_DEST_TYPE_ROUTER) {
if (ADV_ROUTER_IN_PREFIX(&route->prefix)
== area->ospf6->router_id) {
- inet_ntop(AF_INET,
- &(ADV_ROUTER_IN_PREFIX(&route->prefix)), buf,
- sizeof(buf));
zlog_debug(
- "%s: Skipping ASBR announcement for ABR (%s)",
- __func__, buf);
+ "%s: Skipping ASBR announcement for ABR (%pFX)",
+ __func__,
+ &ADV_ROUTER_IN_PREFIX(&route->prefix));
return 0;
}
}
@@ -210,11 +207,10 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
if (IS_OSPF6_DEBUG_ABR
|| IS_OSPF6_DEBUG_ORIGINATE(INTER_ROUTER)) {
is_debug++;
- inet_ntop(AF_INET,
- &(ADV_ROUTER_IN_PREFIX(&route->prefix)), buf,
- sizeof(buf));
- zlog_debug("Originating summary in area %s for ASBR %s",
- area->name, buf);
+ zlog_debug(
+ "Originating summary in area %s for ASBR %pFX",
+ area->name,
+ &ADV_ROUTER_IN_PREFIX(&route->prefix));
}
summary_table = area->summary_router;
} else {
@@ -226,16 +222,13 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
route->path.origin.type ==
htons(OSPF6_LSTYPE_INTER_PREFIX)) {
if (!CHECK_FLAG(route->flag, OSPF6_ROUTE_BEST)) {
- if (is_debug) {
- inet_ntop(AF_INET,
- &(ADV_ROUTER_IN_PREFIX(
- &route->prefix)), buf,
- sizeof(buf));
+ if (is_debug)
zlog_debug(
- "%s: route %s with cost %u is not best, ignore.",
- __func__, buf,
+ "%s: route %pFX with cost %u is not best, ignore.",
+ __func__,
+ &ADV_ROUTER_IN_PREFIX(
+ &route->prefix),
route->path.cost);
- }
return 0;
}
}
@@ -243,23 +236,19 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
if (route->path.origin.type ==
htons(OSPF6_LSTYPE_INTRA_PREFIX)) {
if (!CHECK_FLAG(route->flag, OSPF6_ROUTE_BEST)) {
- if (is_debug) {
- prefix2str(&route->prefix, buf,
- sizeof(buf));
+ if (is_debug)
zlog_debug(
- "%s: intra-prefix route %s with cost %u is not best, ignore.",
- __func__, buf,
+ "%s: intra-prefix route %pFX with cost %u is not best, ignore.",
+ __func__, &route->prefix,
route->path.cost);
- }
return 0;
}
}
- if (is_debug) {
- prefix2str(&route->prefix, buf, sizeof(buf));
- zlog_debug("Originating summary in area %s for %s cost %u",
- area->name, buf, route->path.cost);
- }
+ if (is_debug)
+ zlog_debug(
+ "Originating summary in area %s for %pFX cost %u",
+ area->name, &route->prefix, route->path.cost);
summary_table = area->summary_prefix;
}
@@ -369,11 +358,10 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
if (range && !CHECK_FLAG(range->flag, OSPF6_ROUTE_REMOVE)
&& (route->path.area_id != OSPF_AREA_BACKBONE
|| !IS_AREA_TRANSIT(area))) {
- if (is_debug) {
- prefix2str(&range->prefix, buf, sizeof(buf));
- zlog_debug("Suppressed by range %s of area %s",
- buf, route_area->name);
- }
+ if (is_debug)
+ zlog_debug(
+ "Suppressed by range %pFX of area %s",
+ &range->prefix, route_area->name);
ospf6_abr_delete_route(route, summary, summary_table,
old);
return 0;
@@ -411,15 +399,11 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
if (EXPORT_LIST(area))
if (access_list_apply(EXPORT_LIST(area), &route->prefix)
== FILTER_DENY) {
- if (is_debug) {
- inet_ntop(AF_INET,
- &(ADV_ROUTER_IN_PREFIX(
- &route->prefix)),
- buf, sizeof(buf));
+ if (is_debug)
zlog_debug(
- "prefix %s was denied by export list",
- buf);
- }
+ "prefix %pFX was denied by export list",
+ &ADV_ROUTER_IN_PREFIX(
+ &route->prefix));
return 0;
}
}
@@ -428,15 +412,10 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
if (PREFIX_LIST_OUT(area))
if (prefix_list_apply(PREFIX_LIST_OUT(area), &route->prefix)
!= PREFIX_PERMIT) {
- if (is_debug) {
- inet_ntop(
- AF_INET,
- &(ADV_ROUTER_IN_PREFIX(&route->prefix)),
- buf, sizeof(buf));
+ if (is_debug)
zlog_debug(
- "prefix %s was denied by filter-list out",
- buf);
- }
+ "prefix %pFX was denied by filter-list out",
+ &ADV_ROUTER_IN_PREFIX(&route->prefix));
return 0;
}
@@ -798,7 +777,6 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa,
struct ospf6_path *o_path;
struct ospf6_nexthop *nh, *rnh;
bool nh_updated = false;
- char buf[PREFIX2STR_BUFFER];
for (ALL_LIST_ELEMENTS(old->paths, anode, anext, o_path)) {
if (o_path->origin.adv_router != lsa->header->adv_router
@@ -820,16 +798,13 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa,
if (nh_updated) {
if (listcount(old->paths)) {
- if (IS_OSPF6_DEBUG_ABR ||
- IS_OSPF6_DEBUG_EXAMIN(INTER_PREFIX)) {
- prefix2str(&old->prefix, buf,
- sizeof(buf));
- zlog_debug("%s: old %s updated nh %u",
- __func__, buf,
+ if (IS_OSPF6_DEBUG_ABR
+ || IS_OSPF6_DEBUG_EXAMIN(INTER_PREFIX))
+ zlog_debug("%s: old %pFX updated nh %u",
+ __func__, &old->prefix,
old->nh_list ? listcount(
old->nh_list)
: 0);
- }
if (table->hook_add)
(*table->hook_add)(old);
@@ -1140,13 +1115,11 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
continue;
if ((ospf6_route_cmp(route, old_route) != 0)) {
- if (is_debug) {
- prefix2str(&prefix, buf, sizeof(buf));
+ if (is_debug)
zlog_debug(
- "%s: old %p %s cost %u new route cost %u are not same",
- __func__, (void *)old_route, buf,
+ "%s: old %p %pFX cost %u new route cost %u are not same",
+ __func__, (void *)old_route, &prefix,
old_route->path.cost, route->path.cost);
- }
/* Check new route's adv. router is same in one of
* the paths with differed cost, if so remove the
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c
index 713ce26ec..866bc7e18 100644
--- a/ospf6d/ospf6_area.c
+++ b/ospf6d/ospf6_area.c
@@ -505,13 +505,12 @@ void ospf6_area_config_write(struct vty *vty)
struct listnode *node;
struct ospf6_area *oa;
struct ospf6_route *range;
- char buf[PREFIX2STR_BUFFER];
for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) {
for (range = ospf6_route_head(oa->range_table); range;
range = ospf6_route_next(range)) {
- prefix2str(&range->prefix, buf, sizeof(buf));
- vty_out(vty, " area %s range %s", oa->name, buf);
+ vty_out(vty, " area %s range %pFX", oa->name,
+ &range->prefix);
if (CHECK_FLAG(range->flag,
OSPF6_ROUTE_DO_NOT_ADVERTISE)) {
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 10a92414b..80a3c1005 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -63,13 +63,11 @@ static void ospf6_as_external_lsa_originate(struct ospf6_route *route)
struct ospf6_external_info *info = route->route_option;
struct ospf6_as_external_lsa *as_external_lsa;
- char buf[PREFIX2STR_BUFFER];
caddr_t p;
- if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE(AS_EXTERNAL)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
- zlog_debug("Originate AS-External-LSA for %s", buf);
- }
+ if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE(AS_EXTERNAL))
+ zlog_debug("Originate AS-External-LSA for %pFX",
+ &route->prefix);
/* prepare buffer */
memset(buffer, 0, sizeof(buffer));
@@ -211,7 +209,6 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
struct listnode *anode, *anext;
struct listnode *nnode, *rnode, *rnext;
struct ospf6_nexthop *nh, *rnh;
- char buf[PREFIX2STR_BUFFER];
bool route_found = false;
/* check for old entry match with new route origin,
@@ -371,11 +368,9 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
listnode_add_sort(old_route->paths, ecmp_path);
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
- prefix2str(&route->prefix, buf,
- sizeof(buf));
zlog_debug(
- "%s: route %s another path added with nh %u, effective paths %u nh %u",
- __func__, buf,
+ "%s: route %pFX another path added with nh %u, effective paths %u nh %u",
+ __func__, &route->prefix,
listcount(ecmp_path->nh_list),
old_route->paths ? listcount(
old_route->paths)
@@ -401,32 +396,27 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
&o_path->ls_prefix,
ospf6->brouter_table);
if (asbr_entry == NULL) {
- if (IS_OSPF6_DEBUG_EXAMIN(
- AS_EXTERNAL)) {
- prefix2str(&old_route->prefix,
- buf, sizeof(buf));
+ if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
zlog_debug(
- "%s: ls_prfix %s asbr_entry not found.",
- __func__, buf);
- }
+ "%s: ls_prfix %pFX asbr_entry not found.",
+ __func__,
+ &old_route->prefix);
continue;
}
ospf6_route_merge_nexthops(old_route,
asbr_entry);
}
- if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
+ if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
zlog_debug(
- "%s: route %s with effective paths %u nh %u",
- __func__, buf,
+ "%s: route %pFX with effective paths %u nh %u",
+ __func__, &route->prefix,
old_route->paths
? listcount(old_route->paths)
: 0,
old_route->nh_list
? listcount(old_route->nh_list)
: 0);
- }
/* Update RIB/FIB */
if (ospf6->route_table->hook_add)
@@ -453,7 +443,6 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
struct prefix asbr_id;
struct ospf6_route *asbr_entry, *route, *old;
struct ospf6_path *path;
- char buf[PREFIX2STR_BUFFER];
external = (struct ospf6_as_external_lsa *)OSPF6_LSA_HEADER_END(
lsa->header);
@@ -484,10 +473,8 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
asbr_entry = ospf6_route_lookup(&asbr_id, ospf6->brouter_table);
if (asbr_entry == NULL
|| !CHECK_FLAG(asbr_entry->path.router_bits, OSPF6_ROUTER_BIT_E)) {
- if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
- prefix2str(&asbr_id, buf, sizeof(buf));
- zlog_debug("ASBR entry not found: %s", buf);
- }
+ if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
+ zlog_debug("ASBR entry not found: %pFX", &asbr_id);
return;
}
@@ -527,15 +514,13 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
listnode_add_sort(route->paths, path);
- if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
- zlog_debug("%s: AS-External %u route add %s cost %u(%u) nh %u",
- __func__,
- (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1
- : 2,
- buf, route->path.cost, route->path.u.cost_e2,
- listcount(route->nh_list));
- }
+ if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
+ zlog_debug(
+ "%s: AS-External %u route add %pFX cost %u(%u) nh %u",
+ __func__,
+ (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1 : 2,
+ &route->prefix, route->path.cost, route->path.u.cost_e2,
+ listcount(route->nh_list));
old = ospf6_route_lookup(&route->prefix, ospf6->route_table);
if (!old) {
@@ -1029,7 +1014,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
struct ospf6_external_info *info;
struct prefix prefix_id;
struct route_node *node;
- char pbuf[PREFIX2STR_BUFFER], ibuf[16];
+ char ibuf[16];
struct listnode *lnode, *lnnode;
struct ospf6_area *oa;
@@ -1039,10 +1024,8 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
memset(&troute, 0, sizeof(troute));
memset(&tinfo, 0, sizeof(tinfo));
- if (IS_OSPF6_DEBUG_ASBR) {
- prefix2str(prefix, pbuf, sizeof(pbuf));
- zlog_debug("Redistribute %s (%s)", pbuf, ZROUTE_NAME(type));
- }
+ if (IS_OSPF6_DEBUG_ASBR)
+ zlog_debug("Redistribute %pFX (%s)", prefix, ZROUTE_NAME(type));
/* if route-map was specified but not found, do not advertise */
if (ospf6->rmap[type].name) {
@@ -1109,10 +1092,9 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
if (IS_OSPF6_DEBUG_ASBR) {
inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf,
sizeof(ibuf));
- prefix2str(prefix, pbuf, sizeof(pbuf));
zlog_debug(
- "Advertise as AS-External Id:%s prefix %s metric %u",
- ibuf, pbuf, match->path.metric_type);
+ "Advertise as AS-External Id:%s prefix %pFX metric %u",
+ ibuf, prefix, match->path.metric_type);
}
match->path.origin.id = htonl(info->id);
@@ -1163,9 +1145,9 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
if (IS_OSPF6_DEBUG_ASBR) {
inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf));
- prefix2str(prefix, pbuf, sizeof(pbuf));
- zlog_debug("Advertise as AS-External Id:%s prefix %s metric %u",
- ibuf, pbuf, route->path.metric_type);
+ zlog_debug(
+ "Advertise as AS-External Id:%s prefix %pFX metric %u",
+ ibuf, prefix, route->path.metric_type);
}
route->path.origin.id = htonl(info->id);
@@ -1184,16 +1166,14 @@ void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex,
struct route_node *node;
struct ospf6_lsa *lsa;
struct prefix prefix_id;
- char pbuf[PREFIX2STR_BUFFER], ibuf[16];
+ char ibuf[16];
struct listnode *lnode, *lnnode;
struct ospf6_area *oa;
match = ospf6_route_lookup(prefix, ospf6->external_table);
if (match == NULL) {
- if (IS_OSPF6_DEBUG_ASBR) {
- prefix2str(prefix, pbuf, sizeof(pbuf));
- zlog_debug("No such route %s to withdraw", pbuf);
- }
+ if (IS_OSPF6_DEBUG_ASBR)
+ zlog_debug("No such route %pFX to withdraw", prefix);
return;
}
@@ -1201,17 +1181,14 @@ void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex,
assert(info);
if (info->type != type) {
- if (IS_OSPF6_DEBUG_ASBR) {
- prefix2str(prefix, pbuf, sizeof(pbuf));
- zlog_debug("Original protocol mismatch: %s", pbuf);
- }
+ if (IS_OSPF6_DEBUG_ASBR)
+ zlog_debug("Original protocol mismatch: %pFX", prefix);
return;
}
if (IS_OSPF6_DEBUG_ASBR) {
- prefix2str(prefix, pbuf, sizeof(pbuf));
inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf));
- zlog_debug("Withdraw %s (AS-External Id:%s)", pbuf, ibuf);
+ zlog_debug("Withdraw %pFX (AS-External Id:%s)", prefix, ibuf);
}
lsa = ospf6_lsdb_lookup(htons(OSPF6_LSTYPE_AS_EXTERNAL),
@@ -1823,10 +1800,9 @@ static void ospf6_asbr_external_route_show(struct vty *vty,
struct ospf6_route *route)
{
struct ospf6_external_info *info = route->route_option;
- char prefix[PREFIX2STR_BUFFER], id[16], forwarding[64];
+ char id[16], forwarding[64];
uint32_t tmp_id;
- prefix2str(&route->prefix, prefix, sizeof(prefix));
tmp_id = ntohl(info->id);
inet_ntop(AF_INET, &tmp_id, id, sizeof(id));
if (!IN6_IS_ADDR_UNSPECIFIED(&info->forwarding))
@@ -1836,8 +1812,8 @@ static void ospf6_asbr_external_route_show(struct vty *vty,
snprintf(forwarding, sizeof(forwarding), ":: (ifindex %d)",
ospf6_route_get_first_nh_index(route));
- vty_out(vty, "%c %-32s %-15s type-%d %5lu %s\n",
- zebra_route_char(info->type), prefix, id,
+ vty_out(vty, "%c %-32pFX %-15s type-%d %5lu %s\n",
+ zebra_route_char(info->type), &route->prefix, id,
route->path.metric_type,
(unsigned long)(route->path.metric_type == 2
? route->path.u.cost_e2
diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c
index 1b58cd14f..4e50ab524 100644
--- a/ospf6d/ospf6_bfd.c
+++ b/ospf6d/ospf6_bfd.c
@@ -204,12 +204,9 @@ static int ospf6_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
if ((ifp == NULL) || (dp.family != AF_INET6))
return 0;
- if (IS_OSPF6_DEBUG_ZEBRA(RECV)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&dp, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s bfd destination %s %s",
- ifp->name, buf, bfd_get_status_str(status));
- }
+ if (IS_OSPF6_DEBUG_ZEBRA(RECV))
+ zlog_debug("Zebra: interface %s bfd destination %pFX %s",
+ ifp->name, &dp, bfd_get_status_str(status));
oi = (struct ospf6_interface *)ifp->info;
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 72e40676a..a72415773 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -436,16 +436,14 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
if (oi->plist_name) {
struct prefix_list *plist;
enum prefix_list_type ret;
- char buf[PREFIX2STR_BUFFER];
- prefix2str(c->address, buf, sizeof(buf));
plist = prefix_list_lookup(AFI_IP6, oi->plist_name);
ret = prefix_list_apply(plist, (void *)c->address);
if (ret == PREFIX_DENY) {
if (IS_OSPF6_DEBUG_INTERFACE)
zlog_debug(
- "%s on %s filtered by prefix-list %s ",
- buf, oi->interface->name,
+ "%pFX on %s filtered by prefix-list %s ",
+ c->address, oi->interface->name,
oi->plist_name);
continue;
}
@@ -929,16 +927,15 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
for (ALL_LIST_ELEMENTS_RO(ifp->connected, i, c)) {
p = c->address;
- prefix2str(p, strbuf, sizeof(strbuf));
switch (p->family) {
case AF_INET:
- vty_out(vty, " inet : %s\n", strbuf);
+ vty_out(vty, " inet : %pFX\n", p);
break;
case AF_INET6:
- vty_out(vty, " inet6: %s\n", strbuf);
+ vty_out(vty, " inet6: %pFX\n", p);
break;
default:
- vty_out(vty, " ??? : %s\n", strbuf);
+ vty_out(vty, " ??? : %pFX\n", p);
break;
}
}
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index 6eda9f750..733b9cffb 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -907,7 +907,6 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
struct listnode *i, *j;
int full_count = 0;
unsigned short prefix_num = 0;
- char buf[PREFIX2STR_BUFFER];
struct ospf6_route_table *route_advertise;
int ls_id = 0;
@@ -985,10 +984,8 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
/* connected prefix to advertise */
for (route = ospf6_route_head(oi->route_connected); route;
route = ospf6_route_best_next(route)) {
- if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
- zlog_debug(" include %s", buf);
- }
+ if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
+ zlog_debug(" include %pFX", &route->prefix);
ospf6_route_add(ospf6_route_copy(route),
route_advertise);
}
@@ -1144,7 +1141,6 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
struct ospf6_link_lsa *link_lsa;
char *start, *end, *current;
uint16_t type;
- char buf[PREFIX2STR_BUFFER];
oi = (struct ospf6_interface *)THREAD_ARG(thread);
oi->thread_intra_prefix_lsa = NULL;
@@ -1255,10 +1251,8 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
route->path.area_id = oi->area->area_id;
route->path.type = OSPF6_PATH_TYPE_INTRA;
- if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
- zlog_debug(" include %s", buf);
- }
+ if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
+ zlog_debug(" include %pFX", &route->prefix);
ospf6_route_add(route, route_advertise);
prefix_num--;
@@ -1554,11 +1548,9 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
ospf6_linkstate_prefix(
o_path->origin.adv_router,
o_path->origin.id, &adv_prefix);
- prefix2str(&adv_prefix, buf,
- sizeof(buf));
zlog_debug(
- "%s: adv_router %s lsa not found",
- __func__, buf);
+ "%s: adv_router %pFX lsa not found",
+ __func__, &adv_prefix);
}
continue;
}
@@ -1582,16 +1574,15 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
}
}
- if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
+ if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX))
zlog_debug(
- "%s: route %s %p with final effective paths %u nh%u",
- __func__, buf, (void *)old_route,
+ "%s: route %pFX %p with final effective paths %u nh%u",
+ __func__, &route->prefix,
+ (void *)old_route,
old_route->paths
? listcount(old_route->paths)
: 0,
listcount(old_route->nh_list));
- }
/* used in intra_route_calculation() to add to
* global ospf6 route table.
diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h
index cd873e2f0..f8f0780ba 100644
--- a/ospf6d/ospf6_lsa.h
+++ b/ospf6d/ospf6_lsa.h
@@ -156,46 +156,36 @@ extern vector ospf6_lsa_handler_vector;
/* addr is (struct prefix *) */
#define CONTINUE_IF_ADDRESS_LINKLOCAL(debug, addr) \
if (IN6_IS_ADDR_LINKLOCAL(&(addr)->u.prefix6)) { \
- char buf[PREFIX2STR_BUFFER]; \
- prefix2str(addr, buf, sizeof(buf)); \
if (debug) \
- zlog_debug("Filter out Linklocal: %s", buf); \
+ zlog_debug("Filter out Linklocal: %pFX", addr); \
continue; \
}
#define CONTINUE_IF_ADDRESS_UNSPECIFIED(debug, addr) \
if (IN6_IS_ADDR_UNSPECIFIED(&(addr)->u.prefix6)) { \
- char buf[PREFIX2STR_BUFFER]; \
- prefix2str(addr, buf, sizeof(buf)); \
if (debug) \
- zlog_debug("Filter out Unspecified: %s", buf); \
+ zlog_debug("Filter out Unspecified: %pFX", addr); \
continue; \
}
#define CONTINUE_IF_ADDRESS_LOOPBACK(debug, addr) \
if (IN6_IS_ADDR_LOOPBACK(&(addr)->u.prefix6)) { \
- char buf[PREFIX2STR_BUFFER]; \
- prefix2str(addr, buf, sizeof(buf)); \
if (debug) \
- zlog_debug("Filter out Loopback: %s", buf); \
+ zlog_debug("Filter out Loopback: %pFX", addr); \
continue; \
}
#define CONTINUE_IF_ADDRESS_V4COMPAT(debug, addr) \
if (IN6_IS_ADDR_V4COMPAT(&(addr)->u.prefix6)) { \
- char buf[PREFIX2STR_BUFFER]; \
- prefix2str(addr, buf, sizeof(buf)); \
if (debug) \
- zlog_debug("Filter out V4Compat: %s", buf); \
+ zlog_debug("Filter out V4Compat: %pFX", addr); \
continue; \
}
#define CONTINUE_IF_ADDRESS_V4MAPPED(debug, addr) \
if (IN6_IS_ADDR_V4MAPPED(&(addr)->u.prefix6)) { \
- char buf[PREFIX2STR_BUFFER]; \
- prefix2str(addr, buf, sizeof(buf)); \
if (debug) \
- zlog_debug("Filter out V4Mapped: %s", buf); \
+ zlog_debug("Filter out V4Mapped: %pFX", addr); \
continue; \
}
diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c
index db6f9a780..0892863cf 100644
--- a/ospf6d/ospf6_lsdb.c
+++ b/ospf6d/ospf6_lsdb.c
@@ -207,11 +207,7 @@ struct ospf6_lsa *ospf6_lsdb_lookup_next(uint16_t type, uint32_t id,
ospf6_lsdb_set_key(&key, &adv_router, sizeof(adv_router));
ospf6_lsdb_set_key(&key, &id, sizeof(id));
- {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&key, buf, sizeof(buf));
- zlog_debug("lsdb_lookup_next: key: %s", buf);
- }
+ zlog_debug("lsdb_lookup_next: key: %pFX", &key);
node = route_table_get_next(lsdb->table, &key);
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 4044cdc54..1cd6b8cff 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -550,7 +550,6 @@ ospf6_route_lookup_bestmatch(struct prefix *prefix,
static void route_table_assert(struct ospf6_route_table *table)
{
struct ospf6_route *prev, *r, *next;
- char buf[PREFIX2STR_BUFFER];
unsigned int link_error = 0, num = 0;
r = ospf6_route_head(table);
@@ -579,10 +578,9 @@ static void route_table_assert(struct ospf6_route_table *table)
"Something has gone wrong with ospf6_route_table[%p]", table);
zlog_debug("table count = %d, real number = %d", table->count, num);
zlog_debug("DUMP START");
- for (r = ospf6_route_head(table); r; r = ospf6_route_next(r)) {
- prefix2str(&r->prefix, buf, sizeof(buf));
- zlog_info("%p<-[%p]->%p : %s", r->prev, r, r->next, buf);
- }
+ for (r = ospf6_route_head(table); r; r = ospf6_route_next(r))
+ zlog_info("%p<-[%p]->%p : %pFX", r->prev, r, r->next,
+ &r->prefix);
zlog_debug("DUMP END");
assert(link_error == 0 && num == table->count);
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index bb6a05097..d3a330c3c 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -320,7 +320,6 @@ static int ospf6_spf_install(struct ospf6_vertex *v,
{
struct ospf6_route *route, *parent_route;
struct ospf6_vertex *prev;
- char pbuf[PREFIX2STR_BUFFER];
if (IS_OSPF6_DEBUG_SPF(PROCESS))
zlog_debug("SPF install %s (lsa %s) hops %d cost %d", v->name,
@@ -335,12 +334,10 @@ static int ospf6_spf_install(struct ospf6_vertex *v,
ospf6_vertex_delete(v);
return -1;
} else if (route && route->path.cost == v->cost) {
- if (IS_OSPF6_DEBUG_SPF(PROCESS)) {
- prefix2str(&route->prefix, pbuf, sizeof(pbuf));
+ if (IS_OSPF6_DEBUG_SPF(PROCESS))
zlog_debug(
- " another path found to route %s lsa %s, merge",
- pbuf, v->lsa->name);
- }
+ " another path found to route %pFX lsa %s, merge",
+ &route->prefix, v->lsa->name);
ospf6_spf_merge_nexthops_to_route(route, v);
prev = (struct ospf6_vertex *)route->route_option;
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 49b7e4f14..1f906cadd 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -1059,15 +1059,11 @@ static int ospf6_distance_config_write(struct vty *vty)
}
for (rn = route_top(ospf6->distance_table); rn; rn = route_next(rn))
- if ((odistance = rn->info) != NULL) {
- char buf[PREFIX_STRLEN];
-
- vty_out(vty, " distance %u %s %s\n",
- odistance->distance,
- prefix2str(&rn->p, buf, sizeof(buf)),
+ if ((odistance = rn->info) != NULL)
+ vty_out(vty, " distance %u %pFX %s\n",
+ odistance->distance, &rn->p,
odistance->access_list ? odistance->access_list
: "");
- }
return 0;
}
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index d37235d19..c5c8ca27b 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -163,19 +163,13 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS)
ifindex = api.nexthops[0].ifindex;
nexthop = &api.nexthops[0].gate.ipv6;
- if (IS_OSPF6_DEBUG_ZEBRA(RECV)) {
- char prefixstr[PREFIX2STR_BUFFER], nexthopstr[128];
-
- prefix2str(&api.prefix, prefixstr, sizeof(prefixstr));
- inet_ntop(AF_INET6, nexthop, nexthopstr, sizeof(nexthopstr));
-
+ if (IS_OSPF6_DEBUG_ZEBRA(RECV))
zlog_debug(
- "Zebra Receive route %s: %s %s nexthop %s ifindex %ld tag %" ROUTE_TAG_PRI,
+ "Zebra Receive route %s: %s %pFX nexthop %pI6 ifindex %ld tag %" ROUTE_TAG_PRI,
(cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD ? "add"
: "delete"),
- zebra_route_string(api.type), prefixstr, nexthopstr,
+ zebra_route_string(api.type), &api.prefix, nexthop,
ifindex, api.tag);
- }
if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD)
ospf6_asbr_redistribute_add(api.type, ifindex, &api.prefix,
@@ -219,16 +213,13 @@ DEFUN (show_zebra,
static void ospf6_zebra_route_update(int type, struct ospf6_route *request)
{
struct zapi_route api;
- char buf[PREFIX2STR_BUFFER];
int nhcount;
int ret = 0;
struct prefix *dest;
- if (IS_OSPF6_DEBUG_ZEBRA(SEND)) {
- prefix2str(&request->prefix, buf, sizeof(buf));
- zlog_debug("Send %s route: %s",
- (type == REM ? "remove" : "add"), buf);
- }
+ if (IS_OSPF6_DEBUG_ZEBRA(SEND))
+ zlog_debug("Send %s route: %pFX",
+ (type == REM ? "remove" : "add"), &request->prefix);
if (zclient->sock < 0) {
if (IS_OSPF6_DEBUG_ZEBRA(SEND))
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index 781102beb..28afee31a 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -740,13 +740,9 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost,
lsa = ospf_lsa_refresh(area->ospf, old);
if (!lsa) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str((struct prefix *)p, buf,
- sizeof(buf));
flog_warn(EC_OSPF_LSA_MISSING,
- "%s: Could not refresh %s to %s",
- __func__, buf,
+ "%s: Could not refresh %pFX to %s",
+ __func__, (struct prefix *)p,
inet_ntoa(area->area_id));
return;
}
@@ -762,12 +758,10 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost,
/* This will flood through area. */
if (!lsa) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str((struct prefix *)p, buf, sizeof(buf));
flog_warn(EC_OSPF_LSA_MISSING,
- "%s: Could not originate %s to %s", __func__,
- buf, inet_ntoa(area->area_id));
+ "%s: Could not originate %pFX to %s",
+ __func__, (struct prefix *)p,
+ inet_ntoa(area->area_id));
return;
}
@@ -1118,12 +1112,10 @@ static void ospf_abr_announce_rtr_to_area(struct prefix_ipv4 *p, uint32_t cost,
} else
lsa = ospf_summary_asbr_lsa_originate(p, cost, area);
if (!lsa) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str((struct prefix *)p, buf, sizeof(buf));
flog_warn(EC_OSPF_LSA_MISSING,
- "%s: Could not refresh/originate %s to %s",
- __func__, buf, inet_ntoa(area->area_id));
+ "%s: Could not refresh/originate %pFX to %s",
+ __func__, (struct prefix *)p,
+ inet_ntoa(area->area_id));
return;
}
diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c
index d2c5090f2..46ad94c3d 100644
--- a/ospfd/ospf_bfd.c
+++ b/ospfd/ospf_bfd.c
@@ -217,12 +217,9 @@ static int ospf_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
if ((ifp == NULL) || (p.family != AF_INET))
return 0;
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&p, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s bfd destination %s %s",
- ifp->name, buf, bfd_get_status_str(status));
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: interface %s bfd destination %pFX %s",
+ ifp->name, &p, bfd_get_status_str(status));
params = IF_DEF_PARAMS(ifp);
if (!params->bfd_info)
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index dc8a8dccd..5aacbc906 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -73,12 +73,9 @@ static int ospf_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
struct prefix router_id;
zebra_router_id_update_read(zclient->ibuf, &router_id);
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&router_id, buf, sizeof(buf));
- zlog_debug("Zebra rcvd: router id update %s vrf %s id %u", buf,
- ospf_vrf_id_to_name(vrf_id), vrf_id);
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra rcvd: router id update %pFX vrf %s id %u",
+ &router_id, ospf_vrf_id_to_name(vrf_id), vrf_id);
ospf = ospf_lookup_by_vrf_id(vrf_id);
@@ -86,15 +83,11 @@ static int ospf_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
ospf->router_id_zebra = router_id.u.prefix4;
ospf_router_id_update(ospf);
} else {
- if (IS_DEBUG_OSPF_EVENT) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&router_id, buf, sizeof(buf));
+ if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "%s: ospf instance not found for vrf %s id %u router_id %s",
+ "%s: ospf instance not found for vrf %s id %u router_id %pFX",
__func__, ospf_vrf_id_to_name(vrf_id), vrf_id,
- buf);
- }
+ &router_id);
}
return 0;
}
@@ -110,13 +103,10 @@ static int ospf_interface_address_add(ZAPI_CALLBACK_ARGS)
if (c == NULL)
return 0;
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(c->address, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s address add %s vrf %s id %u",
- c->ifp->name, buf, ospf_vrf_id_to_name(vrf_id),
- vrf_id);
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: interface %s address add %pFX vrf %s id %u",
+ c->ifp->name, c->address,
+ ospf_vrf_id_to_name(vrf_id), vrf_id);
ospf = ospf_lookup_by_vrf_id(vrf_id);
if (!ospf)
@@ -142,12 +132,9 @@ static int ospf_interface_address_delete(ZAPI_CALLBACK_ARGS)
if (c == NULL)
return 0;
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(c->address, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s address delete %s",
- c->ifp->name, buf);
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: interface %s address delete %pFX",
+ c->ifp->name, c->address);
ifp = c->ifp;
p = *c->address;
@@ -279,17 +266,14 @@ void ospf_zebra_add(struct ospf *ospf, struct prefix_ipv4 *p,
count++;
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[2][PREFIX2STR_BUFFER];
struct interface *ifp;
ifp = if_lookup_by_index(path->ifindex, ospf->vrf_id);
zlog_debug(
- "Zebra: Route add %s nexthop %s, ifindex=%d %s",
- prefix2str(p, buf[0], sizeof(buf[0])),
- inet_ntop(AF_INET, &path->nexthop,
- buf[1], sizeof(buf[1])),
- path->ifindex, ifp ? ifp->name : " ");
+ "Zebra: Route add %pFX nexthop %pI4, ifindex=%d %s",
+ p, &path->nexthop, path->ifindex,
+ ifp ? ifp->name : " ");
}
}
api.nexthop_num = count;
@@ -309,11 +293,8 @@ void ospf_zebra_delete(struct ospf *ospf, struct prefix_ipv4 *p,
api.safi = SAFI_UNICAST;
memcpy(&api.prefix, p, sizeof(*p));
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX2STR_BUFFER];
- zlog_debug("Zebra: Route delete %s",
- prefix2str(p, buf, sizeof(buf)));
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
+ zlog_debug("Zebra: Route delete %pFX", p);
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
}
@@ -332,11 +313,8 @@ void ospf_zebra_add_discard(struct ospf *ospf, struct prefix_ipv4 *p)
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX2STR_BUFFER];
- zlog_debug("Zebra: Route add discard %s",
- prefix2str(p, buf, sizeof(buf)));
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
+ zlog_debug("Zebra: Route add discard %pFX", p);
}
void ospf_zebra_delete_discard(struct ospf *ospf, struct prefix_ipv4 *p)
@@ -353,11 +331,8 @@ void ospf_zebra_delete_discard(struct ospf *ospf, struct prefix_ipv4 *p)
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX2STR_BUFFER];
- zlog_debug("Zebra: Route delete discard %s",
- prefix2str(p, buf, sizeof(buf)));
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
+ zlog_debug("Zebra: Route delete discard %pFX", p);
}
struct ospf_external *ospf_external_lookup(struct ospf *ospf, uint8_t type,
@@ -1061,13 +1036,10 @@ int ospf_redistribute_check(struct ospf *ospf, struct external_info *ei,
if (DISTRIBUTE_LIST(ospf, type))
if (access_list_apply(DISTRIBUTE_LIST(ospf, type), p)
== FILTER_DENY) {
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX2STR_BUFFER];
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
zlog_debug(
- "Redistribute[%s]: %s filtered by distribute-list.",
- ospf_redist_string(type),
- prefix2str(p, buf, sizeof(buf)));
- }
+ "Redistribute[%s]: %pFX filtered by distribute-list.",
+ ospf_redist_string(type), p);
return 0;
}
@@ -1088,13 +1060,10 @@ int ospf_redistribute_check(struct ospf *ospf, struct external_info *ei,
if (ret == RMAP_DENYMATCH) {
ei->route_map_set = save_values;
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX2STR_BUFFER];
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
zlog_debug(
- "Redistribute[%s]: %s filtered by route-map.",
- ospf_redist_string(type),
- prefix2str(p, buf, sizeof(buf)));
- }
+ "Redistribute[%s]: %pFX filtered by route-map.",
+ ospf_redist_string(type), p);
return 0;
}
@@ -1171,14 +1140,10 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
if (is_prefix_default(&p))
rt_type = DEFAULT_ROUTE;
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf_prefix[PREFIX_STRLEN];
- prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
-
- zlog_debug("%s: cmd %s from client %s: vrf_id %d, p %s",
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
+ zlog_debug("%s: cmd %s from client %s: vrf_id %d, p %pFX",
__func__, zserv_command_string(cmd),
- zebra_route_string(api.type), vrf_id, buf_prefix);
- }
+ zebra_route_string(api.type), vrf_id, &api.prefix);
if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) {
/* XXX|HACK|TODO|FIXME:
diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c
index 3fb375904..ce7780ed4 100644
--- a/pbrd/pbr_nht.c
+++ b/pbrd/pbr_nht.c
@@ -827,16 +827,14 @@ static void pbr_nht_individual_nexthop_update_lookup(struct hash_bucket *b,
{
struct pbr_nexthop_cache *pnhc = b->data;
struct pbr_nht_individual *pnhi = data;
- char buf[PREFIX_STRLEN];
bool old_valid;
old_valid = pnhc->valid;
pbr_nht_individual_nexthop_update(pnhc, pnhi);
- DEBUGD(&pbr_dbg_nht, "\tFound %s: old: %d new: %d",
- prefix2str(&pnhi->nhr->prefix, buf, sizeof(buf)), old_valid,
- pnhc->valid);
+ DEBUGD(&pbr_dbg_nht, "\tFound %pFX: old: %d new: %d",
+ &pnhi->nhr->prefix, old_valid, pnhc->valid);
if (pnhc->valid)
pnhi->valid = true;
diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c
index c423668eb..eb51516c2 100644
--- a/pbrd/pbr_vty.c
+++ b/pbrd/pbr_vty.c
@@ -648,7 +648,6 @@ pbrms_nexthop_group_write_individual_nexthop(
static void vty_show_pbrms(struct vty *vty,
const struct pbr_map_sequence *pbrms, bool detail)
{
- char buf[PREFIX_STRLEN];
char rbuf[64];
if (pbrms->reason)
@@ -666,11 +665,9 @@ static void vty_show_pbrms(struct vty *vty,
pbrms->reason ? rbuf : "Valid");
if (pbrms->src)
- vty_out(vty, " SRC Match: %s\n",
- prefix2str(pbrms->src, buf, sizeof(buf)));
+ vty_out(vty, " SRC Match: %pFX\n", pbrms->src);
if (pbrms->dst)
- vty_out(vty, " DST Match: %s\n",
- prefix2str(pbrms->dst, buf, sizeof(buf)));
+ vty_out(vty, " DST Match: %pFX\n", pbrms->dst);
if (pbrms->dsfield & PBR_DSFIELD_DSCP)
vty_out(vty, " DSCP Match: %u\n",
(pbrms->dsfield & PBR_DSFIELD_DSCP) >> 2);
@@ -1058,17 +1055,13 @@ static int pbr_vty_map_config_write_sequence(struct vty *vty,
struct pbr_map *pbrm,
struct pbr_map_sequence *pbrms)
{
- char buff[PREFIX_STRLEN];
-
vty_out(vty, "pbr-map %s seq %u\n", pbrm->name, pbrms->seqno);
if (pbrms->src)
- vty_out(vty, " match src-ip %s\n",
- prefix2str(pbrms->src, buff, sizeof(buff)));
+ vty_out(vty, " match src-ip %pFX\n", pbrms->src);
if (pbrms->dst)
- vty_out(vty, " match dst-ip %s\n",
- prefix2str(pbrms->dst, buff, sizeof(buff)));
+ vty_out(vty, " match dst-ip %pFX\n", pbrms->dst);
if (pbrms->dsfield & PBR_DSFIELD_DSCP)
vty_out(vty, " match dscp %u\n",
diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c
index 866f27136..b8ee97463 100644
--- a/pbrd/pbr_zebra.c
+++ b/pbrd/pbr_zebra.c
@@ -102,15 +102,14 @@ static int interface_address_add(ZAPI_CALLBACK_ARGS)
static int interface_address_delete(ZAPI_CALLBACK_ARGS)
{
struct connected *c;
- char buf[PREFIX_STRLEN];
c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (!c)
return 0;
- DEBUGD(&pbr_dbg_zebra, "%s: %s deleted %s", __func__, c->ifp->name,
- prefix2str(c->address, buf, sizeof(buf)));
+ DEBUGD(&pbr_dbg_zebra, "%s: %s deleted %pFX", __func__, c->ifp->name,
+ c->address);
connected_free(&c);
return 0;
@@ -162,40 +161,37 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS)
struct prefix p;
enum zapi_route_notify_owner note;
uint32_t table_id;
- char buf[PREFIX_STRLEN];
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, &note))
return -1;
- prefix2str(&p, buf, sizeof(buf));
-
switch (note) {
case ZAPI_ROUTE_FAIL_INSTALL:
DEBUGD(&pbr_dbg_zebra,
- "%s: [%s] Route install failure for table: %u", __func__,
- buf, table_id);
+ "%s: [%pFX] Route install failure for table: %u",
+ __func__, &p, table_id);
break;
case ZAPI_ROUTE_BETTER_ADMIN_WON:
DEBUGD(&pbr_dbg_zebra,
- "%s: [%s] Route better admin distance won for table: %u",
- __func__, buf, table_id);
+ "%s: [%pFX] Route better admin distance won for table: %u",
+ __func__, &p, table_id);
break;
case ZAPI_ROUTE_INSTALLED:
DEBUGD(&pbr_dbg_zebra,
- "%s: [%s] Route installed succeeded for table: %u",
- __func__, buf, table_id);
+ "%s: [%pFX] Route installed succeeded for table: %u",
+ __func__, &p, table_id);
pbr_nht_route_installed_for_table(table_id);
break;
case ZAPI_ROUTE_REMOVED:
DEBUGD(&pbr_dbg_zebra,
- "%s: [%s] Route Removed succeeded for table: %u",
- __func__, buf, table_id);
+ "%s: [%pFX] Route Removed succeeded for table: %u",
+ __func__, &p, table_id);
pbr_nht_route_removed_for_table(table_id);
break;
case ZAPI_ROUTE_REMOVE_FAIL:
DEBUGD(&pbr_dbg_zebra,
- "%s: [%s] Route remove fail for table: %u", __func__,
- buf, table_id);
+ "%s: [%pFX] Route remove fail for table: %u", __func__,
+ &p, table_id);
break;
}
@@ -259,14 +255,12 @@ static void route_add_helper(struct zapi_route *api, struct nexthop_group nhg,
uint8_t install_afi)
{
struct zapi_nexthop *api_nh;
- char buf[PREFIX_STRLEN];
struct nexthop *nhop;
int i;
api->prefix.family = install_afi;
- DEBUGD(&pbr_dbg_zebra, "\tEncoding %s",
- prefix2str(&api->prefix, buf, sizeof(buf)));
+ DEBUGD(&pbr_dbg_zebra, "\tEncoding %pFX", &api->prefix);
i = 0;
for (ALL_NEXTHOPS(nhg, nhop)) {
@@ -397,7 +391,6 @@ void route_delete(struct pbr_nexthop_group_cache *pnhgc, afi_t afi)
static int pbr_zebra_nexthop_update(ZAPI_CALLBACK_ARGS)
{
struct zapi_route nhr;
- char buf[PREFIX2STR_BUFFER];
uint32_t i;
if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) {
@@ -407,8 +400,8 @@ static int pbr_zebra_nexthop_update(ZAPI_CALLBACK_ARGS)
if (DEBUG_MODE_CHECK(&pbr_dbg_zebra, DEBUG_MODE_ALL)) {
- DEBUGD(&pbr_dbg_zebra, "%s: Received Nexthop update: %s",
- __func__, prefix2str(&nhr.prefix, buf, sizeof(buf)));
+ DEBUGD(&pbr_dbg_zebra, "%s: Received Nexthop update: %pFX",
+ __func__, &nhr.prefix);
DEBUGD(&pbr_dbg_zebra, "%s: (\tNexthops(%u)", __func__,
nhr.nexthop_num);
diff --git a/pimd/pim_bfd.c b/pimd/pim_bfd.c
index 146b53fa8..1d653cdc3 100644
--- a/pimd/pim_bfd.c
+++ b/pimd/pim_bfd.c
@@ -244,12 +244,9 @@ static int pim_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
return 0;
}
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&p, buf, sizeof(buf));
- zlog_debug("%s: interface %s bfd destination %s %s", __func__,
- ifp->name, buf, bfd_get_status_str(status));
- }
+ if (PIM_DEBUG_PIM_TRACE)
+ zlog_debug("%s: interface %s bfd destination %pFX %s", __func__,
+ ifp->name, &p, bfd_get_status_str(status));
for (ALL_LIST_ELEMENTS(pim_ifp->pim_neighbor_list, neigh_node,
neigh_nextnode, neigh)) {
diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c
index f542b2eaf..52dd60aa1 100644
--- a/pimd/pim_bsm.c
+++ b/pimd/pim_bsm.c
@@ -170,7 +170,6 @@ static int pim_on_bs_timer(struct thread *t)
struct bsgrp_node *bsgrp_node;
struct bsm_rpinfo *bsrp;
struct prefix nht_p;
- char buf[PREFIX2STR_BUFFER];
bool is_bsr_tracking = true;
scope = THREAD_ARG(t);
@@ -184,11 +183,9 @@ static int pim_on_bs_timer(struct thread *t)
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = scope->current_bsr;
- if (PIM_DEBUG_BSM) {
- prefix2str(&nht_p, buf, sizeof(buf));
- zlog_debug("%s: Deregister BSR addr %s with Zebra NHT",
- __func__, buf);
- }
+ if (PIM_DEBUG_BSM)
+ zlog_debug("%s: Deregister BSR addr %pFX with Zebra NHT",
+ __func__, &nht_p);
pim_delete_tracked_nexthop(scope->pim, &nht_p, NULL, NULL,
is_bsr_tracking);
@@ -377,15 +374,12 @@ static void pim_g2rp_timer_start(struct bsm_rpinfo *bsrp, int hold_time)
return;
}
THREAD_OFF(bsrp->g2rp_timer);
- if (PIM_DEBUG_BSM) {
- char buf[48];
-
+ if (PIM_DEBUG_BSM)
zlog_debug(
- "%s : starting g2rp timer for grp: %s - rp: %s with timeout %d secs(Actual Hold time : %d secs)",
- __func__, prefix2str(&bsrp->bsgrp_node->group, buf, 48),
+ "%s : starting g2rp timer for grp: %pFX - rp: %s with timeout %d secs(Actual Hold time : %d secs)",
+ __func__, &bsrp->bsgrp_node->group,
inet_ntoa(bsrp->rp_address), hold_time,
bsrp->rp_holdtime);
- }
thread_add_timer(router->master, pim_on_g2rp_timer, bsrp, hold_time,
&bsrp->g2rp_timer);
@@ -402,14 +396,10 @@ static void pim_g2rp_timer_stop(struct bsm_rpinfo *bsrp)
if (!bsrp)
return;
- if (PIM_DEBUG_BSM) {
- char buf[48];
-
- zlog_debug("%s : stopping g2rp timer for grp: %s - rp: %s",
- __func__,
- prefix2str(&bsrp->bsgrp_node->group, buf, 48),
+ if (PIM_DEBUG_BSM)
+ zlog_debug("%s : stopping g2rp timer for grp: %pFX - rp: %s",
+ __func__, &bsrp->bsgrp_node->group,
inet_ntoa(bsrp->rp_address));
- }
THREAD_OFF(bsrp->g2rp_timer);
}
@@ -616,7 +606,6 @@ static void pim_bsm_update(struct pim_instance *pim, struct in_addr bsr,
if (bsr.s_addr != pim->global_scope.current_bsr.s_addr) {
struct prefix nht_p;
- char buf[PREFIX2STR_BUFFER];
bool is_bsr_tracking = true;
/* De-register old BSR and register new BSR with Zebra NHT */
@@ -625,23 +614,19 @@ static void pim_bsm_update(struct pim_instance *pim, struct in_addr bsr,
if (pim->global_scope.current_bsr.s_addr != INADDR_ANY) {
nht_p.u.prefix4 = pim->global_scope.current_bsr;
- if (PIM_DEBUG_BSM) {
- prefix2str(&nht_p, buf, sizeof(buf));
+ if (PIM_DEBUG_BSM)
zlog_debug(
- "%s: Deregister BSR addr %s with Zebra NHT",
- __func__, buf);
- }
+ "%s: Deregister BSR addr %pFX with Zebra NHT",
+ __func__, &nht_p);
pim_delete_tracked_nexthop(pim, &nht_p, NULL, NULL,
is_bsr_tracking);
}
nht_p.u.prefix4 = bsr;
- if (PIM_DEBUG_BSM) {
- prefix2str(&nht_p, buf, sizeof(buf));
+ if (PIM_DEBUG_BSM)
zlog_debug(
- "%s: NHT Register BSR addr %s with Zebra NHT",
- __func__, buf);
- }
+ "%s: NHT Register BSR addr %pFX with Zebra NHT",
+ __func__, &nht_p);
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
pim_find_or_track_nexthop(pim, &nht_p, NULL, NULL,
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 38123cc8f..103237b0f 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -1164,16 +1164,13 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
inet_ntoa(pim_ifp->update_source));
}
if (pim_ifp->sec_addr_list) {
- char pbuf[PREFIX2STR_BUFFER];
vty_out(vty, "Address : %s (primary)\n",
inet_ntoa(ifaddr));
for (ALL_LIST_ELEMENTS_RO(
pim_ifp->sec_addr_list, sec_node,
- sec_addr)) {
- vty_out(vty, " %s\n",
- prefix2str(&sec_addr->addr,
- pbuf, sizeof(pbuf)));
- }
+ sec_addr))
+ vty_out(vty, " %pFX\n",
+ &sec_addr->addr);
} else {
vty_out(vty, "Address : %s\n",
inet_ntoa(ifaddr));
@@ -2331,16 +2328,10 @@ static void pim_show_neighbors_secondary(struct pim_instance *pim,
neigh_src_str, sizeof(neigh_src_str));
for (ALL_LIST_ELEMENTS_RO(neigh->prefix_list,
- prefix_node, p)) {
- char neigh_sec_str[PREFIX2STR_BUFFER];
-
- prefix2str(p, neigh_sec_str,
- sizeof(neigh_sec_str));
-
- vty_out(vty, "%-16s %-15s %-15s %-15s\n",
+ prefix_node, p))
+ vty_out(vty, "%-16s %-15s %-15s %-15pFX\n",
ifp->name, inet_ntoa(ifaddr),
- neigh_src_str, neigh_sec_str);
- }
+ neigh_src_str, p);
}
}
}
@@ -3215,7 +3206,7 @@ static void pim_show_group_rp_mappings_info(struct pim_instance *pim,
json_group);
}
} else {
- vty_out(vty, "Group Address %s\n", grp_str);
+ vty_out(vty, "Group Address %pFX\n", &bsgrp->group);
vty_out(vty, "--------------------------\n");
vty_out(vty, "%-15s %-15s %-15s %-15s\n", "Rp Address",
"priority", "Holdtime", "Hash");
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 0caa360df..cff237f96 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -518,15 +518,12 @@ void pim_if_addr_add(struct connected *ifc)
if (!if_is_operative(ifp))
return;
- if (PIM_DEBUG_ZEBRA) {
- char buf[BUFSIZ];
- prefix2str(ifc->address, buf, BUFSIZ);
- zlog_debug("%s: %s ifindex=%d connected IP address %s %s",
- __func__, ifp->name, ifp->ifindex, buf,
+ if (PIM_DEBUG_ZEBRA)
+ zlog_debug("%s: %s ifindex=%d connected IP address %pFX %s",
+ __func__, ifp->name, ifp->ifindex, ifc->address,
CHECK_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY)
? "secondary"
: "primary");
- }
ifaddr = ifc->address->u.prefix4;
@@ -715,15 +712,12 @@ void pim_if_addr_del(struct connected *ifc, int force_prim_as_any)
ifp = ifc->ifp;
zassert(ifp);
- if (PIM_DEBUG_ZEBRA) {
- char buf[BUFSIZ];
- prefix2str(ifc->address, buf, BUFSIZ);
- zlog_debug("%s: %s ifindex=%d disconnected IP address %s %s",
- __func__, ifp->name, ifp->ifindex, buf,
+ if (PIM_DEBUG_ZEBRA)
+ zlog_debug("%s: %s ifindex=%d disconnected IP address %pFX %s",
+ __func__, ifp->name, ifp->ifindex, ifc->address,
CHECK_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY)
? "secondary"
: "primary");
- }
detect_address_change(ifp, force_prim_as_any, __func__);
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c
index f06d4ae60..7fc7dafed 100644
--- a/pimd/pim_nht.c
+++ b/pimd/pim_nht.c
@@ -26,6 +26,8 @@
#include "hash.h"
#include "jhash.h"
+#include "lib/printfrr.h"
+
#include "pimd.h"
#include "pimd/pim_nht.h"
#include "log.h"
@@ -56,15 +58,12 @@ void pim_sendmsg_zebra_rnh(struct pim_instance *pim, struct zclient *zclient,
if (ret < 0)
zlog_warn("sendmsg_nexthop: zclient_send_message() failed");
- if (PIM_DEBUG_PIM_NHT) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(p, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: NHT %sregistered addr %s(%s) with Zebra ret:%d ",
+ "%s: NHT %sregistered addr %pFX(%s) with Zebra ret:%d ",
__func__,
- (command == ZEBRA_NEXTHOP_REGISTER) ? " " : "de", buf,
+ (command == ZEBRA_NEXTHOP_REGISTER) ? " " : "de", p,
pim->vrf->name, ret);
- }
return;
}
@@ -89,7 +88,6 @@ static struct pim_nexthop_cache *pim_nexthop_cache_add(struct pim_instance *pim,
{
struct pim_nexthop_cache *pnc;
char hash_name[64];
- char buf1[64];
pnc = XCALLOC(MTYPE_PIM_NEXTHOP_CACHE,
sizeof(struct pim_nexthop_cache));
@@ -103,8 +101,8 @@ static struct pim_nexthop_cache *pim_nexthop_cache_add(struct pim_instance *pim,
pnc->rp_list = list_new();
pnc->rp_list->cmp = pim_rp_list_cmp;
- snprintf(hash_name, sizeof(hash_name), "PNC %s(%s) Upstream Hash",
- prefix2str(&pnc->rpf.rpf_addr, buf1, 64), pim->vrf->name);
+ snprintfrr(hash_name, sizeof(hash_name), "PNC %pFX(%s) Upstream Hash",
+ &pnc->rpf.rpf_addr, pim->vrf->name);
pnc->upstream_hash = hash_create_size(8192, pim_upstream_hash_key,
pim_upstream_equal, hash_name);
@@ -140,13 +138,10 @@ int pim_find_or_track_nexthop(struct pim_instance *pim, struct prefix *addr,
pnc = pim_nexthop_cache_add(pim, &rpf);
pim_sendmsg_zebra_rnh(pim, zclient, pnc,
ZEBRA_NEXTHOP_REGISTER);
- if (PIM_DEBUG_PIM_NHT) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(addr, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: NHT cache and zebra notification added for %s(%s)",
- __func__, buf, pim->vrf->name);
- }
+ "%s: NHT cache and zebra notification added for %pFX(%s)",
+ __func__, addr, pim->vrf->name);
}
if (rp != NULL) {
@@ -215,14 +210,11 @@ void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
if (del_bsr_tracking)
pnc->bsr_tracking = false;
- if (PIM_DEBUG_PIM_NHT) {
- char buf[PREFIX_STRLEN];
- prefix2str(addr, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: NHT %s(%s) rp_list count:%d upstream count:%ld",
- __func__, buf, pim->vrf->name,
+ "%s: NHT %pFX(%s) rp_list count:%d upstream count:%ld",
+ __func__, addr, pim->vrf->name,
pnc->rp_list->count, pnc->upstream_hash->count);
- }
if (pnc->rp_list->count == 0
&& pnc->upstream_hash->count == 0
@@ -744,13 +736,10 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
prefix_copy(&rpf.rpf_addr, &nhr.prefix);
pnc = pim_nexthop_cache_find(pim, &rpf);
if (!pnc) {
- if (PIM_DEBUG_PIM_NHT) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&rpf.rpf_addr, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: Skipping NHT update, addr %s is not in local cached DB.",
- __func__, buf);
- }
+ "%s: Skipping NHT update, addr %pFX is not in local cached DB.",
+ __func__, &rpf.rpf_addr);
return 0;
}
} else {
@@ -819,17 +808,13 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
continue;
}
- if (PIM_DEBUG_PIM_NHT) {
- char p_str[PREFIX2STR_BUFFER];
-
- prefix2str(&nhr.prefix, p_str, sizeof(p_str));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: NHT addr %s(%s) %d-nhop via %s(%s) type %d distance:%u metric:%u ",
- __func__, p_str, pim->vrf->name, i + 1,
- inet_ntoa(nexthop->gate.ipv4),
+ "%s: NHT addr %pFX(%s) %d-nhop via %s(%s) type %d distance:%u metric:%u ",
+ __func__, &nhr.prefix, pim->vrf->name,
+ i + 1, inet_ntoa(nexthop->gate.ipv4),
ifp->name, nexthop->type, nhr.distance,
nhr.metric);
- }
if (!ifp->info) {
/*
@@ -879,15 +864,12 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
}
SET_FLAG(pnc->flags, PIM_NEXTHOP_ANSWER_RECEIVED);
- if (PIM_DEBUG_PIM_NHT) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&nhr.prefix, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: NHT Update for %s(%s) num_nh %d num_pim_nh %d vrf:%u up %ld rp %d",
- __func__, buf, pim->vrf->name, nhr.nexthop_num,
+ "%s: NHT Update for %pFX(%s) num_nh %d num_pim_nh %d vrf:%u up %ld rp %d",
+ __func__, &nhr.prefix, pim->vrf->name, nhr.nexthop_num,
pnc->nexthop_num, vrf_id, pnc->upstream_hash->count,
listcount(pnc->rp_list));
- }
pim_rpf_set_refresh_time(pim);
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c
index 11e6d47fc..0ec8e45ed 100644
--- a/pimd/pim_rp.c
+++ b/pimd/pim_rp.c
@@ -248,14 +248,10 @@ struct rp_info *pim_rp_find_match_group(struct pim_instance *pim,
}
rp_info = rn->info;
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX_STRLEN];
-
- zlog_debug("Lookedup: %p for rp_info: %p(%s) Lock: %d", rn,
- rp_info,
- prefix2str(&rp_info->group, buf, sizeof(buf)),
+ if (PIM_DEBUG_PIM_TRACE)
+ zlog_debug("Lookedup: %p for rp_info: %p(%pFX) Lock: %d", rn,
+ rp_info, &rp_info->group,
route_node_get_lock_count(rn));
- }
route_unlock_node(rn);
@@ -370,14 +366,10 @@ void pim_upstream_update(struct pim_instance *pim, struct pim_upstream *up)
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = old_upstream_addr;
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&nht_p, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
- "%s: Deregister upstream %s addr %s with Zebra NHT",
- __func__, up->sg_str, buf);
- }
+ "%s: Deregister upstream %s addr %pFX with Zebra NHT",
+ __func__, up->sg_str, &nht_p);
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL, false);
}
@@ -547,15 +539,10 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr,
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 =
rp_all->rp.rpf_addr.u.prefix4; // RP address
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
- char buf1[PREFIX2STR_BUFFER];
- prefix2str(&nht_p, buf, sizeof(buf));
- prefix2str(&rp_all->group, buf1, sizeof(buf1));
+ if (PIM_DEBUG_PIM_NHT_RP)
zlog_debug(
- "%s: NHT Register rp_all addr %s grp %s ",
- __func__, buf, buf1);
- }
+ "%s: NHT Register rp_all addr %pFX grp %pFX ",
+ __func__, &nht_p, &rp_all->group);
frr_each (rb_pim_upstream, &pim->upstream_head, up) {
/* Find (*, G) upstream whose RP is not
@@ -643,14 +630,10 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr,
rn = route_node_get(pim->rp_table, &rp_info->group);
rn->info = rp_info;
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX_STRLEN];
-
- zlog_debug("Allocated: %p for rp_info: %p(%s) Lock: %d", rn,
- rp_info,
- prefix2str(&rp_info->group, buf, sizeof(buf)),
+ if (PIM_DEBUG_PIM_TRACE)
+ zlog_debug("Allocated: %p for rp_info: %p(%pFX) Lock: %d", rn,
+ rp_info, &rp_info->group,
route_node_get_lock_count(rn));
- }
frr_each (rb_pim_upstream, &pim->upstream_head, up) {
if (up->sg.src.s_addr == INADDR_ANY) {
@@ -674,14 +657,9 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr,
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
- char buf1[PREFIX2STR_BUFFER];
- prefix2str(&nht_p, buf, sizeof(buf));
- prefix2str(&rp_info->group, buf1, sizeof(buf1));
- zlog_debug("%s: NHT Register RP addr %s grp %s with Zebra ",
- __func__, buf, buf1);
- }
+ if (PIM_DEBUG_PIM_NHT_RP)
+ zlog_debug("%s: NHT Register RP addr %pFX grp %pFX with Zebra ",
+ __func__, &nht_p, &rp_info->group);
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false, NULL);
if (!pim_ecmp_nexthop_lookup(pim, &rp_info->rp.source_nexthop, &nht_p,
&rp_info->group, 1))
@@ -727,12 +705,10 @@ int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr,
struct pim_upstream *up;
struct bsgrp_node *bsgrp = NULL;
struct bsm_rpinfo *bsrp = NULL;
- char grp_str[PREFIX2STR_BUFFER];
char rp_str[INET_ADDRSTRLEN];
if (!inet_ntop(AF_INET, &rp_addr, rp_str, sizeof(rp_str)))
snprintf(rp_str, sizeof(rp_str), "<rp?>");
- prefix2str(&group, grp_str, sizeof(grp_str));
if (plist)
rp_info = pim_rp_find_prefix_list(pim, rp_addr, plist);
@@ -748,8 +724,8 @@ int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr,
}
if (PIM_DEBUG_PIM_TRACE)
- zlog_debug("%s: Delete RP %s for the group %s", __func__,
- rp_str, grp_str);
+ zlog_debug("%s: Delete RP %s for the group %pFX", __func__,
+ rp_str, &group);
/* While static RP is getting deleted, we need to check if dynamic RP
* present for the same group in BSM RP table, then install the dynamic
@@ -771,8 +747,8 @@ int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr,
"<bsrp?>");
zlog_debug(
- "%s: BSM RP %s found for the group %s",
- __func__, bsrp_str, grp_str);
+ "%s: BSM RP %s found for the group %pFX",
+ __func__, bsrp_str, &group);
}
return pim_rp_change(pim, bsrp->rp_address,
group, RP_SRC_BSR);
@@ -780,8 +756,8 @@ int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr,
} else {
if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
- "%s: BSM RP not found for the group %s",
- __func__, grp_str);
+ "%s: BSM RP not found for the group %pFX",
+ __func__, &group);
}
}
@@ -789,12 +765,9 @@ int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr,
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&nht_p, buf, sizeof(buf));
- zlog_debug("%s: Deregister RP addr %s with Zebra ", __func__,
- buf);
- }
+ if (PIM_DEBUG_PIM_NHT_RP)
+ zlog_debug("%s: Deregister RP addr %pFX with Zebra ", __func__,
+ &nht_p);
pim_delete_tracked_nexthop(pim, &nht_p, NULL, rp_info, false);
if (!str2prefix("224.0.0.0/4", &g_all))
@@ -837,16 +810,12 @@ int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr,
EC_LIB_DEVELOPMENT,
"Expected rn->info to be equal to rp_info");
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX_STRLEN];
-
+ if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
- "%s:Found for Freeing: %p for rp_info: %p(%s) Lock: %d",
- __func__, rn, rp_info,
- prefix2str(&rp_info->group, buf,
- sizeof(buf)),
+ "%s:Found for Freeing: %p for rp_info: %p(%pFX) Lock: %d",
+ __func__, rn, rp_info, &rp_info->group,
route_node_get_lock_count(rn));
- }
+
rn->info = NULL;
route_unlock_node(rn);
route_unlock_node(rn);
@@ -925,13 +894,9 @@ int pim_rp_change(struct pim_instance *pim, struct in_addr new_rp_addr,
/* Deregister old RP addr with Zebra NHT */
if (rp_info->rp.rpf_addr.u.prefix4.s_addr != INADDR_ANY) {
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&nht_p, buf, sizeof(buf));
- zlog_debug("%s: Deregister RP addr %s with Zebra ",
- __func__, buf);
- }
+ if (PIM_DEBUG_PIM_NHT_RP)
+ zlog_debug("%s: Deregister RP addr %pFX with Zebra ",
+ __func__, &nht_p);
pim_delete_tracked_nexthop(pim, &nht_p, NULL, rp_info, false);
}
@@ -961,15 +926,9 @@ int pim_rp_change(struct pim_instance *pim, struct in_addr new_rp_addr,
/* Register new RP addr with Zebra NHT */
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
- char buf1[PREFIX2STR_BUFFER];
-
- prefix2str(&nht_p, buf, sizeof(buf));
- prefix2str(&rp_info->group, buf1, sizeof(buf1));
- zlog_debug("%s: NHT Register RP addr %s grp %s with Zebra ",
- __func__, buf, buf1);
- }
+ if (PIM_DEBUG_PIM_NHT_RP)
+ zlog_debug("%s: NHT Register RP addr %pFX grp %pFX with Zebra ",
+ __func__, &nht_p, &rp_info->group);
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false, NULL);
if (!pim_ecmp_nexthop_lookup(pim, &rp_info->rp.source_nexthop, &nht_p,
@@ -1145,15 +1104,10 @@ struct pim_rpf *pim_rp_g(struct pim_instance *pim, struct in_addr group)
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
- char buf1[PREFIX2STR_BUFFER];
- prefix2str(&nht_p, buf, sizeof(buf));
- prefix2str(&rp_info->group, buf1, sizeof(buf1));
+ if (PIM_DEBUG_PIM_NHT_RP)
zlog_debug(
- "%s: NHT Register RP addr %s grp %s with Zebra",
- __func__, buf, buf1);
- }
+ "%s: NHT Register RP addr %pFX grp %pFX with Zebra",
+ __func__, &nht_p, &rp_info->group);
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false,
NULL);
pim_rpf_set_refresh_time(pim);
@@ -1208,7 +1162,6 @@ int pim_rp_config_write(struct pim_instance *pim, struct vty *vty,
struct listnode *node;
struct rp_info *rp_info;
char rp_buffer[32];
- char group_buffer[32];
int count = 0;
for (ALL_LIST_ELEMENTS_RO(pim->rp_list, node, rp_info)) {
@@ -1225,11 +1178,11 @@ int pim_rp_config_write(struct pim_instance *pim, struct vty *vty,
rp_buffer, 32),
rp_info->plist);
else
- vty_out(vty, "%sip pim rp %s %s\n", spaces,
+ vty_out(vty, "%sip pim rp %s %pFX\n", spaces,
inet_ntop(AF_INET,
&rp_info->rp.rpf_addr.u.prefix4,
rp_buffer, 32),
- prefix2str(&rp_info->group, group_buffer, 32));
+ &rp_info->group);
count++;
}
@@ -1335,9 +1288,8 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj)
if (rp_info->plist)
vty_out(vty, "%-18s ", rp_info->plist);
else
- vty_out(vty, "%-18s ",
- prefix2str(&rp_info->group, buf,
- 48));
+ vty_out(vty, "%-18pFX ",
+ &rp_info->group);
if (rp_info->rp.source_nexthop.interface)
vty_out(vty, "%-16s ",
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index d3fb0d46d..312a7069d 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -267,13 +267,10 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = up->upstream_addr;
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&nht_p, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
- "%s: Deregister upstream %s addr %s with Zebra NHT",
- __func__, up->sg_str, buf);
- }
+ "%s: Deregister upstream %s addr %pFX with Zebra NHT",
+ __func__, up->sg_str, &nht_p);
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL, false);
}
@@ -1062,15 +1059,13 @@ struct pim_upstream *pim_upstream_add(struct pim_instance *pim,
}
if (PIM_DEBUG_PIM_TRACE) {
- if (up) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&up->rpf.rpf_addr, buf, sizeof(buf));
- zlog_debug("%s(%s): %s, iif %s (%s) found: %d: ref_count: %d",
+ if (up)
+ zlog_debug("%s(%s): %s, iif %pFX (%s) found: %d: ref_count: %d",
__func__, name,
- up->sg_str, buf, up->rpf.source_nexthop.interface ?
+ up->sg_str, &up->rpf.rpf_addr, up->rpf.source_nexthop.interface ?
up->rpf.source_nexthop.interface->name : "Unknown" ,
found, up->ref_count);
- } else
+ else
zlog_debug("%s(%s): (%s) failure to create", __func__,
name, pim_str_sg_dump(sg));
}
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index d089dfda5..52bfab9a3 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -130,10 +130,8 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
p = c->address;
if (PIM_DEBUG_ZEBRA) {
- char buf[BUFSIZ];
- prefix2str(p, buf, BUFSIZ);
- zlog_debug("%s: %s(%u) connected IP address %s flags %u %s",
- __func__, c->ifp->name, vrf_id, buf, c->flags,
+ zlog_debug("%s: %s(%u) connected IP address %pFX flags %u %s",
+ __func__, c->ifp->name, vrf_id, p, c->flags,
CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
? "secondary"
: "primary");
@@ -149,17 +147,10 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
struct in_addr primary_addr = pim_find_primary_addr(c->ifp);
if (p->family != AF_INET
|| primary_addr.s_addr != p->u.prefix4.s_addr) {
- if (PIM_DEBUG_ZEBRA) {
- /* but we had a primary address already */
-
- char buf[BUFSIZ];
-
- prefix2str(p, buf, BUFSIZ);
-
+ if (PIM_DEBUG_ZEBRA)
zlog_warn(
- "%s: %s : forcing secondary flag on %s",
- __func__, c->ifp->name, buf);
- }
+ "%s: %s : forcing secondary flag on %pFX",
+ __func__, c->ifp->name, p);
SET_FLAG(c->flags, ZEBRA_IFA_SECONDARY);
}
}
@@ -211,11 +202,9 @@ static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS)
p = c->address;
if (p->family == AF_INET) {
if (PIM_DEBUG_ZEBRA) {
- char buf[BUFSIZ];
- prefix2str(p, buf, BUFSIZ);
zlog_debug(
- "%s: %s(%u) disconnected IP address %s flags %u %s",
- __func__, c->ifp->name, vrf_id, buf, c->flags,
+ "%s: %s(%u) disconnected IP address %pFX flags %u %s",
+ __func__, c->ifp->name, vrf_id, p, c->flags,
CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
? "secondary"
: "primary");
diff --git a/sharpd/sharp_nht.c b/sharpd/sharp_nht.c
index 077e2b29e..bed0ebfa2 100644
--- a/sharpd/sharp_nht.c
+++ b/sharpd/sharp_nht.c
@@ -60,14 +60,9 @@ void sharp_nh_tracker_dump(struct vty *vty)
struct listnode *node;
struct sharp_nh_tracker *nht;
- for (ALL_LIST_ELEMENTS_RO(sg.nhs, node, nht)) {
- char buf[PREFIX_STRLEN];
-
- vty_out(vty, "%s: Nexthops: %u Updates: %u\n",
- prefix2str(&nht->p, buf, sizeof(buf)),
- nht->nhop_num,
- nht->updates);
- }
+ for (ALL_LIST_ELEMENTS_RO(sg.nhs, node, nht))
+ vty_out(vty, "%pFX: Nexthops: %u Updates: %u\n", &nht->p,
+ nht->nhop_num, nht->updates);
}
PREDECL_RBTREE_UNIQ(sharp_nhg_rb);
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c
index 0c3bf7af7..45c0799fa 100644
--- a/sharpd/sharp_vty.c
+++ b/sharpd/sharp_vty.c
@@ -146,16 +146,12 @@ DEFPY (install_routes_data_dump,
"Data about what is going on\n"
"Route Install/Removal Information\n")
{
- char buf[PREFIX_STRLEN];
struct timeval r;
timersub(&sg.r.t_end, &sg.r.t_start, &r);
- vty_out(vty, "Prefix: %s Total: %u %u %u Time: %jd.%ld\n",
- prefix2str(&sg.r.orig_prefix, buf, sizeof(buf)),
- sg.r.total_routes,
- sg.r.installed_routes,
- sg.r.removed_routes,
- (intmax_t)r.tv_sec, (long)r.tv_usec);
+ vty_out(vty, "Prefix: %pFX Total: %u %u %u Time: %jd.%ld\n",
+ &sg.r.orig_prefix, sg.r.total_routes, sg.r.installed_routes,
+ sg.r.removed_routes, (intmax_t)r.tv_sec, (long)r.tv_usec);
return CMD_SUCCESS;
}
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c
index efde3babd..a9b570de8 100644
--- a/staticd/static_zebra.c
+++ b/staticd/static_zebra.c
@@ -109,24 +109,21 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS)
struct prefix p;
enum zapi_route_notify_owner note;
uint32_t table_id;
- char buf[PREFIX_STRLEN];
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, &note))
return -1;
- prefix2str(&p, buf, sizeof(buf));
-
switch (note) {
case ZAPI_ROUTE_FAIL_INSTALL:
static_nht_mark_state(&p, vrf_id, STATIC_NOT_INSTALLED);
- zlog_warn("%s: Route %s failed to install for table: %u",
- __func__, buf, table_id);
+ zlog_warn("%s: Route %pFX failed to install for table: %u",
+ __func__, &p, table_id);
break;
case ZAPI_ROUTE_BETTER_ADMIN_WON:
static_nht_mark_state(&p, vrf_id, STATIC_NOT_INSTALLED);
zlog_warn(
- "%s: Route %s over-ridden by better route for table: %u",
- __func__, buf, table_id);
+ "%s: Route %pFX over-ridden by better route for table: %u",
+ __func__, &p, table_id);
break;
case ZAPI_ROUTE_INSTALLED:
static_nht_mark_state(&p, vrf_id, STATIC_INSTALLED);
@@ -136,8 +133,8 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS)
break;
case ZAPI_ROUTE_REMOVE_FAIL:
static_nht_mark_state(&p, vrf_id, STATIC_INSTALLED);
- zlog_warn("%s: Route %s failure to remove for table: %u",
- __func__, buf, table_id);
+ zlog_warn("%s: Route %pFX failure to remove for table: %u",
+ __func__, &p, table_id);
break;
}
diff --git a/tests/bgpd/test_bgp_table.c b/tests/bgpd/test_bgp_table.c
index 4eb132df5..e899e5b35 100644
--- a/tests/bgpd/test_bgp_table.c
+++ b/tests/bgpd/test_bgp_table.c
@@ -109,10 +109,7 @@ static void check_lookup_result(struct bgp_dest *match, va_list arglist)
if (bgp_dest_has_bgp_path_info_data(dest)
&& !prefix_in_array(dest_p, prefixes, prefix_count)) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(dest_p, buf, PREFIX2STR_BUFFER);
- printf("prefix %s was not expected!\n", buf);
+ printf("prefix %pFX was not expected!\n", dest_p);
assert(0);
}
}
diff --git a/tests/lib/cli/test_cli.c b/tests/lib/cli/test_cli.c
index 8f062d8b5..8dba1e29f 100644
--- a/tests/lib/cli/test_cli.c
+++ b/tests/lib/cli/test_cli.c
@@ -47,12 +47,10 @@ DEFPY(magic_test, magic_test_cmd,
"magic (0-100) {ipv4net A.B.C.D/M|X:X::X:X$ipv6}",
"1\n2\n3\n4\n5\n")
{
- char buf[256];
vty_out(vty, "def: %s\n", self->string);
vty_out(vty, "num: %ld\n", magic);
- vty_out(vty, "ipv4: %s\n", prefix2str(ipv4net, buf, sizeof(buf)));
- vty_out(vty, "ipv6: %s\n",
- inet_ntop(AF_INET6, &ipv6, buf, sizeof(buf)));
+ vty_out(vty, "ipv4: %pFX\n", ipv4net);
+ vty_out(vty, "ipv6: %pI6\n", &ipv6);
return CMD_SUCCESS;
}
diff --git a/tests/lib/test_table.c b/tests/lib/test_table.c
index 90d6c76bf..290657bd5 100644
--- a/tests/lib/test_table.c
+++ b/tests/lib/test_table.c
@@ -104,7 +104,6 @@ static void add_nodes(struct route_table *table, ...)
static void print_subtree(struct route_node *rn, const char *legend,
int indent_level)
{
- char buf[PREFIX2STR_BUFFER];
int i;
/*
@@ -114,8 +113,7 @@ static void print_subtree(struct route_node *rn, const char *legend,
printf(" ");
}
- prefix2str(&rn->p, buf, sizeof(buf));
- printf("%s: %s", legend, buf);
+ printf("%s: %pFX", legend, &rn->p);
if (!rn->info) {
printf(" (internal)");
}
diff --git a/zebra/connected.c b/zebra/connected.c
index 8c4ba163b..cd42b5b25 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -259,14 +259,10 @@ void connected_up(struct interface *ifp, struct connected *ifc)
/* Schedule LSP forwarding entries for processing, if appropriate. */
if (zvrf->vrf->vrf_id == VRF_DEFAULT) {
- if (IS_ZEBRA_DEBUG_MPLS) {
- char buf[PREFIX_STRLEN];
-
+ if (IS_ZEBRA_DEBUG_MPLS)
zlog_debug(
- "%u: IF %s IP %s address add/up, scheduling MPLS processing",
- zvrf->vrf->vrf_id, ifp->name,
- prefix2str(&p, buf, sizeof(buf)));
- }
+ "%u: IF %s IP %pFX address add/up, scheduling MPLS processing",
+ zvrf->vrf->vrf_id, ifp->name, &p);
mpls_mark_lsps_for_processing(zvrf, &p);
}
}
@@ -400,14 +396,10 @@ void connected_down(struct interface *ifp, struct connected *ifc)
/* Schedule LSP forwarding entries for processing, if appropriate. */
if (zvrf->vrf->vrf_id == VRF_DEFAULT) {
- if (IS_ZEBRA_DEBUG_MPLS) {
- char buf[PREFIX_STRLEN];
-
+ if (IS_ZEBRA_DEBUG_MPLS)
zlog_debug(
- "%u: IF %s IP %s address down, scheduling MPLS processing",
- zvrf->vrf->vrf_id, ifp->name,
- prefix2str(&p, buf, sizeof(buf)));
- }
+ "%u: IF %s IP %pFX address down, scheduling MPLS processing",
+ zvrf->vrf->vrf_id, ifp->name, &p);
mpls_mark_lsps_for_processing(zvrf, &p);
}
}
@@ -424,14 +416,10 @@ static void connected_delete_helper(struct connected *ifc, struct prefix *p)
/* Schedule LSP forwarding entries for processing, if appropriate. */
if (ifp->vrf_id == VRF_DEFAULT) {
- if (IS_ZEBRA_DEBUG_MPLS) {
- char buf[PREFIX_STRLEN];
-
+ if (IS_ZEBRA_DEBUG_MPLS)
zlog_debug(
- "%u: IF %s IP %s address delete, scheduling MPLS processing",
- ifp->vrf_id, ifp->name,
- prefix2str(p, buf, sizeof(buf)));
- }
+ "%u: IF %s IP %pFX address delete, scheduling MPLS processing",
+ ifp->vrf_id, ifp->name, p);
mpls_mark_lsps_for_processing(vrf_info_lookup(ifp->vrf_id), p);
}
}
diff --git a/zebra/interface.c b/zebra/interface.c
index 321085580..0652d3a2b 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -1296,8 +1296,6 @@ static void ifs_dump_brief_vty(struct vty *vty, struct vrf *vrf)
bool print_header = true;
FOR_ALL_INTERFACES (vrf, ifp) {
- char global_pfx[PREFIX_STRLEN] = {0};
- char buf[PREFIX_STRLEN] = {0};
bool first_pfx_printed = false;
if (print_header) {
@@ -1329,17 +1327,17 @@ static void ifs_dump_brief_vty(struct vty *vty, struct vrf *vrf)
if (!CHECK_FLAG(connected->flags,
ZEBRA_IFA_SECONDARY)) {
p = connected->address;
- prefix2str(p, buf, sizeof(buf));
if (first_pfx_printed) {
- /* padding to prepare row only for ip addr */
+ /* padding to prepare row only
+ * for ip addr */
vty_out(vty, "%-40s", "");
if (list_size > 1)
vty_out(vty, "+ ");
- vty_out(vty, "%s\n", buf);
+ vty_out(vty, "%pFX\n", p);
} else {
if (list_size > 1)
vty_out(vty, "+ ");
- vty_out(vty, "%s\n", buf);
+ vty_out(vty, "%pFX\n", p);
}
first_pfx_printed = true;
break;
@@ -1361,17 +1359,17 @@ static void ifs_dump_brief_vty(struct vty *vty, struct vrf *vrf)
p = connected->address;
/* Don't print link local pfx */
if (!IN6_IS_ADDR_LINKLOCAL(&p->u.prefix6)) {
- prefix2str(p, global_pfx, PREFIX_STRLEN);
if (first_pfx_printed) {
- /* padding to prepare row only for ip addr */
+ /* padding to prepare row only
+ * for ip addr */
vty_out(vty, "%-40s", "");
if (v6_list_size > 1)
vty_out(vty, "+ ");
- vty_out(vty, "%s\n", global_pfx);
+ vty_out(vty, "%pFX\n", p);
} else {
if (v6_list_size > 1)
vty_out(vty, "+ ");
- vty_out(vty, "%s\n", global_pfx);
+ vty_out(vty, "%pFX\n", p);
}
first_pfx_printed = true;
break;
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index b868d23a9..710a32c45 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -175,7 +175,6 @@ static void irdp_send(struct interface *ifp, struct prefix *p, struct stream *s)
{
struct zebra_if *zi = ifp->info;
struct irdp_interface *irdp = zi->irdp;
- char buf[PREFIX_STRLEN];
uint32_t dst;
uint32_t ttl = 1;
@@ -190,10 +189,11 @@ static void irdp_send(struct interface *ifp, struct prefix *p, struct stream *s)
dst = htonl(INADDR_ALLHOSTS_GROUP);
if (irdp->flags & IF_DEBUG_MESSAGES)
- zlog_debug("IRDP: TX Advert on %s %s Holdtime=%d Preference=%d",
- ifp->name, prefix2str(p, buf, sizeof(buf)),
- irdp->flags & IF_SHUTDOWN ? 0 : irdp->Lifetime,
- get_pref(irdp, p));
+ zlog_debug(
+ "IRDP: TX Advert on %s %pFX Holdtime=%d Preference=%d",
+ ifp->name, p,
+ irdp->flags & IF_SHUTDOWN ? 0 : irdp->Lifetime,
+ get_pref(irdp, p));
send_packet(ifp, s, dst, p, ttl);
}
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index c0f89e6af..1f075cfb4 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -119,18 +119,17 @@ static void zebra_redistribute(struct zserv *client, int type,
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
RNODE_FOREACH_RE (rn, newre) {
const struct prefix *dst_p, *src_p;
- char buf[PREFIX_STRLEN];
srcdest_rnode_prefixes(rn, &dst_p, &src_p);
if (IS_ZEBRA_DEBUG_RIB)
zlog_debug(
- "%s: client %s %s(%u) checking: selected=%d, type=%d, distance=%d, metric=%d zebra_check_addr=%d",
+ "%s: client %s %pFX(%u) checking: selected=%d, type=%d, distance=%d, metric=%d zebra_check_addr=%d",
__func__,
zebra_route_string(client->proto),
- prefix2str(dst_p, buf, sizeof(buf)),
- vrf_id, CHECK_FLAG(newre->flags,
- ZEBRA_FLAG_SELECTED),
+ dst_p, vrf_id,
+ CHECK_FLAG(newre->flags,
+ ZEBRA_FLAG_SELECTED),
newre->type, newre->distance,
newre->metric, zebra_check_addr(dst_p));
@@ -196,15 +195,13 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,
struct listnode *node, *nnode;
struct zserv *client;
int afi;
- char buf[PREFIX_STRLEN];
- if (IS_ZEBRA_DEBUG_RIB) {
+ if (IS_ZEBRA_DEBUG_RIB)
zlog_debug(
- "(%u:%u):%s: Redist update re %p (%s), old %p (%s)",
- re->vrf_id, re->table, prefix2str(p, buf, sizeof(buf)),
- re, zebra_route_string(re->type), prev_re,
+ "(%u:%u):%pFX: Redist update re %p (%s), old %p (%s)",
+ re->vrf_id, re->table, p, re,
+ zebra_route_string(re->type), prev_re,
prev_re ? zebra_route_string(prev_re->type) : "None");
- }
afi = family2afi(p->family);
if (!afi) {
@@ -214,8 +211,7 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,
}
if (!zebra_check_addr(p)) {
if (IS_ZEBRA_DEBUG_RIB)
- zlog_debug("Redist update filter prefix %s",
- prefix2str(p, buf, sizeof(buf)));
+ zlog_debug("Redist update filter prefix %pFX", p);
return;
}
@@ -224,10 +220,9 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,
if (zebra_redistribute_check(re, client, p, afi)) {
if (IS_ZEBRA_DEBUG_RIB) {
zlog_debug(
- "%s: client %s %s(%u:%u), type=%d, distance=%d, metric=%d",
+ "%s: client %s %pFX(%u:%u), type=%d, distance=%d, metric=%d",
__func__,
- zebra_route_string(client->proto),
- prefix2str(p, buf, sizeof(buf)),
+ zebra_route_string(client->proto), p,
re->vrf_id, re->table, re->type,
re->distance, re->metric);
}
@@ -254,7 +249,6 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
struct listnode *node, *nnode;
struct zserv *client;
int afi;
- char buf[PREFIX_STRLEN];
vrf_id_t vrfid;
if (old_re)
@@ -265,13 +259,11 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
return;
if (IS_ZEBRA_DEBUG_RIB) {
- zlog_debug(
- "%u:%s: Redist del: re %p (%s), new re %p (%s)",
- vrfid, prefix2str(p, buf, sizeof(buf)),
- old_re,
- old_re ? zebra_route_string(old_re->type) : "None",
- new_re,
- new_re ? zebra_route_string(new_re->type) : "None");
+ zlog_debug("%u:%pFX: Redist del: re %p (%s), new re %p (%s)",
+ vrfid, p, old_re,
+ old_re ? zebra_route_string(old_re->type) : "None",
+ new_re,
+ new_re ? zebra_route_string(new_re->type) : "None");
}
/* Add DISTANCE_INFINITY check. */
@@ -293,8 +285,8 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
if (!zebra_check_addr(p)) {
if (IS_ZEBRA_DEBUG_RIB) {
zlog_debug(
- "%u:%s: Redist del old: skipping invalid prefix",
- vrfid, prefix2str(p, buf, sizeof(buf)));
+ "%u:%pFX: Redist del old: skipping invalid prefix",
+ vrfid, p);
}
return;
}
@@ -541,12 +533,10 @@ void zebra_interface_address_add_update(struct interface *ifp,
struct prefix *p;
if (IS_ZEBRA_DEBUG_EVENT) {
- char buf[PREFIX_STRLEN];
-
p = ifc->address;
- zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %s on %s(%u)",
- prefix2str(p, buf, sizeof(buf)), ifp->name,
- ifp->vrf_id);
+ zlog_debug(
+ "MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %pFX on %s(%u)",
+ p, ifp->name, ifp->vrf_id);
}
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
@@ -580,12 +570,10 @@ void zebra_interface_address_delete_update(struct interface *ifp,
struct prefix *p;
if (IS_ZEBRA_DEBUG_EVENT) {
- char buf[PREFIX_STRLEN];
-
p = ifc->address;
- zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %s on %s(%u)",
- prefix2str(p, buf, sizeof(buf)),
- ifp->name, ifp->vrf_id);
+ zlog_debug(
+ "MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %pFX on %s(%u)",
+ p, ifp->name, ifp->vrf_id);
}
zebra_vxlan_add_del_gw_macip(ifp, ifc->address, 0);
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 1ce3c435f..d0bf77f01 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -731,11 +731,10 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
p.prefixlen = rtm->rtm_dst_len;
if (rtm->rtm_src_len != 0) {
- char buf[PREFIX_STRLEN];
flog_warn(
EC_ZEBRA_UNSUPPORTED_V4_SRCDEST,
- "unsupported IPv4 sourcedest route (dest %s vrf %u)",
- prefix2str(&p, buf, sizeof(buf)), vrf_id);
+ "unsupported IPv4 sourcedest route (dest %pFX vrf %u)",
+ &p, vrf_id);
return 0;
}
@@ -786,12 +785,11 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
}
if (IS_ZEBRA_DEBUG_KERNEL) {
- char buf[PREFIX_STRLEN];
char buf2[PREFIX_STRLEN];
+
zlog_debug(
- "%s %s%s%s vrf %s(%u) table_id: %u metric: %d Admin Distance: %d",
- nl_msg_type_to_str(h->nlmsg_type),
- prefix2str(&p, buf, sizeof(buf)),
+ "%s %pFX%s%s vrf %s(%u) table_id: %u metric: %d Admin Distance: %d",
+ nl_msg_type_to_str(h->nlmsg_type), &p,
src_p.prefixlen ? " from " : "",
src_p.prefixlen ? prefix2str(&src_p, buf2, sizeof(buf2))
: "",
diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c
index a2e15cbd2..a0f401c33 100644
--- a/zebra/rt_socket.c
+++ b/zebra/rt_socket.c
@@ -80,19 +80,15 @@ static int kernel_rtm(int cmd, const struct prefix *p,
bool gate = false;
int error;
char gate_buf[INET6_BUFSIZ];
- char prefix_buf[PREFIX_STRLEN];
enum blackhole_type bh_type = BLACKHOLE_UNSPEC;
- prefix2str(p, prefix_buf, sizeof(prefix_buf));
-
/*
* We only have the ability to ADD or DELETE at this point
* in time.
*/
if (cmd != RTM_ADD && cmd != RTM_DELETE) {
if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug("%s: %s odd command %s",
- __func__, prefix_buf,
+ zlog_debug("%s: %pFX odd command %s", __func__, p,
lookup_msg(rtm_type_str, cmd, NULL));
return 0;
}
@@ -237,8 +233,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,
if (IS_ZEBRA_DEBUG_KERNEL) {
if (!gate) {
zlog_debug(
- "%s: %s: attention! gate not found for re",
- __func__, prefix_buf);
+ "%s: %pFX: attention! gate not found for re",
+ __func__, p);
} else {
switch (p->family) {
case AF_INET:
@@ -266,8 +262,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,
case ZEBRA_ERR_NOERROR:
nexthop_num++;
if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug("%s: %s: successfully did NH %s",
- __func__, prefix_buf, gate_buf);
+ zlog_debug("%s: %pFX: successfully did NH %s",
+ __func__, p, gate_buf);
if (cmd == RTM_ADD)
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
break;
@@ -289,8 +285,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,
default:
flog_err(
EC_LIB_SYSTEM_CALL,
- "%s: %s: rtm_write() unexpectedly returned %d for command %s",
- __func__, prefix_buf, error,
+ "%s: %pFX: rtm_write() unexpectedly returned %d for command %s",
+ __func__, p, error,
lookup_msg(rtm_type_str, cmd, NULL));
break;
}
@@ -300,8 +296,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,
if (nexthop_num == 0) {
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "%s: No useful nexthops were found in RIB prefix %s",
- __func__, prefix_buf);
+ "%s: No useful nexthops were found in RIB prefix %pFX",
+ __func__, p);
return 1;
}
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 13b7c150a..c3add16c5 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -2337,7 +2337,6 @@ static int rtadv_config_write(struct vty *vty, struct interface *ifp)
struct rtadv_prefix *rprefix;
struct rtadv_rdnss *rdnss;
struct rtadv_dnssl *dnssl;
- char buf[PREFIX_STRLEN];
int interval;
zif = ifp->info;
@@ -2408,8 +2407,7 @@ static int rtadv_config_write(struct vty *vty, struct interface *ifp)
for (ALL_LIST_ELEMENTS_RO(zif->rtadv.AdvPrefixList, node, rprefix)) {
if ((rprefix->AdvPrefixCreate == PREFIX_SRC_MANUAL)
|| (rprefix->AdvPrefixCreate == PREFIX_SRC_BOTH)) {
- vty_out(vty, " ipv6 nd prefix %s",
- prefix2str(&rprefix->prefix, buf, sizeof(buf)));
+ vty_out(vty, " ipv6 nd prefix %pFX", &rprefix->prefix);
if ((rprefix->AdvValidLifetime != RTADV_VALID_LIFETIME)
|| (rprefix->AdvPreferredLifetime
!= RTADV_PREFERRED_LIFETIME)) {
diff --git a/zebra/rule_netlink.c b/zebra/rule_netlink.c
index d6a34327a..a63504992 100644
--- a/zebra/rule_netlink.c
+++ b/zebra/rule_netlink.c
@@ -75,8 +75,6 @@ netlink_rule_msg_encode(int cmd, const struct zebra_dplane_ctx *ctx,
} *req = buf;
const char *ifname = dplane_ctx_rule_get_ifname(ctx);
- char buf1[PREFIX_STRLEN];
- char buf2[PREFIX_STRLEN];
if (buflen < sizeof(*req))
return 0;
@@ -141,11 +139,9 @@ netlink_rule_msg_encode(int cmd, const struct zebra_dplane_ctx *ctx,
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "Tx %s family %s IF %s Pref %u Fwmark %u Src %s Dst %s Table %u",
+ "Tx %s family %s IF %s Pref %u Fwmark %u Src %pFX Dst %pFX Table %u",
nl_msg_type_to_str(cmd), nl_family_to_str(family),
- ifname, priority, fwmark,
- prefix2str(src_ip, buf1, sizeof(buf1)),
- prefix2str(dst_ip, buf2, sizeof(buf2)), table);
+ ifname, priority, fwmark, src_ip, dst_ip, table);
return NLMSG_ALIGN(req->n.nlmsg_len);
}
@@ -231,8 +227,6 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
int len;
char *ifname;
struct zebra_pbr_rule rule = {};
- char buf1[PREFIX_STRLEN];
- char buf2[PREFIX_STRLEN];
uint8_t proto = 0;
/* Basic validation followed by extracting attributes. */
@@ -324,17 +318,14 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
ret = dplane_pbr_rule_delete(&rule);
zlog_debug(
- "%s: %s leftover rule: family %s IF %s Pref %u Src %s Dst %s Table %u",
+ "%s: %s leftover rule: family %s IF %s Pref %u Src %pFX Dst %pFX Table %u",
__func__,
((ret == ZEBRA_DPLANE_REQUEST_FAILURE)
? "Failed to remove"
: "Removed"),
nl_family_to_str(frh->family), rule.ifname,
- rule.rule.priority,
- prefix2str(&rule.rule.filter.src_ip, buf1,
- sizeof(buf1)),
- prefix2str(&rule.rule.filter.dst_ip, buf2,
- sizeof(buf2)),
+ rule.rule.priority, &rule.rule.filter.src_ip,
+ &rule.rule.filter.dst_ip,
rule.rule.action.table);
}
@@ -350,15 +341,11 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "Rx %s family %s IF %s Pref %u Src %s Dst %s Table %u",
+ "Rx %s family %s IF %s Pref %u Src %pFX Dst %pFX Table %u",
nl_msg_type_to_str(h->nlmsg_type),
nl_family_to_str(frh->family), rule.ifname,
- rule.rule.priority,
- prefix2str(&rule.rule.filter.src_ip, buf1,
- sizeof(buf1)),
- prefix2str(&rule.rule.filter.dst_ip, buf2,
- sizeof(buf2)),
- rule.rule.action.table);
+ rule.rule.priority, &rule.rule.filter.src_ip,
+ &rule.rule.filter.dst_ip, rule.rule.action.table);
return kernel_pbr_rule_del(&rule);
}
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index c33bca3d8..18017c970 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -644,17 +644,12 @@ int zsend_redistribute_route(int cmd, struct zserv *client,
return -1;
}
- if (IS_ZEBRA_DEBUG_SEND) {
- char buf_prefix[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
-
- zlog_debug("%s: %s to client %s: type %s, vrf_id %d, p %s",
+ if (IS_ZEBRA_DEBUG_SEND)
+ zlog_debug("%s: %s to client %s: type %s, vrf_id %d, p %pFX",
__func__, zserv_command_string(cmd),
zebra_route_string(client->proto),
zebra_route_string(api.type), api.vrf_id,
- buf_prefix);
- }
+ &api.prefix);
return zserv_send_message(client, s);
}
@@ -755,26 +750,18 @@ static int route_notify_internal(const struct prefix *p, int type,
client = zserv_find_client(type, instance);
if (!client || !client->notify_owner) {
- if (IS_ZEBRA_DEBUG_PACKET) {
- char buff[PREFIX_STRLEN];
-
+ if (IS_ZEBRA_DEBUG_PACKET)
zlog_debug(
- "Not Notifying Owner: %s about prefix %s(%u) %d vrf: %u",
- zebra_route_string(type),
- prefix2str(p, buff, sizeof(buff)), table_id,
- note, vrf_id);
- }
+ "Not Notifying Owner: %s about prefix %pFX(%u) %d vrf: %u",
+ zebra_route_string(type), p, table_id, note,
+ vrf_id);
return 0;
}
- if (IS_ZEBRA_DEBUG_PACKET) {
- char buff[PREFIX_STRLEN];
-
- zlog_debug("Notifying Owner: %s about prefix %s(%u) %d vrf: %u",
- zebra_route_string(type),
- prefix2str(p, buff, sizeof(buff)), table_id, note,
- vrf_id);
- }
+ if (IS_ZEBRA_DEBUG_PACKET)
+ zlog_debug(
+ "Notifying Owner: %s about prefix %pFX(%u) %d vrf: %u",
+ zebra_route_string(type), p, table_id, note, vrf_id);
s = stream_new(ZEBRA_MAX_PACKET_SIZ);
stream_reset(s);
@@ -1903,14 +1890,10 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
vrf_id = zvrf_id(zvrf);
- if (IS_ZEBRA_DEBUG_RECV) {
- char buf_prefix[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
- zlog_debug("%s: p=(%u:%u)%s, msg flags=0x%x, flags=0x%x",
- __func__, vrf_id, api.tableid, buf_prefix,
+ if (IS_ZEBRA_DEBUG_RECV)
+ zlog_debug("%s: p=(%u:%u)%pFX, msg flags=0x%x, flags=0x%x",
+ __func__, vrf_id, api.tableid, &api.prefix,
(int)api.message, api.flags);
- }
/* Allocate new route. */
re = XCALLOC(MTYPE_RE, sizeof(struct route_entry));
@@ -2068,14 +2051,10 @@ static void zread_route_del(ZAPI_HANDLER_ARGS)
else
table_id = zvrf->table_id;
- if (IS_ZEBRA_DEBUG_RECV) {
- char buf_prefix[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
- zlog_debug("%s: p=(%u:%u)%s, msg flags=0x%x, flags=0x%x",
- __func__, zvrf_id(zvrf), table_id, buf_prefix,
+ if (IS_ZEBRA_DEBUG_RECV)
+ zlog_debug("%s: p=(%u:%u)%pFX, msg flags=0x%x, flags=0x%x",
+ __func__, zvrf_id(zvrf), table_id, &api.prefix,
(int)api.message, api.flags);
- }
rib_delete(afi, api.safi, zvrf_id(zvrf), api.type, api.instance,
api.flags, &api.prefix, src_p, NULL, 0, table_id, api.metric,
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index 76d7d00e4..24e8db6f3 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -2224,20 +2224,14 @@ static int dplane_ctx_rule_init(struct zebra_dplane_ctx *ctx,
struct zebra_pbr_rule *new_rule,
struct zebra_pbr_rule *old_rule)
{
- if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) {
- char buf1[PREFIX_STRLEN];
- char buf2[PREFIX_STRLEN];
-
+ if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
zlog_debug(
- "init dplane ctx %s: IF %s Prio %u Fwmark %u Src %s Dst %s Table %u",
+ "init dplane ctx %s: IF %s Prio %u Fwmark %u Src %pFX Dst %pFX Table %u",
dplane_op2str(op), new_rule->ifname,
new_rule->rule.priority, new_rule->rule.filter.fwmark,
- prefix2str(&new_rule->rule.filter.src_ip, buf1,
- sizeof(buf1)),
- prefix2str(&new_rule->rule.filter.dst_ip, buf2,
- sizeof(buf2)),
+ &new_rule->rule.filter.src_ip,
+ &new_rule->rule.filter.dst_ip,
new_rule->rule.action.table);
- }
ctx->zd_op = op;
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
@@ -2895,15 +2889,10 @@ static enum zebra_dplane_result intf_addr_update_internal(
struct zebra_dplane_ctx *ctx = NULL;
struct zebra_ns *zns;
- if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) {
- char addr_str[PREFIX_STRLEN];
-
- prefix2str(ifc->address, addr_str, sizeof(addr_str));
-
- zlog_debug("init intf ctx %s: idx %d, addr %u:%s",
+ if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
+ zlog_debug("init intf ctx %s: idx %d, addr %u:%pFX",
dplane_op2str(op), ifp->ifindex, ifp->vrf_id,
- addr_str);
- }
+ ifc->address);
ctx = dplane_ctx_alloc();
@@ -3773,11 +3762,9 @@ static void kernel_dplane_log_detail(struct zebra_dplane_ctx *ctx)
case DPLANE_OP_ROUTE_INSTALL:
case DPLANE_OP_ROUTE_UPDATE:
case DPLANE_OP_ROUTE_DELETE:
- prefix2str(dplane_ctx_get_dest(ctx), buf, sizeof(buf));
-
- zlog_debug("%u:%s Dplane route update ctx %p op %s",
- dplane_ctx_get_vrf(ctx), buf, ctx,
- dplane_op2str(dplane_ctx_get_op(ctx)));
+ zlog_debug("%u:%pFX Dplane route update ctx %p op %s",
+ dplane_ctx_get_vrf(ctx), dplane_ctx_get_dest(ctx),
+ ctx, dplane_op2str(dplane_ctx_get_op(ctx)));
break;
case DPLANE_OP_NH_INSTALL:
@@ -3804,11 +3791,10 @@ static void kernel_dplane_log_detail(struct zebra_dplane_ctx *ctx)
case DPLANE_OP_ADDR_INSTALL:
case DPLANE_OP_ADDR_UNINSTALL:
- prefix2str(dplane_ctx_get_intf_addr(ctx), buf, sizeof(buf));
-
- zlog_debug("Dplane intf %s, idx %u, addr %s",
+ zlog_debug("Dplane intf %s, idx %u, addr %pFX",
dplane_op2str(dplane_ctx_get_op(ctx)),
- dplane_ctx_get_ifindex(ctx), buf);
+ dplane_ctx_get_ifindex(ctx),
+ dplane_ctx_get_intf_addr(ctx));
break;
case DPLANE_OP_MAC_INSTALL:
diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c
index 56699c4e8..e1dbd04de 100644
--- a/zebra/zebra_evpn.c
+++ b/zebra/zebra_evpn.c
@@ -349,7 +349,6 @@ static int ip_prefix_send_to_client(vrf_id_t vrf_id, struct prefix *p,
{
struct zserv *client = NULL;
struct stream *s = NULL;
- char buf[PREFIX_STRLEN];
client = zserv_find_client(ZEBRA_ROUTE_BGP, 0);
/* BGP may not be running. */
@@ -365,8 +364,7 @@ static int ip_prefix_send_to_client(vrf_id_t vrf_id, struct prefix *p,
stream_putw_at(s, 0, stream_get_endp(s));
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Send ip prefix %s %s on vrf %s",
- prefix2str(p, buf, sizeof(buf)),
+ zlog_debug("Send ip prefix %pFX %s on vrf %s", p,
(cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) ? "ADD" : "DEL",
vrf_id_to_name(vrf_id));
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index f84c8c1fc..1c3193449 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -1437,7 +1437,6 @@ static inline int zfpm_conn_is_up(void)
static int zfpm_trigger_update(struct route_node *rn, const char *reason)
{
rib_dest_t *dest;
- char buf[PREFIX_STRLEN];
/*
* Ignore if the connection is down. We will update the FPM about
@@ -1454,8 +1453,8 @@ static int zfpm_trigger_update(struct route_node *rn, const char *reason)
}
if (reason) {
- zfpm_debug("%s triggering update to FPM - Reason: %s",
- prefix2str(&rn->p, buf, sizeof(buf)), reason);
+ zfpm_debug("%pFX triggering update to FPM - Reason: %s", &rn->p,
+ reason);
}
SET_FLAG(dest->flags, RIB_DEST_UPDATE_FPM);
diff --git a/zebra/zebra_gr.c b/zebra/zebra_gr.c
index a4f32dbf3..ca6a33cd5 100644
--- a/zebra/zebra_gr.c
+++ b/zebra/zebra_gr.c
@@ -490,19 +490,15 @@ static void zebra_gr_process_route_entry(struct zserv *client,
struct route_node *rn,
struct route_entry *re)
{
- char buf[PREFIX2STR_BUFFER];
-
if ((client == NULL) || (rn == NULL) || (re == NULL))
return;
/* If the route is not refreshed after restart, delete the entry */
if (re->uptime < client->restart_time) {
- if (IS_ZEBRA_DEBUG_RIB) {
- prefix2str(&rn->p, buf, sizeof(buf));
- zlog_debug("%s: Client %s stale route %s is deleted",
+ if (IS_ZEBRA_DEBUG_RIB)
+ zlog_debug("%s: Client %s stale route %pFX is deleted",
__func__, zebra_route_string(client->proto),
- buf);
- }
+ &rn->p);
rib_delnode(rn, re);
}
}
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index e0ad4f1cb..c3982904e 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -2362,10 +2362,9 @@ int zebra_mpls_fec_unregister(struct zebra_vrf *zvrf, struct prefix *p,
fec = fec_find(table, p);
if (!fec) {
- prefix2str(p, buf, BUFSIZ);
flog_err(EC_ZEBRA_FEC_RM_FAILED,
- "Failed to find FEC %s upon unregister, client %s",
- buf, zebra_route_string(client->proto));
+ "Failed to find FEC %pFX upon unregister, client %s",
+ p, zebra_route_string(client->proto));
return -1;
}
@@ -2530,9 +2529,8 @@ int zebra_mpls_static_fec_add(struct zebra_vrf *zvrf, struct prefix *p,
fec = fec_add(table, p, in_label, FEC_FLAG_CONFIGURED,
MPLS_INVALID_LABEL_INDEX);
if (!fec) {
- prefix2str(p, buf, BUFSIZ);
flog_err(EC_ZEBRA_FEC_ADD_FAILED,
- "Failed to add FEC %s upon config", buf);
+ "Failed to add FEC %pFX upon config", p);
return -1;
}
@@ -2585,8 +2583,7 @@ int zebra_mpls_static_fec_del(struct zebra_vrf *zvrf, struct prefix *p)
}
if (IS_ZEBRA_DEBUG_MPLS) {
- prefix2str(p, buf, BUFSIZ);
- zlog_debug("Delete fec %s label %u label index %u", buf,
+ zlog_debug("Delete fec %pFX label %u label index %u", p,
fec->label, fec->label_index);
}
@@ -2620,7 +2617,6 @@ int zebra_mpls_write_fec_config(struct vty *vty, struct zebra_vrf *zvrf)
struct route_node *rn;
int af;
zebra_fec_t *fec;
- char buf[BUFSIZ];
int write = 0;
for (af = AFI_IP; af < AFI_MAX; af++) {
@@ -2639,8 +2635,7 @@ int zebra_mpls_write_fec_config(struct vty *vty, struct zebra_vrf *zvrf)
continue;
write = 1;
- prefix2str(&rn->p, buf, BUFSIZ);
- vty_out(vty, "mpls label bind %s %s\n", buf,
+ vty_out(vty, "mpls label bind %pFX %s\n", &rn->p,
label2str(fec->label, lstr, BUFSIZ));
}
}
@@ -2846,7 +2841,7 @@ int mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,
const struct zapi_labels *zl)
{
int i, counter, ret = 0;
- char buf[NEXTHOP_STRLEN], prefix_buf[PREFIX_STRLEN];
+ char buf[NEXTHOP_STRLEN];
const struct zapi_nexthop *znh;
struct route_table *table;
struct route_node *rn = NULL;
@@ -2910,12 +2905,10 @@ int mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,
* attempted to manage LSPs before trying to
* find a route/FEC, so we'll continue that way.
*/
- if (IS_ZEBRA_DEBUG_RECV || IS_ZEBRA_DEBUG_MPLS) {
- prefix2str(prefix, prefix_buf,
- sizeof(prefix_buf));
- zlog_debug("%s: FTN update requested: no route for prefix %s",
- __func__, prefix_buf);
- }
+ if (IS_ZEBRA_DEBUG_RECV || IS_ZEBRA_DEBUG_MPLS)
+ zlog_debug(
+ "%s: FTN update requested: no route for prefix %pFX",
+ __func__, prefix);
}
}
@@ -2957,9 +2950,9 @@ int mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,
counter++;
} else if (IS_ZEBRA_DEBUG_RECV | IS_ZEBRA_DEBUG_MPLS) {
zapi_nexthop2str(znh, buf, sizeof(buf));
- prefix2str(prefix, prefix_buf, sizeof(prefix_buf));
- zlog_debug("%s: Unable to update FEC: prefix %s, label %u, znh %s",
- __func__, prefix_buf, zl->local_label, buf);
+ zlog_debug(
+ "%s: Unable to update FEC: prefix %pFX, label %u, znh %s",
+ __func__, prefix, zl->local_label, buf);
}
}
@@ -3007,9 +3000,9 @@ int mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,
counter++;
} else if (IS_ZEBRA_DEBUG_RECV | IS_ZEBRA_DEBUG_MPLS) {
zapi_nexthop2str(znh, buf, sizeof(buf));
- prefix2str(prefix, prefix_buf, sizeof(prefix_buf));
- zlog_debug("%s: Unable to update backup FEC: prefix %s, label %u, znh %s",
- __func__, prefix_buf, zl->local_label, buf);
+ zlog_debug(
+ "%s: Unable to update backup FEC: prefix %pFX, label %u, znh %s",
+ __func__, prefix, zl->local_label, buf);
}
}
diff --git a/zebra/zebra_nb_config.c b/zebra/zebra_nb_config.c
index b4ed910b4..f5a85519b 100644
--- a/zebra/zebra_nb_config.c
+++ b/zebra/zebra_nb_config.c
@@ -21,6 +21,7 @@
#include "lib/log.h"
#include "lib/northbound.h"
+#include "lib/printfrr.h"
#include "libfrr.h"
#include "lib/command.h"
#include "lib/routemap.h"
@@ -839,7 +840,6 @@ int lib_interface_zebra_ip_addrs_create(struct nb_cb_create_args *args)
{
struct interface *ifp;
struct prefix prefix;
- char buf[PREFIX_STRLEN] = {0};
ifp = nb_running_get_entry(args->dnode, NULL, true);
// addr_family = yang_dnode_get_enum(dnode, "./address-family");
@@ -850,15 +850,13 @@ int lib_interface_zebra_ip_addrs_create(struct nb_cb_create_args *args)
case NB_EV_VALIDATE:
if (prefix.family == AF_INET
&& ipv4_martian(&prefix.u.prefix4)) {
- snprintf(args->errmsg, args->errmsg_len,
- "invalid address %s",
- prefix2str(&prefix, buf, sizeof(buf)));
+ snprintfrr(args->errmsg, args->errmsg_len,
+ "invalid address %pFX", &prefix);
return NB_ERR_VALIDATION;
} else if (prefix.family == AF_INET6
&& ipv6_martian(&prefix.u.prefix6)) {
- snprintf(args->errmsg, args->errmsg_len,
- "invalid address %s",
- prefix2str(&prefix, buf, sizeof(buf)));
+ snprintfrr(args->errmsg, args->errmsg_len,
+ "invalid address %pFX", &prefix);
return NB_ERR_VALIDATION;
}
break;
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 166d479d7..730042b72 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -694,15 +694,13 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq)
if (IS_ZEBRA_DEBUG_NHT_DETAILED) {
char buf1[PREFIX_STRLEN];
- char buf2[PREFIX_STRLEN];
zlog_debug(
- "%s(%u):%s has Nexthop(%s) Type: %s depending on it, evaluating %u:%u",
+ "%s(%u):%s has Nexthop(%pFX) Type: %s depending on it, evaluating %u:%u",
zvrf_name(zvrf), zvrf_id(zvrf),
srcdest_rnode2str(rn, buf1,
sizeof(buf1)),
- prefix2str(p, buf2, sizeof(buf2)),
- rnh_type2str(rnh->type), seq,
+ p, rnh_type2str(rnh->type), seq,
rnh->seqno);
}
@@ -1924,11 +1922,9 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)
zsend_route_notify_owner(re, dest_pfx,
ZAPI_ROUTE_FAIL_INSTALL);
- zlog_warn("%s(%u:%u):%s: Route install failed",
+ zlog_warn("%s(%u:%u):%pFX: Route install failed",
VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx),
- dplane_ctx_get_table(ctx),
- prefix2str(dest_pfx, dest_str,
- sizeof(dest_str)));
+ dplane_ctx_get_table(ctx), dest_pfx);
}
break;
case DPLANE_OP_ROUTE_DELETE:
@@ -1954,11 +1950,9 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)
zsend_route_notify_owner_ctx(ctx,
ZAPI_ROUTE_REMOVE_FAIL);
- zlog_warn("%s(%u:%u):%s: Route Deletion failure",
+ zlog_warn("%s(%u:%u):%pFX: Route Deletion failure",
VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx),
- dplane_ctx_get_table(ctx),
- prefix2str(dest_pfx, dest_str,
- sizeof(dest_str)));
+ dplane_ctx_get_table(ctx), dest_pfx);
}
/*
@@ -2831,7 +2825,6 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id)
struct route_node *rn;
struct route_entry *re;
struct vrf *vrf;
- char prefix_buf[INET_ADDRSTRLEN];
vrf = vrf_lookup_by_id(vrf_id);
@@ -2849,10 +2842,8 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id)
/* No route for this prefix. */
if (!rn) {
- zlog_debug("%s:%s(%u) lookup failed for %s", __func__,
- VRF_LOGNAME(vrf), vrf_id,
- prefix2str((struct prefix *)p, prefix_buf,
- sizeof(prefix_buf)));
+ zlog_debug("%s:%s(%u) lookup failed for %pFX", __func__,
+ VRF_LOGNAME(vrf), vrf_id, (struct prefix *)p);
return;
}
@@ -2911,14 +2902,13 @@ void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id)
*/
if (dest->selected_fib) {
if (IS_ZEBRA_DEBUG_RIB) {
- char buf[PREFIX_STRLEN];
struct vrf *vrf =
vrf_lookup_by_id(dest->selected_fib->vrf_id);
zlog_debug(
- "%s(%u):%s: freeing way for connected prefix",
+ "%s(%u):%pFX: freeing way for connected prefix",
VRF_LOGNAME(vrf), dest->selected_fib->vrf_id,
- prefix2str(&rn->p, buf, sizeof(buf)));
+ &rn->p);
route_entry_dump(&rn->p, NULL, dest->selected_fib);
}
rib_uninstall(rn, dest->selected_fib);
@@ -2969,14 +2959,12 @@ int rib_add_multipath_nhe(afi_t afi, safi_t safi, struct prefix *p,
/* Lookup nhe from route information */
nhe = zebra_nhg_rib_find_nhe(re_nhe, afi);
if (!nhe) {
- char buf[PREFIX_STRLEN] = "";
char buf2[PREFIX_STRLEN] = "";
flog_err(
EC_ZEBRA_TABLE_LOOKUP_FAILED,
- "Zebra failed to find or create a nexthop hash entry for %s%s%s",
- prefix2str(p, buf, sizeof(buf)),
- src_p ? " from " : "",
+ "Zebra failed to find or create a nexthop hash entry for %pFX%s%s",
+ p, src_p ? " from " : "",
src_p ? prefix2str(src_p, buf2, sizeof(buf2))
: "");
@@ -3116,9 +3104,8 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
/* Lookup route node. */
rn = srcdest_rnode_lookup(table, p, src_p);
if (!rn) {
- char dst_buf[PREFIX_STRLEN], src_buf[PREFIX_STRLEN];
+ char src_buf[PREFIX_STRLEN];
- prefix2str(p, dst_buf, sizeof(dst_buf));
if (src_p && src_p->prefixlen)
prefix2str(src_p, src_buf, sizeof(src_buf));
else
@@ -3127,8 +3114,8 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
if (IS_ZEBRA_DEBUG_RIB) {
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
- zlog_debug("%s[%d]:%s%s%s doesn't exist in rib",
- vrf->name, table_id, dst_buf,
+ zlog_debug("%s[%d]:%pFX%s%s doesn't exist in rib",
+ vrf->name, table_id, p,
(src_buf[0] != '\0') ? " from " : "",
src_buf);
}
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 9c6ed4458..8178629b0 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -480,7 +480,6 @@ static void zebra_rnh_eval_import_check_entry(struct zebra_vrf *zvrf, afi_t afi,
{
int state_changed = 0;
struct zserv *client;
- char bufn[INET6_ADDRSTRLEN];
struct listnode *node;
zebra_rnh_remove_from_routing_table(rnh);
@@ -506,13 +505,11 @@ static void zebra_rnh_eval_import_check_entry(struct zebra_vrf *zvrf, afi_t afi,
}
if (state_changed || force) {
- if (IS_ZEBRA_DEBUG_NHT) {
- prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
+ if (IS_ZEBRA_DEBUG_NHT)
zlog_debug("%s(%u):%pRN: Route import check %s %s",
VRF_LOGNAME(zvrf->vrf), zvrf->vrf->vrf_id,
nrn, rnh->state ? "passed" : "failed",
state_changed ? "(state changed)" : "");
- }
/* state changed, notify clients */
for (ALL_LIST_ELEMENTS_RO(rnh->client_list, node, client)) {
zebra_send_rnh_update(rnh, client,
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 82e871801..f8b65bea1 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -310,8 +310,7 @@ static void zl3vni_print_nh(zebra_neigh_t *n, struct vty *vty,
rb_host_count(&n->host_rb));
vty_out(vty, " Prefixes:\n");
RB_FOREACH (hle, host_rb_tree_entry, &n->host_rb)
- vty_out(vty, " %s\n",
- prefix2str(&hle->p, buf2, sizeof(buf2)));
+ vty_out(vty, " %pFX\n", &hle->p);
} else {
json_hosts = json_object_new_array();
json_object_string_add(
@@ -346,8 +345,7 @@ static void zl3vni_print_rmac(zebra_mac_t *zrmac, struct vty *vty,
vty_out(vty, " Refcount: %d\n", rb_host_count(&zrmac->host_rb));
vty_out(vty, " Prefixes:\n");
RB_FOREACH (hle, host_rb_tree_entry, &zrmac->host_rb)
- vty_out(vty, " %s\n",
- prefix2str(&hle->p, buf2, sizeof(buf2)));
+ vty_out(vty, " %pFX\n", &hle->p);
} else {
json_hosts = json_object_new_array();
json_object_string_add(
@@ -1270,7 +1268,6 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni,
{
char buf[ETHER_ADDR_STRLEN];
char buf1[INET6_ADDRSTRLEN];
- char buf2[PREFIX_STRLEN];
zebra_mac_t *zrmac = NULL;
zrmac = zl3vni_rmac_lookup(zl3vni, rmac);
@@ -1280,11 +1277,11 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni,
zrmac = zl3vni_rmac_add(zl3vni, rmac);
if (!zrmac) {
zlog_debug(
- "Failed to add RMAC %s L3VNI %u Remote VTEP %s, prefix %s",
+ "Failed to add RMAC %s L3VNI %u Remote VTEP %s, prefix %pFX",
prefix_mac2str(rmac, buf, sizeof(buf)),
zl3vni->vni,
ipaddr2str(vtep_ip, buf1, sizeof(buf1)),
- prefix2str(host_prefix, buf2, sizeof(buf2)));
+ host_prefix);
return -1;
}
memset(&zrmac->fwd_info, 0, sizeof(zrmac->fwd_info));
@@ -1300,12 +1297,12 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni,
&vtep_ip->ipaddr_v4)) {
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
- "L3VNI %u Remote VTEP change(%s -> %s) for RMAC %s, prefix %s",
+ "L3VNI %u Remote VTEP change(%s -> %s) for RMAC %s, prefix %pFX",
zl3vni->vni,
inet_ntoa(zrmac->fwd_info.r_vtep_ip),
ipaddr2str(vtep_ip, buf1, sizeof(buf1)),
prefix_mac2str(rmac, buf, sizeof(buf)),
- prefix2str(host_prefix, buf2, sizeof(buf2)));
+ host_prefix);
zrmac->fwd_info.r_vtep_ip = vtep_ip->ipaddr_v4;
@@ -1465,7 +1462,6 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni,
char buf[ETHER_ADDR_STRLEN];
char buf1[ETHER_ADDR_STRLEN];
char buf2[INET6_ADDRSTRLEN];
- char buf3[PREFIX_STRLEN];
zebra_neigh_t *nh = NULL;
/* Create the next hop entry, or update its mac, if necessary. */
@@ -1474,11 +1470,10 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni,
nh = zl3vni_nh_add(zl3vni, vtep_ip, rmac);
if (!nh) {
zlog_debug(
- "Failed to add NH %s as Neigh (RMAC %s L3-VNI %u prefix %s)",
+ "Failed to add NH %s as Neigh (RMAC %s L3-VNI %u prefix %pFX)",
ipaddr2str(vtep_ip, buf1, sizeof(buf2)),
prefix_mac2str(rmac, buf, sizeof(buf)),
- zl3vni->vni,
- prefix2str(host_prefix, buf2, sizeof(buf2)));
+ zl3vni->vni, host_prefix);
return -1;
}
@@ -1486,12 +1481,13 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni,
zl3vni_nh_install(zl3vni, nh);
} else if (memcmp(&nh->emac, rmac, ETH_ALEN) != 0) {
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("L3VNI %u RMAC change(%s --> %s) for nexthop %s, prefix %s",
- zl3vni->vni,
- prefix_mac2str(&nh->emac, buf, sizeof(buf)),
- prefix_mac2str(rmac, buf1, sizeof(buf1)),
- ipaddr2str(vtep_ip, buf2, sizeof(buf2)),
- prefix2str(host_prefix, buf3, sizeof(buf3)));
+ zlog_debug(
+ "L3VNI %u RMAC change(%s --> %s) for nexthop %s, prefix %pFX",
+ zl3vni->vni,
+ prefix_mac2str(&nh->emac, buf, sizeof(buf)),
+ prefix_mac2str(rmac, buf1, sizeof(buf1)),
+ ipaddr2str(vtep_ip, buf2, sizeof(buf2)),
+ host_prefix);
memcpy(&nh->emac, rmac, ETH_ALEN);
/* install (update) the nh neigh in kernel */
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 44f4641fc..4b5791530 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -1172,11 +1172,9 @@ static void zebra_show_stale_client_detail(struct vty *vty,
}
}
vty_out(vty, "Current AFI : %d\n", info->current_afi);
- if (info->current_prefix) {
- prefix2str(info->current_prefix, buf,
- sizeof(buf));
- vty_out(vty, "Current prefix : %s\n", buf);
- }
+ if (info->current_prefix)
+ vty_out(vty, "Current prefix : %pFX\n",
+ info->current_prefix);
}
}
vty_out(vty, "\n");