:* Convert prefix2str to %pFX

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
Donatas Abraitis 2020-10-18 14:33:54 +03:00
parent 719e0a6a6c
commit 2dbe669bdf
90 changed files with 862 additions and 1676 deletions

View File

@ -783,17 +783,16 @@ static void bfdd_sessions_enable_address(struct connected *ifc)
static int bfdd_interface_address_update(ZAPI_CALLBACK_ARGS) static int bfdd_interface_address_update(ZAPI_CALLBACK_ARGS)
{ {
struct connected *ifc; struct connected *ifc;
char buf[64];
ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (ifc == NULL) if (ifc == NULL)
return 0; return 0;
if (bglobal.debug_zebra) if (bglobal.debug_zebra)
zlog_debug("zclient: %s local address %s", zlog_debug("zclient: %s local address %pFX",
cmd == ZEBRA_INTERFACE_ADDRESS_ADD ? "add" cmd == ZEBRA_INTERFACE_ADDRESS_ADD ? "add"
: "delete", : "delete",
prefix2str(ifc->address, buf, sizeof(buf))); ifc->address);
bfdd_sessions_enable_address(ifc); bfdd_sessions_enable_address(ifc);

View File

@ -385,24 +385,21 @@ static int bgp_bfd_dest_update(ZAPI_CALLBACK_ARGS)
if (BGP_DEBUG(zebra, ZEBRA)) { if (BGP_DEBUG(zebra, ZEBRA)) {
struct vrf *vrf; struct vrf *vrf;
char buf[2][PREFIX2STR_BUFFER];
vrf = vrf_lookup_by_id(vrf_id); vrf = vrf_lookup_by_id(vrf_id);
prefix2str(&dp, buf[0], sizeof(buf[0]));
if (ifp) { if (ifp)
zlog_debug( zlog_debug(
"Zebra: vrf %s(%u) interface %s bfd destination %s %s %s", "Zebra: vrf %s(%u) interface %s bfd destination %pFX %s %s",
VRF_LOGNAME(vrf), vrf_id, ifp->name, VRF_LOGNAME(vrf), vrf_id, ifp->name, &dp,
buf[0], bfd_get_status_str(status), bfd_get_status_str(status),
remote_cbit ? "(cbit on)" : ""); remote_cbit ? "(cbit on)" : "");
} else { else
prefix2str(&sp, buf[1], sizeof(buf[1])); zlog_debug(
zlog_debug( "Zebra: vrf %s(%u) source %pFX bfd destination %pFX %s %s",
"Zebra: vrf %s(%u) source %s bfd destination %s %s %s", VRF_LOGNAME(vrf), vrf_id, &sp, &dp,
VRF_LOGNAME(vrf), vrf_id, buf[1], buf[0],
bfd_get_status_str(status), bfd_get_status_str(status),
remote_cbit ? "(cbit on)" : ""); remote_cbit ? "(cbit on)" : "");
}
} }
/* Bring the peer down if BFD is enabled in BGP */ /* Bring the peer down if BFD is enabled in BGP */

View File

@ -237,7 +237,6 @@ static void bgp_debug_list_print(struct vty *vty, const char *desc,
{ {
struct bgp_debug_filter *filter; struct bgp_debug_filter *filter;
struct listnode *node, *nnode; struct listnode *node, *nnode;
char buf[PREFIX2STR_BUFFER];
vty_out(vty, "%s", desc); 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) if (filter->p && filter->p->family == AF_EVPN)
bgp_debug_print_evpn_prefix(vty, "", filter->p); bgp_debug_print_evpn_prefix(vty, "", filter->p);
else if (filter->p) { else if (filter->p)
prefix2str(filter->p, buf, sizeof(buf)); vty_out(vty, " %pFX", filter->p);
vty_out(vty, " %s", buf);
}
} }
} }
@ -268,7 +265,6 @@ static int bgp_debug_list_conf_print(struct vty *vty, const char *desc,
{ {
struct bgp_debug_filter *filter; struct bgp_debug_filter *filter;
struct listnode *node, *nnode; struct listnode *node, *nnode;
char buf[PREFIX2STR_BUFFER];
int write = 0; int write = 0;
if (list && !list_isempty(list)) { if (list && !list_isempty(list)) {
@ -283,8 +279,7 @@ static int bgp_debug_list_conf_print(struct vty *vty, const char *desc,
filter->p); filter->p);
write++; write++;
} else if (filter->p) { } else if (filter->p) {
prefix2str(filter->p, buf, sizeof(buf)); vty_out(vty, "%s %pFX\n", desc, filter->p);
vty_out(vty, "%s %s\n", desc, buf);
write++; write++;
} }
} }
@ -1416,7 +1411,6 @@ DEFPY (debug_bgp_update_prefix_afi_safi,
{ {
struct prefix *argv_p; struct prefix *argv_p;
int ret = CMD_SUCCESS; int ret = CMD_SUCCESS;
char buf[PREFIX2STR_BUFFER];
argv_p = prefix_new(); argv_p = prefix_new();
@ -1429,12 +1423,10 @@ DEFPY (debug_bgp_update_prefix_afi_safi,
if (!bgp_debug_update_prefixes) if (!bgp_debug_update_prefixes)
bgp_debug_update_prefixes = list_new(); 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)) { if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL, argv_p)) {
vty_out(vty, vty_out(vty,
"BGP updates debugging is already enabled for %s\n", "BGP updates debugging is already enabled for %pFX\n",
buf); argv_p);
prefix_free(&argv_p); prefix_free(&argv_p);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -1445,7 +1437,7 @@ DEFPY (debug_bgp_update_prefix_afi_safi,
DEBUG_ON(update, UPDATE_PREFIX); DEBUG_ON(update, UPDATE_PREFIX);
} else { } else {
TERM_DEBUG_ON(update, UPDATE_PREFIX); 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); prefix_free(&argv_p);
@ -1484,7 +1476,6 @@ DEFPY (no_debug_bgp_update_prefix_afi_safi,
struct prefix *argv_p; struct prefix *argv_p;
bool found_prefix = false; bool found_prefix = false;
int ret = CMD_SUCCESS; int ret = CMD_SUCCESS;
char buf[PREFIX2STR_BUFFER];
argv_p = prefix_new(); 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) 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 else
vty_out(vty, "BGP updates debugging was not enabled for %s\n", vty_out(vty, "BGP updates debugging was not enabled for %pFX\n",
buf); argv_p);
prefix_free(&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 *str, int size)
{ {
char rd_buf[RD_ADDRSTRLEN]; char rd_buf[RD_ADDRSTRLEN];
char pfx_buf[PREFIX_STRLEN];
char tag_buf[30]; char tag_buf[30];
/* ' with addpath ID ' 17 /* ' with addpath ID ' 17
* max strlen of uint32 + 10 * max strlen of uint32 + 10
@ -2681,10 +2669,9 @@ const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi,
} }
if (prd) if (prd)
snprintf(str, size, "RD %s %s%s%s %s %s", snprintfrr(str, size, "RD %s %pFX%s%s %s %s",
prefix_rd2str(prd, rd_buf, sizeof(rd_buf)), prefix_rd2str(prd, rd_buf, sizeof(rd_buf)), pu.p,
prefix2str(pu, pfx_buf, sizeof(pfx_buf)), tag_buf, tag_buf, pathid_buf, afi2str(afi), safi2str(safi));
pathid_buf, afi2str(afi), safi2str(safi));
else if (safi == SAFI_FLOWSPEC) { else if (safi == SAFI_FLOWSPEC) {
char return_string[BGP_FLOWSPEC_NLRI_STRING_MAX]; char return_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
const struct prefix_fs *fs = pu.fs; 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), snprintf(str, size, "FS %s Match{%s}", afi2str(afi),
return_string); return_string);
} else } else
snprintf(str, size, "%s%s%s %s %s", snprintfrr(str, size, "%pFX%s%s %s %s", pu.p, tag_buf,
prefix2str(pu, pfx_buf, sizeof(pfx_buf)), tag_buf, pathid_buf, afi2str(afi), safi2str(safi));
pathid_buf, afi2str(afi), safi2str(safi));
return str; return str;
} }

View File

@ -1034,19 +1034,17 @@ static void evpn_delete_old_local_route(struct bgp *bgp, struct bgpevpn *vpn,
safi_t safi = SAFI_EVPN; safi_t safi = SAFI_EVPN;
if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) { if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) {
char prefix_buf[PREFIX_STRLEN];
char esi_buf[ESI_STR_LEN]; char esi_buf[ESI_STR_LEN];
char esi_buf2[ESI_STR_LEN]; char esi_buf2[ESI_STR_LEN];
struct prefix_evpn *evp = struct prefix_evpn *evp =
(struct prefix_evpn *)bgp_dest_get_prefix(dest); (struct prefix_evpn *)bgp_dest_get_prefix(dest);
zlog_debug("local path deleted %s es %s; new-path-es %s", zlog_debug("local path deleted %pFX es %s; new-path-es %s", evp,
prefix2str(evp, esi_to_str(&old_local->attr->esi, esi_buf,
prefix_buf, sizeof(prefix_buf)), sizeof(esi_buf)),
esi_to_str(&old_local->attr->esi, new_select ? esi_to_str(&new_select->attr->esi,
esi_buf, sizeof(esi_buf)), esi_buf2, sizeof(esi_buf2))
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 /* 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.nexthop = bgp_vrf->evpn_info->pip_ip;
attr.mp_nexthop_global_in = 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) } else if (bgp_vrf->evpn_info->pip_ip.s_addr == INADDR_ANY)
if (bgp_debug_zebra(NULL)) { if (bgp_debug_zebra(NULL))
char buf1[PREFIX_STRLEN]; zlog_debug(
"VRF %s evp %pFX advertise-pip primary ip is not configured",
zlog_debug("VRF %s evp %s advertise-pip primary ip is not configured", vrf_id_to_name(bgp_vrf->vrf_id), evp);
vrf_id_to_name(bgp_vrf->vrf_id),
prefix2str(evp, buf1, sizeof(buf1)));
}
} }
if (bgp_debug_zebra(NULL)) { if (bgp_debug_zebra(NULL)) {
char buf[ETHER_ADDR_STRLEN]; char buf[ETHER_ADDR_STRLEN];
char buf1[PREFIX_STRLEN];
char buf2[INET6_ADDRSTRLEN]; char buf2[INET6_ADDRSTRLEN];
zlog_debug("VRF %s type-5 route evp %s RMAC %s nexthop %s", zlog_debug("VRF %s type-5 route evp %pFX RMAC %s nexthop %s",
vrf_id_to_name(bgp_vrf->vrf_id), vrf_id_to_name(bgp_vrf->vrf_id), evp,
prefix2str(evp, buf1, sizeof(buf1)),
prefix_mac2str(&attr.rmac, buf, sizeof(buf)), prefix_mac2str(&attr.rmac, buf, sizeof(buf)),
inet_ntop(AF_INET, &attr.nexthop, buf2, inet_ntop(AF_INET, &attr.nexthop, buf2,
INET_ADDRSTRLEN)); INET_ADDRSTRLEN));
@ -1461,21 +1454,23 @@ static void update_evpn_route_entry_sync_info(struct bgp *bgp,
attr->es_flags &= ~ATTR_ES_PEER_ROUTER; attr->es_flags &= ~ATTR_ES_PEER_ROUTER;
if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) { if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) {
char prefix_buf[PREFIX_STRLEN];
char esi_buf[ESI_STR_LEN]; char esi_buf[ESI_STR_LEN];
zlog_debug("setup sync info for %s es %s max_seq %d %s%s%s", zlog_debug(
prefix2str(evp, prefix_buf, "setup sync info for %pFX es %s max_seq %d %s%s%s",
sizeof(prefix_buf)), evp,
esi_to_str(esi, esi_buf, esi_to_str(esi, esi_buf,
sizeof(esi_buf)), sizeof(esi_buf)),
max_sync_seq, max_sync_seq,
(attr->es_flags & ATTR_ES_PEER_ACTIVE) ? (attr->es_flags & ATTR_ES_PEER_ACTIVE)
"peer-active " : "", ? "peer-active "
(attr->es_flags & ATTR_ES_PEER_PROXY) ? : "",
"peer-proxy " : "", (attr->es_flags & ATTR_ES_PEER_PROXY)
(attr->es_flags & ATTR_ES_PEER_ROUTER) ? ? "peer-proxy "
"peer-router " : ""); : "",
(attr->es_flags & ATTR_ES_PEER_ROUTER)
? "peer-router "
: "");
} }
} }
} else { } else {
@ -1721,14 +1716,13 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
if (bgp_debug_zebra(NULL)) { if (bgp_debug_zebra(NULL)) {
char buf[ETHER_ADDR_STRLEN]; char buf[ETHER_ADDR_STRLEN];
char buf1[PREFIX_STRLEN];
char buf3[ESI_STR_LEN]; char buf3[ESI_STR_LEN];
zlog_debug( 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->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)), prefix_mac2str(&attr.rmac, buf, sizeof(buf)),
&attr.mp_nexthop_global_in, &attr.mp_nexthop_global_in,
esi_to_str(esi, buf3, sizeof(buf3))); 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)) { if (bgp_debug_zebra(NULL)) {
char buf[ETHER_ADDR_STRLEN]; char buf[ETHER_ADDR_STRLEN];
char buf1[PREFIX_STRLEN];
char buf3[ESI_STR_LEN]; char buf3[ESI_STR_LEN];
zlog_debug( 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->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)), prefix_mac2str(&attr.rmac, buf, sizeof(buf)),
&attr.mp_nexthop_global_in, &attr.mp_nexthop_global_in,
esi_to_str(&attr.esi, buf3, sizeof(buf3)), 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; struct prefix *pp = &p;
afi_t afi = 0; afi_t afi = 0;
safi_t safi = 0; safi_t safi = 0;
char buf[PREFIX_STRLEN];
bool new_pi = false; bool new_pi = false;
memset(pp, 0, sizeof(struct prefix)); memset(pp, 0, sizeof(struct prefix));
ip_prefix_from_evpn_prefix(evp, pp); ip_prefix_from_evpn_prefix(evp, pp);
if (bgp_debug_zebra(NULL)) { if (bgp_debug_zebra(NULL))
zlog_debug( zlog_debug(
"vrf %s: import evpn prefix %s parent %p flags 0x%x", "vrf %s: import evpn prefix %pFX parent %p flags 0x%x",
vrf_id_to_name(bgp_vrf->vrf_id), vrf_id_to_name(bgp_vrf->vrf_id), evp, parent_pi,
prefix2str(evp, buf, sizeof(buf)), parent_pi->flags);
parent_pi, parent_pi->flags);
}
/* Create (or fetch) route within the VRF. */ /* Create (or fetch) route within the VRF. */
/* NOTE: There is no RD here. */ /* 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; struct prefix *pp = &p;
afi_t afi = 0; afi_t afi = 0;
safi_t safi = 0; safi_t safi = 0;
char buf[PREFIX_STRLEN];
memset(pp, 0, sizeof(struct prefix)); memset(pp, 0, sizeof(struct prefix));
ip_prefix_from_evpn_prefix(evp, pp); ip_prefix_from_evpn_prefix(evp, pp);
if (bgp_debug_zebra(NULL)) { if (bgp_debug_zebra(NULL))
zlog_debug( zlog_debug(
"vrf %s: unimport evpn prefix %s parent %p flags 0x%x", "vrf %s: unimport evpn prefix %pFX parent %p flags 0x%x",
vrf_id_to_name(bgp_vrf->vrf_id), vrf_id_to_name(bgp_vrf->vrf_id), evp, parent_pi,
prefix2str(evp, buf, sizeof(buf)), parent_pi->flags);
parent_pi, parent_pi->flags);
}
/* Locate route within the VRF. */ /* Locate route within the VRF. */
/* NOTE: There is no RD here. */ /* 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 (memcmp(&bgp_vrf->rmac, &pi->attr->rmac, ETH_ALEN) == 0) {
if (bgp_debug_update(pi->peer, NULL, NULL, 1)) { if (bgp_debug_update(pi->peer, NULL, NULL, 1)) {
char buf1[PREFIX_STRLEN];
char attr_str[BUFSIZ] = {0}; char attr_str[BUFSIZ] = {0};
bgp_dump_attr(pi->attr, attr_str, sizeof(attr_str)); 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", zlog_debug(
__func__, bgp_vrf->vrf_id, "%s: bgp %u prefix %pFX with attr %s - DENIED due to self mac",
prefix2str(evp, buf1, sizeof(buf1)), __func__, bgp_vrf->vrf_id, evp, attr_str);
attr_str);
} }
return 1; 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_table *table;
struct bgp_path_info *pi; struct bgp_path_info *pi;
int ret; int ret;
char buf[PREFIX_STRLEN];
struct bgp *bgp_evpn = NULL; struct bgp *bgp_evpn = NULL;
afi = AFI_L2VPN; afi = AFI_L2VPN;
@ -2940,11 +2924,10 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install)
if (ret) { if (ret) {
flog_err( flog_err(
EC_BGP_EVPN_FAIL, EC_BGP_EVPN_FAIL,
"Failed to %s EVPN %s route in VRF %s", "Failed to %s EVPN %pFX route in VRF %s",
install ? "install" install ? "install"
: "uninstall", : "uninstall",
prefix2str(evp, buf, evp,
sizeof(buf)),
vrf_id_to_name( vrf_id_to_name(
bgp_vrf->vrf_id)); bgp_vrf->vrf_id));
return ret; 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 bgp_path_info *pi,
struct list *vrfs, int install) struct list *vrfs, int install)
{ {
char buf[PREFIX2STR_BUFFER];
struct bgp *bgp_vrf; struct bgp *bgp_vrf;
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -3139,10 +3121,9 @@ static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi,
if (ret) { if (ret) {
flog_err(EC_BGP_EVPN_FAIL, 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, bgp_def->vrf_id,
install ? "install" : "uninstall", install ? "install" : "uninstall", evp,
prefix2str(evp, buf, sizeof(buf)),
vrf_id_to_name(bgp_vrf->vrf_id)); vrf_id_to_name(bgp_vrf->vrf_id));
return ret; return ret;
} }
@ -4100,17 +4081,14 @@ void bgp_evpn_withdraw_type5_route(struct bgp *bgp_vrf, const struct prefix *p,
{ {
int ret = 0; int ret = 0;
struct prefix_evpn evp; struct prefix_evpn evp;
char buf[PREFIX_STRLEN];
build_type5_prefix_from_ip_prefix(&evp, p); build_type5_prefix_from_ip_prefix(&evp, p);
ret = delete_evpn_type5_route(bgp_vrf, &evp); ret = delete_evpn_type5_route(bgp_vrf, &evp);
if (ret) { if (ret)
flog_err( flog_err(
EC_BGP_EVPN_ROUTE_DELETE, EC_BGP_EVPN_ROUTE_DELETE,
"%u failed to delete type-5 route for prefix %s in vrf %s", "%u failed to delete type-5 route for prefix %pFX in vrf %s",
bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)), bgp_vrf->vrf_id, p, vrf_id_to_name(bgp_vrf->vrf_id));
vrf_id_to_name(bgp_vrf->vrf_id));
}
} }
/* withdraw all type-5 routes for an address family */ /* 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; int ret = 0;
struct prefix_evpn evp; struct prefix_evpn evp;
char buf[PREFIX_STRLEN];
build_type5_prefix_from_ip_prefix(&evp, p); build_type5_prefix_from_ip_prefix(&evp, p);
ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr); ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr);
if (ret) if (ret)
flog_err(EC_BGP_EVPN_ROUTE_CREATE, flog_err(EC_BGP_EVPN_ROUTE_CREATE,
"%u: Failed to create type-5 route for prefix %s", "%u: Failed to create type-5 route for prefix %pFX",
bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf))); bgp_vrf->vrf_id, p);
} }
/* Inject all prefixes of a particular address-family (currently, IPv4 or /* Inject all prefixes of a particular address-family (currently, IPv4 or

View File

@ -699,7 +699,6 @@ static int bgp_evpn_type4_remote_routes_import(struct bgp *bgp,
int ret; int ret;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
char buf[PREFIX_STRLEN];
struct bgp_dest *rd_dest, *dest; struct bgp_dest *rd_dest, *dest;
struct bgp_table *table; struct bgp_table *table;
struct bgp_path_info *pi; struct bgp_path_info *pi;
@ -744,13 +743,11 @@ static int bgp_evpn_type4_remote_routes_import(struct bgp *bgp,
if (ret) { if (ret) {
flog_err( flog_err(
EC_BGP_EVPN_FAIL, EC_BGP_EVPN_FAIL,
"Failed to %s EVPN %s route in ESI %s", "Failed to %s EVPN %pFX route in ESI %s",
install ? "install" install ? "install"
: "uninstall", : "uninstall",
prefix2str(evp, buf, evp, es->esi_str);
sizeof(buf)),
es->esi_str);
return ret; return ret;
} }
} }

View File

@ -20,6 +20,8 @@
#include "zebra.h" #include "zebra.h"
#include "lib/printfrr.h"
#include "prefix.h" #include "prefix.h"
#include "lib_errors.h" #include "lib_errors.h"
@ -211,14 +213,11 @@ int bgp_flowspec_ip_address(enum bgp_flowspec_util_nlri_t type,
switch (type) { switch (type) {
case BGP_FLOWSPEC_RETURN_STRING: case BGP_FLOWSPEC_RETURN_STRING:
if (prefix_local.family == AF_INET6) { if (prefix_local.family == AF_INET6) {
char str[BGP_FLOWSPEC_STRING_DISPLAY_MAX];
int ret; int ret;
prefix2str(&prefix_local, str, ret = snprintfrr(
BGP_FLOWSPEC_STRING_DISPLAY_MAX); display, BGP_FLOWSPEC_STRING_DISPLAY_MAX,
ret = snprintf(display, BGP_FLOWSPEC_STRING_DISPLAY_MAX, "%pFX/off %u", &prefix_local, prefix_offset);
"%s/off %u",
str, prefix_offset);
if (ret < 0) { if (ret < 0) {
*error = -1; *error = -1;
break; break;

View File

@ -215,7 +215,6 @@ void bgp_reg_dereg_for_label(struct bgp_dest *dest, struct bgp_path_info *pi,
int command; int command;
uint16_t flags = 0; uint16_t flags = 0;
size_t flags_pos = 0; size_t flags_pos = 0;
char addr[PREFIX_STRLEN];
p = bgp_dest_get_prefix(dest); p = bgp_dest_get_prefix(dest);
local_label = &(dest->local_label); 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. * always takes precedence over auto-assigned labels.
*/ */
if (!have_label_to_reg) { if (!have_label_to_reg) {
if (BGP_DEBUG(labelpool, LABELPOOL)) { if (BGP_DEBUG(labelpool, LABELPOOL))
prefix2str(p, addr, PREFIX_STRLEN); zlog_debug(
zlog_debug("%s: Requesting label from LP for %s", "%s: Requesting label from LP for %pFX",
__func__, addr); __func__, p);
}
/* bgp_reg_for_label_callback() will call back /* bgp_reg_for_label_callback() will call back
* __func__ when it gets a label from the pool. * __func__ when it gets a label from the pool.
* This means we'll never register FECs without * This means we'll never register FECs without

View File

@ -1106,13 +1106,9 @@ vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
return; return;
} }
if (debug) { if (debug)
char buf_prefix[PREFIX_STRLEN]; zlog_debug("%s: updating %pFX to vrf %s", __func__, p,
bgp_vrf->name_pretty);
prefix2str(p, buf_prefix, sizeof(buf_prefix));
zlog_debug("%s: updating %s to vrf %s", __func__,
buf_prefix, bgp_vrf->name_pretty);
}
/* shallow copy */ /* shallow copy */
static_attr = *path_vpn->attr; static_attr = *path_vpn->attr;

View File

@ -315,15 +315,12 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
bnc->change_flags = 0; bnc->change_flags = 0;
/* debug print the input */ /* debug print the input */
if (BGP_DEBUG(nht, NHT)) { if (BGP_DEBUG(nht, NHT))
char buf[PREFIX2STR_BUFFER];
prefix2str(&nhr->prefix, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s(%u): Rcvd NH update %s(%u) - metric %d/%d #nhops %d/%d flags 0x%x", "%s(%u): Rcvd NH update %pFX(%u) - metric %d/%d #nhops %d/%d flags 0x%x",
bnc->bgp->name_pretty, bnc->bgp->vrf_id, buf, bnc->bgp->name_pretty, bnc->bgp->vrf_id, &nhr->prefix,
bnc->srte_color, nhr->metric, bnc->metric, bnc->srte_color, nhr->metric, bnc->metric,
nhr->nexthop_num, bnc->nexthop_num, bnc->flags); nhr->nexthop_num, bnc->nexthop_num, bnc->flags);
}
if (nhr->metric != bnc->metric) if (nhr->metric != bnc->metric)
bnc->change_flags |= BGP_NEXTHOP_METRIC_CHANGED; 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); bnc = bnc_find(tree, &nhr.prefix, nhr.srte_color);
if (!bnc) { if (!bnc) {
if (BGP_DEBUG(nht, NHT)) { if (BGP_DEBUG(nht, NHT))
char buf[PREFIX2STR_BUFFER];
prefix2str(&nhr.prefix, buf, sizeof(buf));
zlog_debug( zlog_debug(
"parse nexthop update(%s(%u)(%s)): bnc info not found", "parse nexthop update(%pFX(%u)(%s)): bnc info not found",
buf, nhr.srte_color, bgp->name_pretty); &nhr.prefix, nhr.srte_color, bgp->name_pretty);
}
return; return;
} }

View File

@ -23,6 +23,8 @@
#include "jhash.h" #include "jhash.h"
#include "pbr.h" #include "pbr.h"
#include "lib/printfrr.h"
#include "bgpd/bgpd.h" #include "bgpd/bgpd.h"
#include "bgpd/bgp_pbr.h" #include "bgpd/bgp_pbr.h"
#include "bgpd/bgp_debug.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; int i = 0;
char return_string[512]; char return_string[512];
char *ptr = return_string; char *ptr = return_string;
char buff[64];
int nb_items = 0; int nb_items = 0;
int delta, len = sizeof(return_string); 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); struct prefix *p = &(api->src_prefix);
if (api->src_prefix_offset) if (api->src_prefix_offset)
delta = snprintf(ptr, len, "@src %s/off%u", delta = snprintfrr(ptr, len, "@src %pFX/off%u", p,
prefix2str(p, buff, 64), api->src_prefix_offset);
api->src_prefix_offset);
else else
delta = snprintf(ptr, len, "@src %s", delta = snprintfrr(ptr, len, "@src %pFX", p);
prefix2str(p, buff, 64));
len -= delta; len -= delta;
ptr += delta; ptr += delta;
INCREMENT_DISPLAY(ptr, nb_items, len); 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); INCREMENT_DISPLAY(ptr, nb_items, len);
if (api->dst_prefix_offset) if (api->dst_prefix_offset)
delta = snprintf(ptr, len, "@dst %s/off%u", delta = snprintfrr(ptr, len, "@dst %pFX/off%u", p,
prefix2str(p, buff, 64), api->dst_prefix_offset);
api->dst_prefix_offset);
else else
delta = snprintf(ptr, len, "@dst %s", delta = snprintfrr(ptr, len, "@dst %pFX", p);
prefix2str(p, buff, 64));
len -= delta; len -= delta;
ptr += delta; ptr += delta;
} }

View File

@ -2428,12 +2428,8 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp,
onlypeer = ((SUBGRP_PCOUNT(subgrp) == 1) ? (SUBGRP_PFIRST(subgrp))->peer onlypeer = ((SUBGRP_PCOUNT(subgrp) == 1) ? (SUBGRP_PFIRST(subgrp))->peer
: NULL); : NULL);
if (BGP_DEBUG(update, UPDATE_OUT)) { if (BGP_DEBUG(update, UPDATE_OUT))
char buf_prefix[PREFIX_STRLEN]; zlog_debug("%s: p=%pFX, selected=%p", __func__, p, selected);
prefix2str(p, buf_prefix, sizeof(buf_prefix));
zlog_debug("%s: p=%s, selected=%p", __func__, buf_prefix,
selected);
}
/* First update is deferred until ORF or ROUTE-REFRESH is received */ /* First update is deferred until ORF or ROUTE-REFRESH is received */
if (onlypeer && CHECK_FLAG(onlypeer->af_sflags[afi][safi], 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); json_object_string_add(json, "network", buf2);
} }
} else if (p->family == AF_ETHERNET) { } else if (p->family == AF_ETHERNET) {
prefix2str(p, buf, PREFIX_STRLEN);
len = vty_out(vty, "%pFX", p); len = vty_out(vty, "%pFX", p);
} else if (p->family == AF_EVPN) { } else if (p->family == AF_EVPN) {
if (!json) if (!json)
len = vty_out(vty, "%s", len = vty_out(vty, "%pFX", (struct prefix_evpn *)p);
prefix2str((struct prefix_evpn *)p, buf,
BUFSIZ));
else else
bgp_evpn_route2json((struct prefix_evpn *)p, json); bgp_evpn_route2json((struct prefix_evpn *)p, json);
} else if (p->family == AF_FLOWSPEC) { } 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 buf[INET6_ADDRSTRLEN];
char buf1[BUFSIZ]; char buf1[BUFSIZ];
char buf2[EVPN_ROUTE_STRLEN];
struct attr *attr = path->attr; struct attr *attr = path->attr;
int sockunion_vty_out(struct vty *, union sockunion *); int sockunion_vty_out(struct vty *, union sockunion *);
time_t tbuf; time_t tbuf;
@ -8989,7 +8981,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
if (path->extra) { if (path->extra) {
char tag_buf[30]; char tag_buf[30];
buf2[0] = '\0';
tag_buf[0] = '\0'; tag_buf[0] = '\0';
if (path->extra && path->extra->num_labels) { if (path->extra && path->extra->num_labels) {
bgp_evpn_label2str(path->extra->label, 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 (safi == SAFI_EVPN) {
if (!json_paths) { if (!json_paths) {
prefix2str((struct prefix_evpn *) vty_out(vty, " Route %pFX",
bgp_dest_get_prefix(bn), (struct prefix_evpn *)
buf2, sizeof(buf2)); bgp_dest_get_prefix(bn));
vty_out(vty, " Route %s", buf2);
if (tag_buf[0] != '\0') if (tag_buf[0] != '\0')
vty_out(vty, " VNI %s", tag_buf); vty_out(vty, " VNI %s", tag_buf);
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -9025,13 +9015,20 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
pdest), pdest),
buf1, sizeof(buf1)); buf1, sizeof(buf1));
if (is_pi_family_evpn(parent_ri)) { if (is_pi_family_evpn(parent_ri)) {
prefix2str((struct prefix_evpn *) vty_out(vty,
bgp_dest_get_prefix( " Imported from %s:%pFX, VNI %s\n",
dest), buf1,
buf2, sizeof(buf2)); (struct prefix_evpn *)
vty_out(vty, " Imported from %s:%s, VNI %s\n", buf1, buf2, tag_buf); bgp_dest_get_prefix(
dest),
tag_buf);
} else } 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 peer *peer;
struct listnode *node, *nnode; struct listnode *node, *nnode;
char buf1[RD_ADDRSTRLEN]; char buf1[RD_ADDRSTRLEN];
char buf3[EVPN_ROUTE_STRLEN];
char prefix_str[BUFSIZ]; char prefix_str[BUFSIZ];
int count = 0; int count = 0;
int best = 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 (safi == SAFI_EVPN) {
if (!json) { 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 ? prefix_rd2str(prd, buf1, sizeof(buf1))
: "", : "",
prd ? ":" : "", prd ? ":" : "", (struct prefix_evpn *)p);
prefix2str((struct prefix_evpn *)p, buf3,
sizeof(buf3)));
} else { } else {
json_object_string_add(json, "rd", json_object_string_add(json, "rd",
prd ? prefix_rd2str(prd, buf1, sizeof(buf1)) : prd ? prefix_rd2str(prd, buf1, sizeof(buf1)) :

View File

@ -702,8 +702,6 @@ static int rpki_validate_prefix(struct peer *peer, struct attr *attr,
as_t as_number = 0; as_t as_number = 0;
struct lrtr_ip_addr ip_addr_prefix; struct lrtr_ip_addr ip_addr_prefix;
enum pfxv_state result; enum pfxv_state result;
char buf[BUFSIZ];
const char *prefix_string;
if (!is_synchronized()) if (!is_synchronized())
return 0; return 0;
@ -754,27 +752,26 @@ static int rpki_validate_prefix(struct peer *peer, struct attr *attr,
prefix->prefixlen, &result); prefix->prefixlen, &result);
// Print Debug output // Print Debug output
prefix_string = prefix2str(prefix, buf, sizeof(buf));
switch (result) { switch (result) {
case BGP_PFXV_STATE_VALID: case BGP_PFXV_STATE_VALID:
RPKI_DEBUG( RPKI_DEBUG(
"Validating Prefix %s from asn %u Result: VALID", "Validating Prefix %pFX from asn %u Result: VALID",
prefix_string, as_number); prefix, as_number);
return RPKI_VALID; return RPKI_VALID;
case BGP_PFXV_STATE_NOT_FOUND: case BGP_PFXV_STATE_NOT_FOUND:
RPKI_DEBUG( RPKI_DEBUG(
"Validating Prefix %s from asn %u Result: NOT FOUND", "Validating Prefix %pFX from asn %u Result: NOT FOUND",
prefix_string, as_number); prefix, as_number);
return RPKI_NOTFOUND; return RPKI_NOTFOUND;
case BGP_PFXV_STATE_INVALID: case BGP_PFXV_STATE_INVALID:
RPKI_DEBUG( RPKI_DEBUG(
"Validating Prefix %s from asn %u Result: INVALID", "Validating Prefix %pFX from asn %u Result: INVALID",
prefix_string, as_number); prefix, as_number);
return RPKI_INVALID; return RPKI_INVALID;
default: default:
RPKI_DEBUG( RPKI_DEBUG(
"Validating Prefix %s from asn %u Result: CANNOT VALIDATE", "Validating Prefix %pFX from asn %u Result: CANNOT VALIDATE",
prefix_string, as_number); prefix, as_number);
break; break;
} }
return 0; return 0;

View File

@ -1137,7 +1137,6 @@ void subgroup_default_update_packet(struct update_subgroup *subgrp,
/* Logging the attribute. */ /* Logging the attribute. */
if (bgp_debug_update(NULL, &p, subgrp->update_group, 0)) { if (bgp_debug_update(NULL, &p, subgrp->update_group, 0)) {
char attrstr[BUFSIZ]; char attrstr[BUFSIZ];
char buf[PREFIX_STRLEN];
/* ' with addpath ID ' 17 /* ' with addpath ID ' 17
* max strlen of uint32 + 10 * max strlen of uint32 + 10
* +/- (just in case) + 1 * +/- (just in case) + 1
@ -1156,10 +1155,9 @@ void subgroup_default_update_packet(struct update_subgroup *subgrp,
else else
tx_id_buf[0] = '\0'; tx_id_buf[0] = '\0';
zlog_debug("u%" PRIu64 ":s%" PRIu64 " send UPDATE %s%s %s", zlog_debug("u%" PRIu64 ":s%" PRIu64 " send UPDATE %pFX%s %s",
(SUBGRP_UPDGRP(subgrp))->id, subgrp->id, (SUBGRP_UPDGRP(subgrp))->id, subgrp->id, &p,
prefix2str(&p, buf, sizeof(buf)), tx_id_buf, tx_id_buf, attrstr);
attrstr);
} }
s = stream_new(BGP_MAX_PACKET_SIZE); s = stream_new(BGP_MAX_PACKET_SIZE);
@ -1222,7 +1220,6 @@ void subgroup_default_withdraw_packet(struct update_subgroup *subgrp)
p.prefixlen = 0; p.prefixlen = 0;
if (bgp_debug_update(NULL, &p, subgrp->update_group, 0)) { if (bgp_debug_update(NULL, &p, subgrp->update_group, 0)) {
char buf[PREFIX_STRLEN];
/* ' with addpath ID ' 17 /* ' with addpath ID ' 17
* max strlen of uint32 + 10 * max strlen of uint32 + 10
* +/- (just in case) + 1 * +/- (just in case) + 1
@ -1235,9 +1232,10 @@ void subgroup_default_withdraw_packet(struct update_subgroup *subgrp)
" with addpath ID %u", " with addpath ID %u",
BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE); BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE);
zlog_debug("u%" PRIu64 ":s%" PRIu64" send UPDATE %s%s -- unreachable", zlog_debug("u%" PRIu64 ":s%" PRIu64
(SUBGRP_UPDGRP(subgrp))->id, subgrp->id, " send UPDATE %pFX%s -- unreachable",
prefix2str(&p, buf, sizeof(buf)), tx_id_buf); (SUBGRP_UPDGRP(subgrp))->id, subgrp->id, &p,
tx_id_buf);
} }
s = stream_new(BGP_MAX_PACKET_SIZE); s = stream_new(BGP_MAX_PACKET_SIZE);

View File

@ -3883,7 +3883,6 @@ void bgp_config_write_listen(struct vty *vty, struct bgp *bgp)
struct listnode *node, *nnode, *rnode, *nrnode; struct listnode *node, *nnode, *rnode, *nrnode;
struct prefix *range; struct prefix *range;
afi_t afi; afi_t afi;
char buf[PREFIX2STR_BUFFER];
if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT) if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT)
vty_out(vty, " bgp listen limit %d\n", 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 (afi = AFI_IP; afi < AFI_MAX; afi++) {
for (ALL_LIST_ELEMENTS(group->listen_range[afi], rnode, for (ALL_LIST_ELEMENTS(group->listen_range[afi], rnode,
nrnode, range)) { nrnode, range)) {
prefix2str(range, buf, sizeof(buf));
vty_out(vty, vty_out(vty,
" bgp listen range %s peer-group %s\n", " bgp listen range %pFX peer-group %s\n",
buf, group->name); 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 prefix *range;
struct peer *conf; struct peer *conf;
struct peer *peer; struct peer *peer;
char buf[PREFIX2STR_BUFFER];
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
const char *peer_status; 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, for (ALL_LIST_ELEMENTS(group->listen_range[afi], node,
nnode, range)) { nnode, range))
prefix2str(range, buf, sizeof(buf)); vty_out(vty, " %pFX\n", range);
vty_out(vty, " %s\n", buf);
}
} }
} }

View File

@ -91,11 +91,9 @@ static int bgp_router_id_update(ZAPI_CALLBACK_ARGS)
zebra_router_id_update_read(zclient->ibuf, &router_id); zebra_router_id_update_read(zclient->ibuf, &router_id);
if (BGP_DEBUG(zebra, ZEBRA)) { if (BGP_DEBUG(zebra, ZEBRA))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Rx Router Id update VRF %u Id %pFX", vrf_id,
prefix2str(&router_id, buf, sizeof(buf)); &router_id);
zlog_debug("Rx Router Id update VRF %u Id %s", vrf_id, buf);
}
bgp_router_id_zebra_bump(vrf_id, &router_id); bgp_router_id_zebra_bump(vrf_id, &router_id);
return 0; return 0;
@ -313,12 +311,9 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS)
if (ifc == NULL) if (ifc == NULL)
return 0; return 0;
if (bgp_debug_zebra(ifc->address)) { if (bgp_debug_zebra(ifc->address))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Rx Intf address add VRF %u IF %s addr %pFX", vrf_id,
prefix2str(ifc->address, buf, sizeof(buf)); ifc->ifp->name, ifc->address);
zlog_debug("Rx Intf address add VRF %u IF %s addr %s", vrf_id,
ifc->ifp->name, buf);
}
if (!bgp) if (!bgp)
return 0; return 0;
@ -350,12 +345,9 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS)
if (ifc == NULL) if (ifc == NULL)
return 0; return 0;
if (bgp_debug_zebra(ifc->address)) { if (bgp_debug_zebra(ifc->address))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Rx Intf address del VRF %u IF %s addr %pFX", vrf_id,
prefix2str(ifc->address, buf, sizeof(buf)); ifc->ifp->name, ifc->address);
zlog_debug("Rx Intf address del VRF %u IF %s addr %s", vrf_id,
ifc->ifp->name, buf);
}
if (bgp && if_is_operative(ifc->ifp)) { if (bgp && if_is_operative(ifc->ifp)) {
bgp_connected_delete(bgp, ifc); bgp_connected_delete(bgp, ifc);
@ -376,12 +368,9 @@ static int bgp_interface_nbr_address_add(ZAPI_CALLBACK_ARGS)
if (ifc == NULL) if (ifc == NULL)
return 0; return 0;
if (bgp_debug_zebra(ifc->address)) { if (bgp_debug_zebra(ifc->address))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Rx Intf neighbor add VRF %u IF %s addr %pFX",
prefix2str(ifc->address, buf, sizeof(buf)); vrf_id, ifc->ifp->name, ifc->address);
zlog_debug("Rx Intf neighbor add VRF %u IF %s addr %s", vrf_id,
ifc->ifp->name, buf);
}
if (if_is_operative(ifc->ifp)) { if (if_is_operative(ifc->ifp)) {
bgp = bgp_lookup_by_vrf_id(vrf_id); 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) if (ifc == NULL)
return 0; return 0;
if (bgp_debug_zebra(ifc->address)) { if (bgp_debug_zebra(ifc->address))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Rx Intf neighbor del VRF %u IF %s addr %pFX",
prefix2str(ifc->address, buf, sizeof(buf)); vrf_id, ifc->ifp->name, ifc->address);
zlog_debug("Rx Intf neighbor del VRF %u IF %s addr %s", vrf_id,
ifc->ifp->name, buf);
}
if (if_is_operative(ifc->ifp)) { if (if_is_operative(ifc->ifp)) {
bgp = bgp_lookup_by_vrf_id(vrf_id); 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)) { 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) { if (add) {
inet_ntop(api.prefix.family, &nexthop, buf[1], inet_ntop(api.prefix.family, &nexthop, buf,
sizeof(buf[1])); sizeof(buf));
zlog_debug( 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), vrf_id, zebra_route_string(api.type),
api.instance, buf[0], buf[1], nhtype, api.instance, &api.prefix, buf, nhtype, ifindex,
ifindex, api.metric, api.tag); api.metric, api.tag);
} else { } else {
zlog_debug( zlog_debug("Rx route DEL VRF %u %s[%d] %s", vrf_id,
"Rx route DEL VRF %u %s[%d] %s", zebra_route_string(api.type), api.instance,
vrf_id, zebra_route_string(api.type), buf);
api.instance, buf[0]);
} }
} }
@ -1436,18 +1420,17 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
} }
if (bgp_debug_zebra(p)) { if (bgp_debug_zebra(p)) {
char prefix_buf[PREFIX_STRLEN];
char nh_buf[INET6_ADDRSTRLEN]; char nh_buf[INET6_ADDRSTRLEN];
char eth_buf[ETHER_ADDR_STRLEN + 7] = {'\0'}; char eth_buf[ETHER_ADDR_STRLEN + 7] = {'\0'};
char buf1[ETHER_ADDR_STRLEN]; char buf1[ETHER_ADDR_STRLEN];
char label_buf[20]; char label_buf[20];
int i; int i;
prefix2str(&api.prefix, prefix_buf, sizeof(prefix_buf)); zlog_debug(
zlog_debug("Tx route %s VRF %u %s metric %u tag %" ROUTE_TAG_PRI "Tx route %s VRF %u %pFX metric %u tag %" ROUTE_TAG_PRI
" count %d", " count %d",
valid_nh_count ? "add" : "delete", bgp->vrf_id, valid_nh_count ? "add" : "delete", bgp->vrf_id,
prefix_buf, api.metric, api.tag, api.nexthop_num); &api.prefix, api.metric, api.tag, api.nexthop_num);
for (i = 0; i < api.nexthop_num; i++) { for (i = 0; i < api.nexthop_num; i++) {
api_nh = &api.nexthops[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)) if (is_route_parent_evpn(info))
SET_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE); SET_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE);
if (bgp_debug_zebra(p)) { if (bgp_debug_zebra(p))
char buf[PREFIX_STRLEN]; zlog_debug("Tx route delete VRF %u %pFX", bgp->vrf_id,
&api.prefix);
prefix2str(&api.prefix, buf, sizeof(buf));
zlog_debug("Tx route delete VRF %u %s", bgp->vrf_id, buf);
}
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); 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 stream *s = NULL;
struct bgp *bgp_vrf = NULL; struct bgp *bgp_vrf = NULL;
struct prefix p; struct prefix p;
char buf[PREFIX_STRLEN];
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(struct prefix));
s = zclient->ibuf; s = zclient->ibuf;
@ -2798,8 +2777,7 @@ static void bgp_zebra_process_local_ip_prefix(ZAPI_CALLBACK_ARGS)
return; return;
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("Recv prefix %s %s on vrf %s", zlog_debug("Recv prefix %pFX %s on vrf %s", &p,
prefix2str(&p, buf, sizeof(buf)),
(cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) ? "ADD" : "DEL", (cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) ? "ADD" : "DEL",
vrf_id_to_name(vrf_id)); vrf_id_to_name(vrf_id));

View File

@ -2738,7 +2738,6 @@ int peer_group_listen_range_del(struct peer_group *group, struct prefix *range)
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct peer *peer; struct peer *peer;
afi_t afi; afi_t afi;
char buf[PREFIX2STR_BUFFER];
afi = family2afi(range->family); afi = family2afi(range->family);
@ -2751,8 +2750,6 @@ int peer_group_listen_range_del(struct peer_group *group, struct prefix *range)
if (!prefix) if (!prefix)
return BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_NOT_FOUND; 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 /* Dispose off any dynamic neighbors that exist due to this listen range
*/ */
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, peer)) { 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 (prefix_match(prefix, &prefix2)) {
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug( zlog_debug(
"Deleting dynamic neighbor %s group %s upon delete of listen range %s", "Deleting dynamic neighbor %s group %s upon delete of listen range %pFX",
peer->host, group->name, buf); peer->host, group->name, prefix);
peer_delete(peer); peer_delete(peer);
} }
} }
@ -3770,7 +3767,6 @@ struct peer *peer_lookup_dynamic_neighbor(struct bgp *bgp, union sockunion *su)
struct prefix *listen_range; struct prefix *listen_range;
int dncount; int dncount;
char buf[PREFIX2STR_BUFFER]; char buf[PREFIX2STR_BUFFER];
char buf1[PREFIX2STR_BUFFER];
sockunion2hostprefix(su, &prefix); sockunion2hostprefix(su, &prefix);
@ -3787,12 +3783,11 @@ struct peer *peer_lookup_dynamic_neighbor(struct bgp *bgp, union sockunion *su)
return NULL; return NULL;
prefix2str(&prefix, buf, sizeof(buf)); prefix2str(&prefix, buf, sizeof(buf));
prefix2str(listen_range, buf1, sizeof(buf1));
if (bgp_debug_neighbor_events(NULL)) if (bgp_debug_neighbor_events(NULL))
zlog_debug( zlog_debug(
"Dynamic Neighbor %s matches group %s listen range %s", "Dynamic Neighbor %s matches group %s listen range %pFX",
buf, group->name, buf1); buf, group->name, listen_range);
/* Are we within the listen limit? */ /* Are we within the listen limit? */
dncount = gbgp->dynamic_neighbors_count; dncount = gbgp->dynamic_neighbors_count;

View File

@ -170,14 +170,8 @@ struct rfapi_nve_group_cfg *bgp_rfapi_cfg_match_group(struct rfapi_cfg *hc,
#ifdef BGP_VNC_DEBUG_MATCH_GROUP #ifdef BGP_VNC_DEBUG_MATCH_GROUP
{ {
char buf[PREFIX_STRLEN]; vnc_zlog_debug_verbose("%s: vn prefix: %pFX", __func__, vn);
vnc_zlog_debug_verbose("%s: un prefix: %pFX", __func__, un);
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( vnc_zlog_debug_verbose(
"%s: rn_vn=%p, rn_un=%p, rfg_vn=%p, rfg_un=%p", "%s: rn_vn=%p, rn_un=%p, rfg_vn=%p, rfg_un=%p",
__func__, rn_vn, rn_un, rfg_vn, rfg_un); __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; ++write;
vty_out(vty, " vnc nve-group %s\n", rfg->name); vty_out(vty, " vnc nve-group %s\n", rfg->name);
if (rfg->vn_prefix.family && rfg->vn_node) { if (rfg->vn_prefix.family && rfg->vn_node)
char buf[PREFIX_STRLEN]; vty_out(vty, " prefix %s %pFX\n", "vn",
&rfg->vn_prefix);
prefix2str(&rfg->vn_prefix, buf, if (rfg->un_prefix.family && rfg->un_node)
sizeof(buf)); vty_out(vty, " prefix %s %pFX\n", "un",
vty_out(vty, " prefix %s %s\n", "vn", &rfg->un_prefix);
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->rd.prefixlen) { if (rfg->rd.prefixlen) {

View File

@ -362,12 +362,9 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
afi_t afi; /* of the VN address */ afi_t afi; /* of the VN address */
struct bgp_dest *bn; struct bgp_dest *bn;
struct bgp_path_info *bpi; struct bgp_path_info *bpi;
char buf[PREFIX_STRLEN];
char buf2[RD_ADDRSTRLEN]; char buf2[RD_ADDRSTRLEN];
struct prefix_rd prd0; struct prefix_rd prd0;
prefix2str(p, buf, sizeof(buf));
afi = family2afi(p->family); afi = family2afi(p->family);
assert(afi == AFI_IP || afi == AFI_IP6); 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); bn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd);
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: peer=%p, prefix=%s, prd=%s afi=%d, safi=%d bn=%p, bn->info=%p", "%s: peer=%p, prefix=%pFX, prd=%s afi=%d, safi=%d bn=%p, bn->info=%p",
__func__, peer, buf, prefix_rd2str(prd, buf2, sizeof(buf2)), __func__, peer, p, prefix_rd2str(prd, buf2, sizeof(buf2)), afi,
afi, safi, bn, (bn ? bgp_dest_get_bgp_path_info(bn) : NULL)); safi, bn, (bn ? bgp_dest_get_bgp_path_info(bn) : NULL));
for (bpi = (bn ? bgp_dest_get_bgp_path_info(bn) : NULL); bpi; for (bpi = (bn ? bgp_dest_get_bgp_path_info(bn) : NULL); bpi;
bpi = bpi->next) { bpi = bpi->next) {
@ -418,8 +415,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
* no local nexthops * no local nexthops
*/ */
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: lnh list already empty at prefix %s", "%s: lnh list already empty at prefix %pFX",
__func__, buf); __func__, p);
goto done; goto done;
} }
@ -445,8 +442,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
* list->del on data */ * list->del on data */
rfapi_nexthop_free(pLnh); rfapi_nexthop_free(pLnh);
} else { } else {
vnc_zlog_debug_verbose("%s: desired lnh not found %s", vnc_zlog_debug_verbose("%s: desired lnh not found %pFX",
__func__, buf); __func__, p);
} }
goto done; goto done;
} }
@ -459,10 +456,9 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
rfapiProcessWithdraw(peer, rfd, p, prd, NULL, afi, safi, type, kill); rfapiProcessWithdraw(peer, rfd, p, prd, NULL, afi, safi, type, kill);
if (bpi) { if (bpi) {
prefix2str(p, buf, sizeof(buf));
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: Found route (safi=%d) to delete at prefix %s", "%s: Found route (safi=%d) to delete at prefix %pFX",
__func__, safi, buf); __func__, safi, p);
if (safi == SAFI_MPLS_VPN) { if (safi == SAFI_MPLS_VPN) {
struct bgp_dest *pdest = NULL; struct bgp_dest *pdest = NULL;
@ -488,8 +484,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
bgp_process(bgp, bn, afi, safi); bgp_process(bgp, bn, afi, safi);
} else { } else {
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: Couldn't find route (safi=%d) at prefix %s", "%s: Couldn't find route (safi=%d) at prefix %pFX",
__func__, safi, buf); __func__, safi, p);
} }
done: done:
bgp_dest_unlock_node(bn); 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; char *s;
prefix2str(&p, buf, sizeof(buf)); vnc_zlog_debug_verbose("%s(rfd=%p, target=%pFX, ppNextHop=%p)",
vnc_zlog_debug_verbose("%s(rfd=%p, target=%s, ppNextHop=%p)", __func__, rfd, &p, ppNextHopEntry);
__func__, rfd, buf, ppNextHopEntry);
s = ecommunity_ecom2str(rfd->import_table->rt_import_list, s = ecommunity_ecom2str(rfd->import_table->rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0); 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); afi = family2afi(prefix->prefix.addr_family);
assert(afi); assert(afi);
vnc_zlog_debug_verbose(
{ "%s(rfd=%p, pfx=%pFX, lifetime=%d, opts_un=%p, opts_vn=%p, action=%s)",
char buf[PREFIX_STRLEN]; __func__, rfd, &p, lifetime, options_un, options_vn,
action_str);
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);
}
/* /*
* These tests come after the prefix conversion so that we can * These tests come after the prefix conversion so that we can

View File

@ -612,11 +612,8 @@ rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset)
#ifdef DEBUG_MONITOR_MOVE_SHORTER #ifdef DEBUG_MONITOR_MOVE_SHORTER
{ {
char buf[PREFIX_STRLEN]; vnc_zlog_debug_verbose("%s: called with node pfx=%pFX",
__func__, &original_vpn_node->p);
prefix2str(&original_vpn_node->p, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: called with node pfx=%s", __func__,
buf);
} }
#endif #endif
@ -751,11 +748,8 @@ rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset)
#ifdef DEBUG_MONITOR_MOVE_SHORTER #ifdef DEBUG_MONITOR_MOVE_SHORTER
{ {
char buf[PREFIX_STRLEN]; vnc_zlog_debug_verbose("%s: moved to node pfx=%pFX", __func__,
&par->p);
prefix2str(&par->p, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: moved to node pfx=%s", __func__,
buf);
} }
#endif #endif
@ -1556,12 +1550,9 @@ static int rfapiNhlAddNodeRoutes(
} }
if (!skiplist_search(seen_nexthops, &pfx_vn, NULL)) { if (!skiplist_search(seen_nexthops, &pfx_vn, NULL)) {
#ifdef DEBUG_RETURNED_NHL #ifdef DEBUG_RETURNED_NHL
char buf[PREFIX_STRLEN];
prefix2str(&pfx_vn, buf, sizeof(buf));
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: already put VN/nexthop %s, skip", __func__, "%s: already put VN/nexthop %pFX, skip",
buf); __func__, &pfx_vn);
#endif #endif
continue; continue;
} }
@ -3634,12 +3625,9 @@ void rfapiBgpInfoFilteredImportVPN(
rfapiCopyUnEncap2VPN(ern->info, info_new); rfapiCopyUnEncap2VPN(ern->info, info_new);
agg_unlock_node(ern); /* undo lock in route_note_match */ agg_unlock_node(ern); /* undo lock in route_note_match */
} else { } else {
char bpf[PREFIX_STRLEN];
prefix2str(&vn_prefix, bpf, sizeof(bpf));
/* Not a big deal, just means VPN route got here first */ /* Not a big deal, just means VPN route got here first */
vnc_zlog_debug_verbose("%s: no encap route for vn addr %s", vnc_zlog_debug_verbose("%s: no encap route for vn addr %pFX",
__func__, bpf); __func__, &vn_prefix);
info_new->extra->vnc.import.un_family = 0; info_new->extra->vnc.import.un_family = 0;
} }
@ -4441,13 +4429,9 @@ static void rfapiDeleteRemotePrefixesIt(
struct bgp_path_info *next; struct bgp_path_info *next;
const struct prefix *rn_p = agg_node_get_prefix(rn); const struct prefix *rn_p = agg_node_get_prefix(rn);
if (p && VNC_DEBUG(IMPORT_DEL_REMOTE)) { if (p && VNC_DEBUG(IMPORT_DEL_REMOTE))
char p1line[PREFIX_STRLEN]; vnc_zlog_debug_any("%s: want %pFX, have %pRN",
__func__, p, rn);
prefix2str(p, p1line, sizeof(p1line));
vnc_zlog_debug_any("%s: want %s, have %pRN",
__func__, p1line, rn);
}
if (p && prefix_cmp(p, rn_p)) if (p && prefix_cmp(p, rn_p))
continue; continue;

View File

@ -846,9 +846,6 @@ void rfapiMonitorItNodeChanged(
struct bgp *bgp = bgp_get_default(); struct bgp *bgp = bgp_get_default();
const struct prefix *p = agg_node_get_prefix(rn); const struct prefix *p = agg_node_get_prefix(rn);
afi_t afi = family2afi(p->family); afi_t afi = family2afi(p->family);
#if DEBUG_L2_EXTRA
char buf_prefix[PREFIX_STRLEN];
#endif
assert(bgp); assert(bgp);
assert(import_table); assert(import_table);
@ -856,9 +853,8 @@ void rfapiMonitorItNodeChanged(
nves_seen = skiplist_new(0, NULL, NULL); nves_seen = skiplist_new(0, NULL, NULL);
#if DEBUG_L2_EXTRA #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=%pFX",
vnc_zlog_debug_verbose("%s: it=%p, it_node=%p, it_node->prefix=%s", __func__, import_table, it_node, &it_node->p);
__func__, import_table, it_node, buf_prefix);
#endif #endif
if (AFI_L2VPN == afi) { if (AFI_L2VPN == afi) {
@ -934,14 +930,10 @@ void rfapiMonitorItNodeChanged(
assert(!skiplist_insert(nves_seen, assert(!skiplist_insert(nves_seen,
m->rfd, NULL)); m->rfd, NULL));
char buf_target_pfx[PREFIX_STRLEN];
prefix2str(&m->p, buf_target_pfx,
sizeof(buf_target_pfx));
vnc_zlog_debug_verbose( 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, __func__, m->rfd, m->node,
buf_target_pfx); &m->p);
/* /*
* update its RIB * update its RIB
@ -1269,21 +1261,15 @@ static void rfapiMonitorEthDetachImport(
rn = agg_node_get(it->imported_vpn[AFI_L2VPN], &pfx_mac_buf); rn = agg_node_get(it->imported_vpn[AFI_L2VPN], &pfx_mac_buf);
assert(rn); 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 * Get sl to detach from
*/ */
sl = RFAPI_MONITOR_ETH(rn); sl = RFAPI_MONITOR_ETH(rn);
#if DEBUG_L2_EXTRA #if DEBUG_L2_EXTRA
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: it=%p, rn=%p, rn->lock=%d, sl=%p, pfx=%s, LNI=%d, detaching eth mon %p", "%s: it=%p, rn=%p, rn->lock=%d, sl=%p, pfx=%pFX, LNI=%d, detaching eth mon %p",
__func__, it, rn, rn->lock, sl, buf_prefix, mon->logical_net_id, __func__, it, rn, rn->lock, sl, agg_node_get_prefix(rn),
mon); mon->logical_net_id, mon);
#endif #endif
assert(sl); assert(sl);

View File

@ -907,10 +907,6 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
delete_list = list_new(); delete_list = list_new();
while (0 while (0
== skiplist_first(slRibPt, NULL, (void **)&ri)) { == skiplist_first(slRibPt, NULL, (void **)&ri)) {
char buf[PREFIX_STRLEN];
char buf2[PREFIX_STRLEN];
listnode_add(delete_list, ri); listnode_add(delete_list, ri);
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: after listnode_add, delete_list->count=%d", "%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; ri->timer = NULL;
} }
prefix2str(&ri->rk.vn, buf, sizeof(buf));
prefix2str(&ri->un, buf2, sizeof(buf2));
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: put dl pfx=%pRN vn=%s un=%s cost=%d life=%d vn_options=%p", "%s: put dl pfx=%pRN vn=%pFX un=%pFX cost=%d life=%d vn_options=%p",
__func__, pn, buf, buf2, ri->cost, __func__, pn, &ri->rk.vn, &ri->un,
ri->lifetime, ri->vn_options); ri->cost, ri->lifetime, ri->vn_options);
skiplist_delete_first(slRibPt); skiplist_delete_first(slRibPt);
} }
@ -1589,7 +1583,6 @@ void rfapiRibUpdatePendingNode(
afi_t afi; afi_t afi;
uint32_t queued_flag; uint32_t queued_flag;
int count = 0; int count = 0;
char buf[PREFIX_STRLEN];
vnc_zlog_debug_verbose("%s: entry", __func__); vnc_zlog_debug_verbose("%s: entry", __func__);
@ -1602,8 +1595,7 @@ void rfapiRibUpdatePendingNode(
prefix = agg_node_get_prefix(it_node); prefix = agg_node_get_prefix(it_node);
afi = family2afi(prefix->family); afi = family2afi(prefix->family);
prefix2str(prefix, buf, sizeof(buf)); vnc_zlog_debug_verbose("%s: prefix=%pFX", __func__, prefix);
vnc_zlog_debug_verbose("%s: prefix=%s", __func__, buf);
pn = agg_node_get(rfd->rib_pending[afi], prefix); pn = agg_node_get(rfd->rib_pending[afi], prefix);
assert(pn); assert(pn);
@ -1809,11 +1801,8 @@ int rfapiRibFTDFilterRecentPrefix(
#ifdef DEBUG_FTD_FILTER_RECENT #ifdef DEBUG_FTD_FILTER_RECENT
{ {
char buf_pfx[PREFIX_STRLEN]; vnc_zlog_debug_verbose("%s: prefix %pFX", __func__,
agg_node_get_prefix(it_rn));
prefix2str(agg_node_get_prefix(it_rn), buf_pfx,
sizeof(buf_pfx));
vnc_zlog_debug_verbose("%s: prefix %s", __func__, buf_pfx);
} }
#endif #endif
@ -1974,21 +1963,18 @@ rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd,
#if DEBUG_NHL #if DEBUG_NHL
{ {
char str_vn[PREFIX_STRLEN];
char str_aux_prefix[PREFIX_STRLEN]; char str_aux_prefix[PREFIX_STRLEN];
str_vn[0] = 0;
str_aux_prefix[0] = 0; str_aux_prefix[0] = 0;
prefix2str(&rk.vn, str_vn, sizeof(str_vn));
prefix2str(&rk.aux_prefix, str_aux_prefix, prefix2str(&rk.aux_prefix, str_aux_prefix,
sizeof(str_aux_prefix)); sizeof(str_aux_prefix));
if (!rk.aux_prefix.family) { if (!rk.aux_prefix.family) {
} }
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: rk.vn=%s rk.aux_prefix=%s", __func__, "%s: rk.vn=%pFX rk.aux_prefix=%s", __func__,
str_vn, &rk.vn,
(rk.aux_prefix.family ? str_aux_prefix : "-")); (rk.aux_prefix.family ? str_aux_prefix : "-"));
} }
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
@ -2072,17 +2058,10 @@ rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd,
if (agg_node_get_lock_count(trn) > 1) if (agg_node_get_lock_count(trn) > 1)
agg_unlock_node(trn); agg_unlock_node(trn);
{ vnc_zlog_debug_verbose(
char str_pfx[PREFIX_STRLEN]; "%s: added pfx=%pFX nh[vn]=%pFX, cost=%u, lifetime=%u, allowed=%d",
char str_pfx_vn[PREFIX_STRLEN]; __func__, &pfx, &rk.vn, nhp->prefix.cost, nhp->lifetime,
allowed);
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);
}
if (allowed) { if (allowed) {
if (tail) if (tail)

View File

@ -1596,7 +1596,6 @@ void rfapiPrintDescriptor(struct vty *vty, struct rfapi_descriptor *rfd)
int rc; int rc;
afi_t afi; afi_t afi;
struct rfapi_adb *adb; struct rfapi_adb *adb;
char buf[PREFIX_STRLEN];
vty_out(vty, "%-10p ", rfd); vty_out(vty, "%-10p ", rfd);
rfapiPrintRfapiIpAddr(vty, &rfd->un_addr); 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) if (family != adb->u.s.prefix_ip.family)
continue; continue;
prefix2str(&adb->u.s.prefix_ip, buf, sizeof(buf)); vty_out(vty, " Adv Pfx: %pFX%s", &adb->u.s.prefix_ip,
HVTYNL);
vty_out(vty, " Adv Pfx: %s%s", buf, HVTYNL);
rfapiPrintAdvertisedInfo(vty, rfd, SAFI_MPLS_VPN, rfapiPrintAdvertisedInfo(vty, rfd, SAFI_MPLS_VPN,
&adb->u.s.prefix_ip); &adb->u.s.prefix_ip);
} }
@ -1659,10 +1657,7 @@ void rfapiPrintDescriptor(struct vty *vty, struct rfapi_descriptor *rfd)
(void **)&adb, &cursor); (void **)&adb, &cursor);
rc == 0; rc = skiplist_next(rfd->advertised.ip0_by_ether, NULL, rc == 0; rc = skiplist_next(rfd->advertised.ip0_by_ether, NULL,
(void **)&adb, &cursor)) { (void **)&adb, &cursor)) {
vty_out(vty, " Adv Pfx: %pFX%s", &adb->u.s.prefix_eth, HVTYNL);
prefix2str(&adb->u.s.prefix_eth, buf, sizeof(buf));
vty_out(vty, " Adv Pfx: %s%s", buf, HVTYNL);
/* TBD update the following function to print ethernet info */ /* TBD update the following function to print ethernet info */
/* Also need to pass/use rd */ /* Also need to pass/use rd */
@ -1863,11 +1858,9 @@ void rfapiPrintNhl(void *stream, struct rfapi_next_hop_entry *next_hops)
break; break;
case RFAPI_VN_OPTION_TYPE_LOCAL_NEXTHOP: case RFAPI_VN_OPTION_TYPE_LOCAL_NEXTHOP:
prefix2str(&vo->v.local_nexthop.addr, fp(out, "%sLNH %pFX cost=%d%s", offset,
pbuf, sizeof(pbuf)); &vo->v.local_nexthop.addr,
fp(out, "%sLNH %s cost=%d%s", offset, vo->v.local_nexthop.cost, HVTYNL);
pbuf, vo->v.local_nexthop.cost,
HVTYNL);
break; break;
default: default:

View File

@ -206,19 +206,11 @@ static void print_rhn_list(const char *tag1, const char *tag2)
/* XXX uses secret knowledge of skiplist structure */ /* XXX uses secret knowledge of skiplist structure */
for (p = sl->header->forward[0]; p; p = p->forward[0]) { 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; 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( vnc_zlog_debug_verbose(
"RHN Entry %d (q=%p): kpfx=%s, upfx=%s, hpfx=%s, ubpi=%p", "RHN Entry %d (q=%p): kpfx=%pFX, upfx=%pFX, hpfx=%pFX, ubpi=%p",
++count, p, kbuf, ubuf, hbuf, pb->ubpi); ++count, p, p->key, &pb->upfx, &pb->hpfx, pb->ubpi);
} }
} }
#endif #endif
@ -260,15 +252,9 @@ static void vnc_rhnck(char *tag)
* pfx */ * pfx */
assert(!vnc_prefix_cmp(&pb->hpfx, pkey)); assert(!vnc_prefix_cmp(&pb->hpfx, pkey));
if (vnc_prefix_cmp(&pb->hpfx, &pfx_orig_nexthop)) { 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( vnc_zlog_debug_verbose(
"%s: %s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s", "%s: %s: FATAL: resolve_nve_nexthop list item bpi nexthop %pFX != nve pfx %pFX",
__func__, tag, str_onh, str_nve_pfx); __func__, tag, &pfx_orig_nexthop, &pb->hpfx);
assert(0); assert(0);
} }
} }
@ -529,13 +515,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
if (!table_rd) if (!table_rd)
return; return;
{ vnc_zlog_debug_verbose("%s: ubpi_nexthop=%pFX", __func__, ubpi_nexthop);
char str_nh[PREFIX_STRLEN];
prefix2str(ubpi_nexthop, str_nh, sizeof(str_nh));
vnc_zlog_debug_verbose("%s: ubpi_nexthop=%s", __func__, str_nh);
}
/* exact match */ /* exact match */
bd = bgp_node_lookup(table_rd, ubpi_nexthop); bd = bgp_node_lookup(table_rd, ubpi_nexthop);
@ -574,12 +554,9 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
/*debugging */ /*debugging */
if (VNC_DEBUG(VERBOSE)) { if (VNC_DEBUG(VERBOSE)) {
char str_pfx[PREFIX_STRLEN];
char str_nh[PREFIX_STRLEN]; char str_nh[PREFIX_STRLEN];
struct prefix nh; struct prefix nh;
prefix2str(prefix, str_pfx, sizeof(str_pfx));
nh.prefixlen = 0; nh.prefixlen = 0;
rfapiUnicastNexthop2Prefix(afi, info->attr, &nh); rfapiUnicastNexthop2Prefix(afi, info->attr, &nh);
if (nh.prefixlen) { if (nh.prefixlen) {
@ -590,8 +567,8 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
} }
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s(bgp=%p, unicast prefix=%s, unicast nh=%s)", "%s(bgp=%p, unicast prefix=%pFX, unicast nh=%s)",
__func__, bgp, str_pfx, str_nh); __func__, bgp, prefix, str_nh);
} }
if (info->type != ZEBRA_ROUTE_BGP) { 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 local_pref;
uint32_t *med = NULL; uint32_t *med = NULL;
{ vnc_zlog_debug_verbose("%s(prefix=%pFX) entry", __func__, prefix);
char buf[PREFIX_STRLEN];
prefix2str(prefix, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s(prefix=%s) entry", __func__, buf);
}
if (!afi) { if (!afi) {
flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of prefix", 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; ahr_flags |= RFAPI_AHR_NO_TUNNEL_SUBTLV;
} }
if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) { if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE))
char buf[PREFIX_STRLEN]; vnc_zlog_debug_any("%s vn_pfx=%pFX", __func__, vn_pfx);
prefix2str(vn_pfx, buf, sizeof(buf));
vnc_zlog_debug_any("%s vn_pfx=%s", __func__, buf);
}
/* /*
* Compute VN address * Compute VN address
@ -899,12 +867,7 @@ static void vnc_import_bgp_add_route_mode_nvegroup(
struct route_map *rmap = NULL; struct route_map *rmap = NULL;
uint32_t local_pref; uint32_t local_pref;
{ vnc_zlog_debug_verbose("%s(prefix=%pFX) entry", __func__, prefix);
char buf[PREFIX_STRLEN];
prefix2str(prefix, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s(prefix=%s) entry", __func__, buf);
}
assert(rfg); assert(rfg);
@ -985,12 +948,8 @@ static void vnc_import_bgp_add_route_mode_nvegroup(
vncHDBgpDirect.un_addr = pfx_un.prefix; vncHDBgpDirect.un_addr = pfx_un.prefix;
} }
if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) { if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE))
char buf[PREFIX_STRLEN]; vnc_zlog_debug_any("%s vn_pfx=%pFX", __func__, vn_pfx);
prefix2str(vn_pfx, buf, sizeof(buf));
vnc_zlog_debug_any("%s vn_pfx=%s", __func__, buf);
}
/* /*
* Compute VN address * Compute VN address
@ -1288,12 +1247,7 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
if (!table_rd) if (!table_rd)
return; return;
{ vnc_zlog_debug_verbose("%s: ubpi_nexthop=%pFX", __func__, ubpi_nexthop);
char str_nh[PREFIX_STRLEN];
prefix2str(ubpi_nexthop, str_nh, sizeof(str_nh));
vnc_zlog_debug_verbose("%s: ubpi_nexthop=%s", __func__, str_nh);
}
/* exact match */ /* exact match */
@ -1467,17 +1421,11 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
memset(&pfx_unicast_nexthop, 0, memset(&pfx_unicast_nexthop, 0,
sizeof(struct prefix)); /* keep valgrind happy */ sizeof(struct prefix)); /* keep valgrind happy */
if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) { 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));
vnc_zlog_debug_any( vnc_zlog_debug_any(
"%s: examining RHN Entry (q=%p): upfx=%s, hpfx=%s, ubpi=%p", "%s: examining RHN Entry (q=%p): upfx=%pFX, hpfx=%pFX, ubpi=%p",
__func__, cursor, ubuf, hbuf, pb->ubpi); __func__, cursor, &pb->upfx, &pb->hpfx,
} pb->ubpi);
if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubpi, &ecom, if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubpi, &ecom,
&pfx_unicast_nexthop)) { &pfx_unicast_nexthop)) {
@ -1497,16 +1445,9 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
* Sanity check * Sanity check
*/ */
if (vnc_prefix_cmp(&pfx_unicast_nexthop, prefix)) { 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( vnc_zlog_debug_verbose(
"%s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s", "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %pFX != nve pfx %pFX",
__func__, str_unh, str_nve_pfx); __func__, &pfx_unicast_nexthop, prefix);
assert(0); assert(0);
} }
@ -1521,13 +1462,9 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
#if DEBUG_RHN_LIST #if DEBUG_RHN_LIST
/* debug */ /* debug */
{ {
char pbuf[PREFIX_STRLEN];
prefix2str(prefix, pbuf, sizeof(pbuf));
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: advancing past RHN Entry (q=%p): with prefix %s", "%s: advancing past RHN Entry (q=%p): with prefix %pFX",
__func__, cursor, pbuf); __func__, cursor, prefix);
print_rhn_list(__func__, NULL); /* debug */ print_rhn_list(__func__, NULL); /* debug */
} }
#endif #endif
@ -1550,14 +1487,8 @@ void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
struct rfapi_cfg *hc = NULL; struct rfapi_cfg *hc = NULL;
int rc; int rc;
{ vnc_zlog_debug_verbose("%s(bgp=%p, nve prefix=%pFX)", __func__, bgp,
char str_pfx[PREFIX_STRLEN]; prefix);
prefix2str(prefix, str_pfx, sizeof(str_pfx));
vnc_zlog_debug_verbose("%s(bgp=%p, nve prefix=%s)", __func__,
bgp, str_pfx);
}
if (afi != AFI_IP && afi != AFI_IP6) if (afi != AFI_IP && afi != AFI_IP6)
return; return;
@ -1621,16 +1552,9 @@ void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
* Sanity check * Sanity check
*/ */
if (vnc_prefix_cmp(&pfx_unicast_nexthop, prefix)) { 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( vnc_zlog_debug_verbose(
"%s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s", "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %pFX != nve pfx %pFX",
__func__, str_unh, str_nve_pfx); __func__, &pfx_unicast_nexthop, prefix);
assert(0); assert(0);
} }
@ -2305,13 +2229,11 @@ void vnc_import_bgp_exterior_add_route_interior(
(void **)&pfx_exterior, &cursor)) { (void **)&pfx_exterior, &cursor)) {
struct prefix pfx_nexthop; struct prefix pfx_nexthop;
char buf[PREFIX_STRLEN];
afi_t afi_exterior = family2afi(pfx_exterior->family); afi_t afi_exterior = family2afi(pfx_exterior->family);
prefix2str(pfx_exterior, buf, sizeof(buf));
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: checking exterior orphan at prefix %s", __func__, "%s: checking exterior orphan at prefix %pFX", __func__,
buf); pfx_exterior);
if (afi_exterior != afi) { if (afi_exterior != afi) {
vnc_zlog_debug_verbose( 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)) { if (VNC_DEBUG(VERBOSE)) {
struct prefix pfx_nexthop; struct prefix pfx_nexthop;
char buf[PREFIX_STRLEN];
char buf_nh[PREFIX_STRLEN];
prefix2str(prefix, buf, sizeof(buf));
rfapiUnicastNexthop2Prefix(afi, info->attr, &pfx_nexthop); rfapiUnicastNexthop2Prefix(afi, info->attr, &pfx_nexthop);
prefix2str(&pfx_nexthop, buf_nh, sizeof(buf_nh)); vnc_zlog_debug_verbose("%s: pfx %pFX, nh %pFX", __func__,
prefix, &pfx_nexthop);
vnc_zlog_debug_verbose("%s: pfx %s, nh %s", __func__, buf,
buf_nh);
} }
#if DEBUG_RHN_LIST #if DEBUG_RHN_LIST
print_rhn_list(__func__, "ENTER "); 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; struct prefix pfx_nexthop;
char buf[PREFIX_STRLEN];
char buf_nh[PREFIX_STRLEN];
prefix2str(prefix, buf, sizeof(buf));
rfapiUnicastNexthop2Prefix(afi, info->attr, &pfx_nexthop); rfapiUnicastNexthop2Prefix(afi, info->attr, &pfx_nexthop);
prefix2str(&pfx_nexthop, buf_nh, sizeof(buf_nh)); vnc_zlog_debug_verbose("%s: pfx %pFX, nh %pFX", __func__,
prefix, &pfx_nexthop);
vnc_zlog_debug_verbose("%s: pfx %s, nh %s", __func__, buf,
buf_nh);
} }
#if DEBUG_RHN_LIST #if DEBUG_RHN_LIST
print_rhn_list(__func__, "ENTER "); print_rhn_list(__func__, "ENTER ");

View File

@ -363,15 +363,11 @@ static int vnc_zebra_read_route(ZAPI_CALLBACK_ARGS)
else else
vnc_redistribute_delete(&api.prefix, api.type); vnc_redistribute_delete(&api.prefix, api.type);
if (BGP_DEBUG(zebra, ZEBRA)) { if (BGP_DEBUG(zebra, ZEBRA))
char buf[PREFIX_STRLEN];
prefix2str(&api.prefix, buf, sizeof(buf));
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: Zebra rcvd: route delete %s %s metric %u", "%s: Zebra rcvd: route delete %s %pFX metric %u",
__func__, zebra_route_string(api.type), buf, __func__, zebra_route_string(api.type), &api.prefix,
api.metric); api.metric);
}
return 0; 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)) { if (BGP_DEBUG(zebra, ZEBRA))
char buf[PREFIX_STRLEN];
prefix2str(&api.prefix, buf, sizeof(buf));
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: Zebra send: route %s %s, nhp_count=%d", __func__, "%s: Zebra send: route %s %pFX, nhp_count=%d", __func__,
(add ? "add" : "del"), buf, nhp_count); (add ? "add" : "del"), &api.prefix, nhp_count);
}
zclient_route_send((add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE), zclient_route_send((add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE),
zclient_vnc, &api); zclient_vnc, &api);

View File

@ -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) void show_ip_eigrp_prefix_entry(struct vty *vty, struct eigrp_prefix_entry *tn)
{ {
struct list *successors = eigrp_topology_get_successor(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, "%-3c", (tn->state > 0) ? 'A' : 'P');
vty_out(vty, "%s, ", vty_out(vty, "%pFX, ", tn->destination);
prefix2str(tn->destination, buffer, PREFIX_STRLEN));
vty_out(vty, "%u successors, ", (successors) ? successors->count : 0); vty_out(vty, "%u successors, ", (successors) ? successors->count : 0);
vty_out(vty, "FD is %u, serno: %" PRIu64 " \n", tn->fdistance, vty_out(vty, "FD is %u, serno: %" PRIu64 " \n", tn->fdistance,
tn->serno); tn->serno);

View File

@ -168,13 +168,10 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph,
* Destination must exists * Destination must exists
*/ */
if (!dest) { if (!dest) {
char buf[PREFIX_STRLEN];
flog_err( flog_err(
EC_EIGRP_PACKET, EC_EIGRP_PACKET,
"%s: Received prefix %s which we do not know about", "%s: Received prefix %pFX which we do not know about",
__func__, __func__, &dest_addr);
prefix2str(&dest_addr, buf, sizeof(buf)));
eigrp_IPv4_InternalTLV_free(tlv); eigrp_IPv4_InternalTLV_free(tlv);
continue; continue;
} }

View File

@ -133,14 +133,10 @@ void eigrp_prefix_entry_add(struct route_table *topology,
rn = route_node_get(topology, pe->destination); rn = route_node_get(topology, pe->destination);
if (rn->info) { if (rn->info) {
if (IS_DEBUG_EIGRP_EVENT) { if (IS_DEBUG_EIGRP_EVENT)
char buf[PREFIX_STRLEN];
zlog_debug( zlog_debug(
"%s: %s Should we have found this entry in the topo table?", "%s: %pFX Should we have found this entry in the topo table?",
__func__, __func__, pe->destination);
prefix2str(pe->destination, buf, sizeof(buf)));
}
route_unlock_node(rn); route_unlock_node(rn);
} }

View File

@ -141,10 +141,8 @@ static void eigrp_update_receive_GR_ask(struct eigrp *eigrp,
/* iterate over all prefixes which weren't advertised by neighbor */ /* iterate over all prefixes which weren't advertised by neighbor */
for (ALL_LIST_ELEMENTS_RO(nbr_prefixes, node1, prefix)) { for (ALL_LIST_ELEMENTS_RO(nbr_prefixes, node1, prefix)) {
char buffer[PREFIX_STRLEN]; zlog_debug("GR receive: Neighbor not advertised %pFX",
zlog_debug( prefix->destination);
"GR receive: Neighbor not advertised %s",
prefix2str(prefix->destination, buffer, PREFIX_STRLEN));
fsm_msg.metrics = prefix->reported_metric; fsm_msg.metrics = prefix->reported_metric;
/* set delay to MAX */ /* set delay to MAX */

View File

@ -150,12 +150,9 @@ static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS)
if (c == NULL) if (c == NULL)
return 0; return 0;
if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) { if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
char buf[128]; zlog_debug("Zebra: interface %s address add %pFX", c->ifp->name,
prefix2str(c->address, buf, sizeof(buf)); c->address);
zlog_debug("Zebra: interface %s address add %s", c->ifp->name,
buf);
}
eigrp_if_update(c->ifp); eigrp_if_update(c->ifp);
@ -173,12 +170,9 @@ static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS)
if (c == NULL) if (c == NULL)
return 0; return 0;
if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) { if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
char buf[128]; zlog_debug("Zebra: interface %s address delete %pFX",
prefix2str(c->address, buf, sizeof(buf)); c->ifp->name, c->address);
zlog_debug("Zebra: interface %s address delete %s",
c->ifp->name, buf);
}
ifp = c->ifp; ifp = c->ifp;
ei = ifp->info; ei = ifp->info;
@ -234,10 +228,9 @@ void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p,
api.nexthop_num = count; api.nexthop_num = count;
if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) { if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) {
char buf[2][PREFIX_STRLEN]; char buf[PREFIX_STRLEN];
zlog_debug("Zebra: Route add %s nexthop %s", zlog_debug("Zebra: Route add %pFX nexthop %s", p,
prefix2str(p, buf[0], PREFIX_STRLEN), inet_ntop(AF_INET, 0, buf, PREFIX_STRLEN));
inet_ntop(AF_INET, 0, buf[1], PREFIX_STRLEN));
} }
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); 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)); memcpy(&api.prefix, p, sizeof(*p));
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) { if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE))
char buf[PREFIX_STRLEN]; zlog_debug("Zebra: Route del %pFX", p);
zlog_debug("Zebra: Route del %s",
prefix2str(p, buf, PREFIX_STRLEN));
}
return; return;
} }

View File

@ -253,9 +253,6 @@ void isis_circuit_add_addr(struct isis_circuit *circuit,
{ {
struct listnode *node; struct listnode *node;
struct prefix_ipv4 *ipv4; struct prefix_ipv4 *ipv4;
#if defined(EXTREME_DEBUG)
char buf[PREFIX2STR_BUFFER];
#endif
struct prefix_ipv6 *ipv6; struct prefix_ipv6 *ipv6;
if (connected->address->family == AF_INET) { if (connected->address->family == AF_INET) {
@ -287,9 +284,8 @@ void isis_circuit_add_addr(struct isis_circuit *circuit,
0); 0);
#ifdef EXTREME_DEBUG #ifdef EXTREME_DEBUG
prefix2str(connected->address, buf, sizeof(buf)); zlog_debug("Added IP address %pFX to circuit %s",
zlog_debug("Added IP address %s to circuit %s", buf, connected->address, circuit->interface->name);
circuit->interface->name);
#endif /* EXTREME_DEBUG */ #endif /* EXTREME_DEBUG */
} }
if (connected->address->family == AF_INET6) { if (connected->address->family == AF_INET6) {
@ -318,9 +314,8 @@ void isis_circuit_add_addr(struct isis_circuit *circuit,
0); 0);
#ifdef EXTREME_DEBUG #ifdef EXTREME_DEBUG
prefix2str(connected->address, buf, sizeof(buf)); zlog_debug("Added IPv6 address %pFX to circuit %s",
zlog_debug("Added IPv6 address %s to circuit %s", buf, connected->address, circuit->interface->name);
circuit->interface->name);
#endif /* EXTREME_DEBUG */ #endif /* EXTREME_DEBUG */
} }
return; return;
@ -331,7 +326,6 @@ void isis_circuit_del_addr(struct isis_circuit *circuit,
{ {
struct prefix_ipv4 *ipv4, *ip = NULL; struct prefix_ipv4 *ipv4, *ip = NULL;
struct listnode *node; struct listnode *node;
char buf[PREFIX2STR_BUFFER];
struct prefix_ipv6 *ipv6, *ip6 = NULL; struct prefix_ipv6 *ipv6, *ip6 = NULL;
int found = 0; int found = 0;
@ -352,16 +346,14 @@ void isis_circuit_del_addr(struct isis_circuit *circuit,
lsp_regenerate_schedule(circuit->area, lsp_regenerate_schedule(circuit->area,
circuit->is_type, 0); circuit->is_type, 0);
} else { } else {
prefix2str(connected->address, buf, sizeof(buf));
zlog_warn( zlog_warn(
"Nonexistent ip address %s removal attempt from circuit %s", "Nonexistent ip address %pFX removal attempt from circuit %s",
buf, circuit->interface->name); connected->address, circuit->interface->name);
zlog_warn("Current ip addresses on %s:", zlog_warn("Current ip addresses on %s:",
circuit->interface->name); circuit->interface->name);
for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node, for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node,
ip)) { ip)) {
prefix2str(ip, buf, sizeof(buf)); zlog_warn(" %pFX", ip);
zlog_warn(" %s", buf);
} }
zlog_warn("End of addresses"); zlog_warn("End of addresses");
} }
@ -400,25 +392,18 @@ void isis_circuit_del_addr(struct isis_circuit *circuit,
} }
if (!found) { if (!found) {
prefix2str(connected->address, buf, sizeof(buf));
zlog_warn( zlog_warn(
"Nonexistent ip address %s removal attempt from circuit %s", "Nonexistent ip address %pFX removal attempt from circuit %s",
buf, circuit->interface->name); connected->address, circuit->interface->name);
zlog_warn("Current ip addresses on %s:", zlog_warn("Current ip addresses on %s:",
circuit->interface->name); circuit->interface->name);
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node, for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node,
ip6)) { ip6))
prefix2str((struct prefix *)ip6, (char *)buf, zlog_warn(" %pFX", (struct prefix *)ip6);
sizeof(buf));
zlog_warn(" %s", buf);
}
zlog_warn(" -----"); zlog_warn(" -----");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node, for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node,
ip6)) { ip6))
prefix2str((struct prefix *)ip6, (char *)buf, zlog_warn(" %pFX", (struct prefix *)ip6);
sizeof(buf));
zlog_warn(" %s", buf);
}
zlog_warn("End of addresses"); zlog_warn("End of addresses");
} else if (circuit->area) } else if (circuit->area)
lsp_regenerate_schedule(circuit->area, circuit->is_type, 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) { if (detail == ISIS_UI_LEVEL_DETAIL) {
struct listnode *node; struct listnode *node;
struct prefix *ip_addr; struct prefix *ip_addr;
char buf[BUFSIZ];
vty_out(vty, " Interface: %s", circuit->interface->name); vty_out(vty, " Interface: %s", circuit->interface->name);
vty_out(vty, ", State: %s", 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) { if (circuit->ip_addrs && listcount(circuit->ip_addrs) > 0) {
vty_out(vty, " IP Prefix(es):\n"); vty_out(vty, " IP Prefix(es):\n");
for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node, for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node,
ip_addr)) { ip_addr))
prefix2str(ip_addr, buf, sizeof(buf)); vty_out(vty, " %pFX\n", ip_addr);
vty_out(vty, " %s\n", buf);
}
} }
if (circuit->ipv6_link && listcount(circuit->ipv6_link) > 0) { if (circuit->ipv6_link && listcount(circuit->ipv6_link) > 0) {
vty_out(vty, " IPv6 Link-Locals:\n"); vty_out(vty, " IPv6 Link-Locals:\n");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node, for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node,
ip_addr)) { ip_addr))
prefix2str(ip_addr, (char *)buf, BUFSIZ); vty_out(vty, " %pFX\n", ip_addr);
vty_out(vty, " %s\n", buf);
}
} }
if (circuit->ipv6_non_link if (circuit->ipv6_non_link
&& listcount(circuit->ipv6_non_link) > 0) { && listcount(circuit->ipv6_non_link) > 0) {
vty_out(vty, " IPv6 Prefixes:\n"); vty_out(vty, " IPv6 Prefixes:\n");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node, for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node,
ip_addr)) { ip_addr))
prefix2str(ip_addr, (char *)buf, BUFSIZ); vty_out(vty, " %pFX\n", ip_addr);
vty_out(vty, " %s\n", buf);
}
} }
vty_out(vty, "\n"); vty_out(vty, "\n");

View File

@ -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) static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
{ {
int level = lsp->level; int level = lsp->level;
char buf[PREFIX2STR_BUFFER];
struct listnode *node; struct listnode *node;
struct isis_lsp *frag; 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) { if (area->isis->router_id != 0) {
struct in_addr id = {.s_addr = area->isis->router_id}; 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 %pI4 as IPv4 tlv.",
lsp_debug("ISIS (%s): Adding router ID %s as IPv4 tlv.", area->area_tag, &id);
area->area_tag, buf);
isis_tlvs_add_ipv4_address(lsp->tlvs, &id); isis_tlvs_add_ipv4_address(lsp->tlvs, &id);
/* If new style TLV's are in use, add TE router ID TLV /* 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)) { ipv4)) {
if (area->oldmetric) { if (area->oldmetric) {
lsp_debug( lsp_debug(
"ISIS (%s): Adding old-style IP reachability for %s", "ISIS (%s): Adding old-style IP reachability for %pFX",
area->area_tag, area->area_tag, ipv4);
prefix2str(ipv4, buf,
sizeof(buf)));
isis_tlvs_add_oldstyle_ip_reach( isis_tlvs_add_oldstyle_ip_reach(
lsp->tlvs, ipv4, metric); 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; struct sr_prefix_cfg *pcfg = NULL;
lsp_debug( lsp_debug(
"ISIS (%s): Adding te-style IP reachability for %s", "ISIS (%s): Adding te-style IP reachability for %pFX",
area->area_tag, area->area_tag, ipv4);
prefix2str(ipv4, buf,
sizeof(buf)));
if (area->srdb.enabled) if (area->srdb.enabled)
pcfg = isis_sr_cfg_prefix_find( 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; struct sr_prefix_cfg *pcfg = NULL;
lsp_debug( lsp_debug(
"ISIS (%s): Adding IPv6 reachability for %s", "ISIS (%s): Adding IPv6 reachability for %pFX",
area->area_tag, area->area_tag, ipv6);
prefix2str(ipv6, buf, sizeof(buf)));
if (area->srdb.enabled) if (area->srdb.enabled)
pcfg = isis_sr_cfg_prefix_find(area, pcfg = isis_sr_cfg_prefix_find(area,

View File

@ -231,11 +231,8 @@ void isis_redist_add(struct isis *isis, int type, struct prefix *p,
int level; int level;
struct isis_redist *redist; struct isis_redist *redist;
char debug_buf[BUFSIZ]; zlog_debug("%s: New route %pFX from %s: distance %d.", __func__, p,
prefix2str(p, debug_buf, sizeof(debug_buf)); zebra_route_string(type), distance);
zlog_debug("%s: New route %s from %s: distance %d.", __func__,
debug_buf, zebra_route_string(type), distance);
if (!ei_table) { if (!ei_table) {
zlog_warn("%s: External information table not initialized.", 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; int level;
struct isis_redist *redist; struct isis_redist *redist;
char debug_buf[BUFSIZ]; zlog_debug("%s: Removing route %pFX from %s.", __func__, p,
prefix2str(p, debug_buf, sizeof(debug_buf));
zlog_debug("%s: Removing route %s from %s.", __func__, debug_buf,
zebra_route_string(type)); zebra_route_string(type));
if (is_default_prefix(p) 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); ei_node = srcdest_rnode_lookup(ei_table, p, src_p);
if (!ei_node || !ei_node->info) { if (!ei_node || !ei_node->info) {
char buf[BUFSIZ];
prefix2str(p, buf, sizeof(buf));
zlog_warn( zlog_warn(
"%s: Got a delete for %s route %s, but that route was never added.", "%s: Got a delete for %s route %pFX, but that route was never added.",
__func__, zebra_route_string(type), buf); __func__, zebra_route_string(type), p);
if (ei_node) if (ei_node)
route_unlock_node(ei_node); route_unlock_node(ei_node);
return; return;

View File

@ -313,12 +313,8 @@ struct isis_route_info *isis_route_create(struct prefix *prefix,
{ {
struct route_node *route_node; struct route_node *route_node;
struct isis_route_info *rinfo_new, *rinfo_old, *route_info = NULL; struct isis_route_info *rinfo_new, *rinfo_old, *route_info = NULL;
char buff[PREFIX2STR_BUFFER];
char change_buf[64]; char change_buf[64];
/* for debugs */
prefix2str(prefix, buff, sizeof(buff));
if (!table) if (!table)
return NULL; return NULL;
@ -329,31 +325,32 @@ struct isis_route_info *isis_route_create(struct prefix *prefix,
rinfo_old = route_node->info; rinfo_old = route_node->info;
if (!rinfo_old) { if (!rinfo_old) {
if (IS_DEBUG_RTE_EVENTS) if (IS_DEBUG_RTE_EVENTS)
zlog_debug("ISIS-Rte (%s) route created: %s", zlog_debug("ISIS-Rte (%s) route created: %pFX",
area->area_tag, buff); area->area_tag, prefix);
route_info = rinfo_new; route_info = rinfo_new;
UNSET_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); UNSET_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
} else { } else {
route_unlock_node(route_node); route_unlock_node(route_node);
#ifdef EXTREME_DEBUG #ifdef EXTREME_DEBUG
if (IS_DEBUG_RTE_EVENTS) if (IS_DEBUG_RTE_EVENTS)
zlog_debug("ISIS-Rte (%s) route already exists: %s", zlog_debug("ISIS-Rte (%s) route already exists: %pFX",
area->area_tag, buff); area->area_tag, prefix);
#endif /* EXTREME_DEBUG */ #endif /* EXTREME_DEBUG */
if (isis_route_info_same(rinfo_new, rinfo_old, change_buf, if (isis_route_info_same(rinfo_new, rinfo_old, change_buf,
sizeof(change_buf))) { sizeof(change_buf))) {
#ifdef EXTREME_DEBUG #ifdef EXTREME_DEBUG
if (IS_DEBUG_RTE_EVENTS) if (IS_DEBUG_RTE_EVENTS)
zlog_debug("ISIS-Rte (%s) route unchanged: %s", zlog_debug(
area->area_tag, buff); "ISIS-Rte (%s) route unchanged: %pFX",
area->area_tag, prefix);
#endif /* EXTREME_DEBUG */ #endif /* EXTREME_DEBUG */
isis_route_info_delete(rinfo_new); isis_route_info_delete(rinfo_new);
route_info = rinfo_old; route_info = rinfo_old;
} else { } else {
if (IS_DEBUG_RTE_EVENTS) if (IS_DEBUG_RTE_EVENTS)
zlog_debug( zlog_debug(
"ISIS-Rte (%s): route changed: %s, change: %s", "ISIS-Rte (%s): route changed: %pFX, change: %s",
area->area_tag, buff, change_buf); area->area_tag, prefix, change_buf);
isis_route_info_delete(rinfo_old); isis_route_info_delete(rinfo_old);
route_info = rinfo_new; route_info = rinfo_new;
UNSET_FLAG(route_info->flag, UNSET_FLAG(route_info->flag,

View File

@ -87,10 +87,6 @@ static int isis_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
{ {
struct isis_circuit *circuit; struct isis_circuit *circuit;
struct connected *c; 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, c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_ADD,
zclient->ibuf, vrf_id); zclient->ibuf, vrf_id);
@ -99,13 +95,10 @@ static int isis_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
return 0; return 0;
#ifdef EXTREME_DEBUG #ifdef EXTREME_DEBUG
p = c->address;
prefix2str(p, buf, sizeof(buf));
if (p->family == AF_INET) 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) if (p->family == AF_INET6)
zlog_debug("connected IPv6 address %s", buf); zlog_debug("connected IPv6 address %pFX", c->address);
#endif /* EXTREME_DEBUG */ #endif /* EXTREME_DEBUG */
if (if_is_operative(c->ifp)) { 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 isis_circuit *circuit;
struct connected *c; 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, c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_DELETE,
zclient->ibuf, vrf_id); zclient->ibuf, vrf_id);
@ -133,13 +122,10 @@ static int isis_zebra_if_address_del(ZAPI_CALLBACK_ARGS)
return 0; return 0;
#ifdef EXTREME_DEBUG #ifdef EXTREME_DEBUG
p = c->address;
prefix2str(p, buf, sizeof(buf));
if (p->family == AF_INET) 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) if (p->family == AF_INET6)
zlog_debug("disconnected IPv6 address %s", buf); zlog_debug("disconnected IPv6 address %pFX", c->address);
#endif /* EXTREME_DEBUG */ #endif /* EXTREME_DEBUG */
if (if_is_operative(c->ifp)) { if (if_is_operative(c->ifp)) {

View File

@ -2377,7 +2377,6 @@ route_map_result_t route_map_apply(struct route_map *map,
route_map_result_t ret = RMAP_PERMITMATCH; route_map_result_t ret = RMAP_PERMITMATCH;
struct route_map_index *index = NULL; struct route_map_index *index = NULL;
struct route_map_rule *set = NULL; struct route_map_rule *set = NULL;
char buf[PREFIX_STRLEN];
bool skip_match_clause = false; bool skip_match_clause = false;
if (recursion > RMAP_RECURSION_LIMIT) { if (recursion > RMAP_RECURSION_LIMIT) {
@ -2403,16 +2402,14 @@ route_map_result_t route_map_apply(struct route_map *map,
if (index) { if (index) {
if (rmap_debug) if (rmap_debug)
zlog_debug( zlog_debug(
"Best match route-map: %s, sequence: %d for pfx: %s, result: %s", "Best match route-map: %s, sequence: %d for pfx: %pFX, result: %s",
map->name, index->pref, map->name, index->pref, prefix,
prefix2str(prefix, buf, sizeof(buf)),
route_map_cmd_result_str(match_ret)); route_map_cmd_result_str(match_ret));
} else { } else {
if (rmap_debug) if (rmap_debug)
zlog_debug( zlog_debug(
"No best match sequence for pfx: %s in route-map: %s, result: %s", "No best match sequence for pfx: %pFX in route-map: %s, result: %s",
prefix2str(prefix, buf, sizeof(buf)), prefix, map->name,
map->name,
route_map_cmd_result_str(match_ret)); route_map_cmd_result_str(match_ret));
/* /*
* No index matches this prefix. Return deny unless, * 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); prefix, type, object);
if (rmap_debug) { if (rmap_debug) {
zlog_debug( zlog_debug(
"Route-map: %s, sequence: %d, prefix: %s, result: %s", "Route-map: %s, sequence: %d, prefix: %pFX, result: %s",
map->name, index->pref, map->name, index->pref, prefix,
prefix2str(prefix, buf, sizeof(buf)),
route_map_cmd_result_str(match_ret)); route_map_cmd_result_str(match_ret));
} }
} else } else
@ -2549,12 +2545,10 @@ route_map_result_t route_map_apply(struct route_map *map,
} }
route_map_apply_end: route_map_apply_end:
if (rmap_debug) { if (rmap_debug)
zlog_debug("Route-map: %s, prefix: %s, result: %s", zlog_debug("Route-map: %s, prefix: %pFX, result: %s",
(map ? map->name : "null"), (map ? map->name : "null"), prefix,
prefix2str(prefix, buf, sizeof(buf)),
route_map_result_str(ret)); route_map_result_str(ret));
}
return (ret); return (ret);
} }

View File

@ -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)) { if (CHECK_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP)) {
/* limit the number of nexthops if necessary */ /* limit the number of nexthops if necessary */
if (api->nexthop_num > MULTIPATH_NUM) { if (api->nexthop_num > MULTIPATH_NUM) {
char buf[PREFIX2STR_BUFFER];
prefix2str(&api->prefix, buf, sizeof(buf));
flog_err( flog_err(
EC_LIB_ZAPI_ENCODE, EC_LIB_ZAPI_ENCODE,
"%s: prefix %s: can't encode %u nexthops (maximum is %u)", "%s: prefix %pFX: can't encode %u nexthops (maximum is %u)",
__func__, buf, api->nexthop_num, MULTIPATH_NUM); __func__, &api->prefix, api->nexthop_num,
MULTIPATH_NUM);
return -1; 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 */ /* MPLS labels for BGP-LU or Segment Routing */
if (api_nh->label_num > MPLS_MAX_LABELS) { if (api_nh->label_num > MPLS_MAX_LABELS) {
char buf[PREFIX2STR_BUFFER]; flog_err(
EC_LIB_ZAPI_ENCODE,
prefix2str(&api->prefix, buf, sizeof(buf)); "%s: prefix %pFX: can't encode %u labels (maximum is %u)",
__func__, &api->prefix,
flog_err(EC_LIB_ZAPI_ENCODE, api_nh->label_num, MPLS_MAX_LABELS);
"%s: prefix %s: can't encode %u labels (maximum is %u)",
__func__, buf,
api_nh->label_num,
MPLS_MAX_LABELS);
return -1; 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)) { if (CHECK_FLAG(api->message, ZAPI_MESSAGE_BACKUP_NEXTHOPS)) {
/* limit the number of nexthops if necessary */ /* limit the number of nexthops if necessary */
if (api->backup_nexthop_num > MULTIPATH_NUM) { if (api->backup_nexthop_num > MULTIPATH_NUM) {
char buf[PREFIX2STR_BUFFER];
prefix2str(&api->prefix, buf, sizeof(buf));
flog_err( flog_err(
EC_LIB_ZAPI_ENCODE, EC_LIB_ZAPI_ENCODE,
"%s: prefix %s: can't encode %u backup nexthops (maximum is %u)", "%s: prefix %pFX: can't encode %u backup nexthops (maximum is %u)",
__func__, buf, api->backup_nexthop_num, __func__, &api->prefix, api->backup_nexthop_num,
MULTIPATH_NUM); MULTIPATH_NUM);
return -1; 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 */ /* MPLS labels for BGP-LU or Segment Routing */
if (api_nh->label_num > MPLS_MAX_LABELS) { if (api_nh->label_num > MPLS_MAX_LABELS) {
char buf[PREFIX2STR_BUFFER]; flog_err(
EC_LIB_ZAPI_ENCODE,
prefix2str(&api->prefix, buf, sizeof(buf)); "%s: prefix %pFX: backup: can't encode %u labels (maximum is %u)",
__func__, &api->prefix,
flog_err(EC_LIB_ZAPI_ENCODE, api_nh->label_num, MPLS_MAX_LABELS);
"%s: prefix %s: backup: can't encode %u labels (maximum is %u)",
__func__, buf,
api_nh->label_num,
MPLS_MAX_LABELS);
return -1; 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)) { else if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) {
/* carp interfaces on OpenBSD with 0.0.0.0/0 as /* carp interfaces on OpenBSD with 0.0.0.0/0 as
* "peer" */ * "peer" */
char buf[PREFIX_STRLEN];
flog_err( flog_err(
EC_LIB_ZAPI_ENCODE, EC_LIB_ZAPI_ENCODE,
"warning: interface %s address %s with peer flag set, but no peer address!", "warning: interface %s address %pFX with peer flag set, but no peer address!",
ifp->name, ifp->name, ifc->address);
prefix2str(ifc->address, buf,
sizeof(buf)));
UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER); UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
} }
} }

View File

@ -220,8 +220,8 @@ static void nhrp_interface_update_address(struct interface *ifp, afi_t afi,
/* On NHRP interfaces a host prefix is required */ /* On NHRP interfaces a host prefix is required */
if (best && if_ad->configured if (best && if_ad->configured
&& best->address->prefixlen != 8 * prefix_blen(best->address)) { && best->address->prefixlen != 8 * prefix_blen(best->address)) {
zlog_notice("%s: %s is not a host prefix", ifp->name, zlog_notice("%s: %pFX is not a host prefix", ifp->name,
prefix2str(best->address, buf, sizeof(buf))); best->address);
best = NULL; best = NULL;
} }
@ -335,14 +335,13 @@ int nhrp_ifp_down(struct interface *ifp)
int nhrp_interface_address_add(ZAPI_CALLBACK_ARGS) int nhrp_interface_address_add(ZAPI_CALLBACK_ARGS)
{ {
struct connected *ifc; struct connected *ifc;
char buf[PREFIX_STRLEN];
ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (ifc == NULL) if (ifc == NULL)
return 0; return 0;
debugf(NHRP_DEBUG_IF, "if-addr-add: %s: %s", ifc->ifp->name, debugf(NHRP_DEBUG_IF, "if-addr-add: %s: %pFX", ifc->ifp->name,
prefix2str(ifc->address, buf, sizeof(buf))); ifc->address);
nhrp_interface_update_address( nhrp_interface_update_address(
ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0); 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) int nhrp_interface_address_delete(ZAPI_CALLBACK_ARGS)
{ {
struct connected *ifc; struct connected *ifc;
char buf[PREFIX_STRLEN];
ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (ifc == NULL) if (ifc == NULL)
return 0; return 0;
debugf(NHRP_DEBUG_IF, "if-addr-del: %s: %s", ifc->ifp->name, debugf(NHRP_DEBUG_IF, "if-addr-del: %s: %pFX", ifc->ifp->name,
prefix2str(ifc->address, buf, sizeof(buf))); ifc->address);
nhrp_interface_update_address( nhrp_interface_update_address(
ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0); ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0);

View File

@ -166,14 +166,13 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type,
} }
if (unlikely(debug_flags & NHRP_DEBUG_ROUTE)) { 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( zlog_debug(
"Zebra send: route %s %s nexthop %s metric %u count %d dev %s", "Zebra send: route %s %pFX nexthop %s metric %u count %d dev %s",
add ? "add" : "del", buf[0], add ? "add" : "del", &api.prefix,
nexthop ? inet_ntop(api.prefix.family, &api_nh->gate, nexthop ? inet_ntop(api.prefix.family, &api_nh->gate,
buf[1], sizeof(buf[1])) buf, sizeof(buf))
: "<onlink>", : "<onlink>",
api.metric, api.nexthop_num, ifp ? ifp->name : "none"); 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 zapi_nexthop *api_nh;
struct interface *ifp = NULL; struct interface *ifp = NULL;
union sockunion nexthop_addr; union sockunion nexthop_addr;
char buf[2][PREFIX_STRLEN]; char buf[PREFIX_STRLEN];
int added; int added;
if (zapi_route_decode(zclient->ibuf, &api) < 0) 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); added = (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD);
debugf(NHRP_DEBUG_ROUTE, "if-route-%s: %s via %s dev %s", debugf(NHRP_DEBUG_ROUTE, "if-route-%s: %pFX via %s dev %s",
added ? "add" : "del", added ? "add" : "del", &api.prefix,
prefix2str(&api.prefix, buf[0], sizeof(buf[0])), sockunion2str(&nexthop_addr, buf, sizeof(buf)),
sockunion2str(&nexthop_addr, buf[1], sizeof(buf[1])),
ifp ? ifp->name : "(none)"); ifp ? ifp->name : "(none)");
nhrp_route_update_zebra(&api.prefix, &nexthop_addr, ifp); 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 route_info *ri;
struct prefix lookup; struct prefix lookup;
afi_t afi = family2afi(sockunion_family(addr)); afi_t afi = family2afi(sockunion_family(addr));
char buf[PREFIX_STRLEN];
sockunion2hostprefix(addr, &lookup); sockunion2hostprefix(addr, &lookup);
@ -250,8 +247,7 @@ int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p,
ri = rn->info; ri = rn->info;
if (ri->nhrp_ifp) { if (ri->nhrp_ifp) {
debugf(NHRP_DEBUG_ROUTE, "lookup %s: nhrp_if=%s", debugf(NHRP_DEBUG_ROUTE, "lookup %pFX: nhrp_if=%s", &lookup,
prefix2str(&lookup, buf, sizeof(buf)),
ri->nhrp_ifp->name); ri->nhrp_ifp->name);
if (via) if (via)
@ -259,9 +255,8 @@ int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p,
if (ifp) if (ifp)
*ifp = ri->nhrp_ifp; *ifp = ri->nhrp_ifp;
} else { } else {
debugf(NHRP_DEBUG_ROUTE, "lookup %s: zebra route dev %s", debugf(NHRP_DEBUG_ROUTE, "lookup %pFX: zebra route dev %s",
prefix2str(&lookup, buf, sizeof(buf)), &lookup, ri->ifp ? ri->ifp->name : "(none)");
ri->ifp ? ri->ifp->name : "(none)");
if (via) if (via)
*via = ri->via; *via = ri->via;

View File

@ -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) static void nhrp_shortcut_check_use(struct nhrp_shortcut *s)
{ {
char buf[PREFIX_STRLEN];
if (s->expiring && s->cache && s->cache->used) { if (s->expiring && s->cache && s->cache->used) {
debugf(NHRP_DEBUG_ROUTE, "Shortcut %s used and expiring", debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX used and expiring",
prefix2str(s->p, buf, sizeof(buf))); s->p);
nhrp_shortcut_send_resolution_req(s); 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, static void nhrp_shortcut_cache_notify(struct notifier_block *n,
unsigned long cmd) unsigned long cmd)
{ {
char buf[PREFIX_STRLEN];
struct nhrp_shortcut *s = struct nhrp_shortcut *s =
container_of(n, struct nhrp_shortcut, cache_notifier); 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: case NOTIFY_CACHE_UP:
if (!s->route_installed) { if (!s->route_installed) {
debugf(NHRP_DEBUG_ROUTE, debugf(NHRP_DEBUG_ROUTE,
"Shortcut: route install %s nh (unspec) dev %s", "Shortcut: route install %pFX nh (unspec) dev %s",
prefix2str(s->p, buf, sizeof(buf)), s->p, s->cache->ifp->name);
s->cache->ifp->name);
nhrp_route_announce(1, s->type, s->p, s->cache->ifp, nhrp_route_announce(1, s->type, s->p, s->cache->ifp,
NULL, 0); NULL, 0);
@ -152,13 +147,11 @@ static void nhrp_shortcut_delete(struct nhrp_shortcut *s)
{ {
struct route_node *rn; struct route_node *rn;
afi_t afi = family2afi(PREFIX_FAMILY(s->p)); afi_t afi = family2afi(PREFIX_FAMILY(s->p));
char buf[PREFIX_STRLEN];
THREAD_OFF(s->t_timer); THREAD_OFF(s->t_timer);
nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid); nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid);
debugf(NHRP_DEBUG_ROUTE, "Shortcut %s purged", debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX purged", s->p);
prefix2str(s->p, buf, sizeof(buf)));
nhrp_shortcut_update_binding(s, NHRP_CACHE_INVALID, NULL, 0); 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 nhrp_shortcut *s;
struct route_node *rn; struct route_node *rn;
char buf[PREFIX_STRLEN];
afi_t afi = family2afi(PREFIX_FAMILY(p)); afi_t afi = family2afi(PREFIX_FAMILY(p));
if (!shortcut_rib[afi]) if (!shortcut_rib[afi])
@ -197,8 +189,7 @@ static struct nhrp_shortcut *nhrp_shortcut_get(struct prefix *p)
s->type = NHRP_CACHE_INVALID; s->type = NHRP_CACHE_INVALID;
s->p = &rn->p; s->p = &rn->p;
debugf(NHRP_DEBUG_ROUTE, "Shortcut %s created", debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX created", s->p);
prefix2str(s->p, buf, sizeof(buf)));
} else { } else {
s = rn->info; s = rn->info;
route_unlock_node(rn); 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; union sockunion *proto, cie_proto, *nbma, cie_nbma, nat_nbma;
struct prefix prefix, route_prefix; struct prefix prefix, route_prefix;
struct zbuf extpl; struct zbuf extpl;
char bufp[PREFIX_STRLEN], buf[4][SU_ADDRSTRLEN]; char buf[4][SU_ADDRSTRLEN];
int holding_time = pp->if_ad->holdtime; int holding_time = pp->if_ad->holdtime;
nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid); 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, debugf(NHRP_DEBUG_COMMON,
"Shortcut: %s is at proto %s dst_proto %s cie-nbma %s nat-nbma %s cie-holdtime %d", "Shortcut: %pFX is at proto %s dst_proto %s cie-nbma %s nat-nbma %s cie-holdtime %d",
prefix2str(&prefix, bufp, sizeof(bufp)), &prefix, sockunion2str(proto, buf[0], sizeof(buf[0])),
sockunion2str(proto, buf[0], sizeof(buf[0])),
sockunion2str(&pp->dst_proto, buf[1], sizeof(buf[1])), sockunion2str(&pp->dst_proto, buf[1], sizeof(buf[1])),
sockunion2str(&cie_nbma, buf[2], sizeof(buf[2])), sockunion2str(&cie_nbma, buf[2], sizeof(buf[2])),
sockunion2str(&nat_nbma, buf[3], sizeof(buf[3])), sockunion2str(&nat_nbma, buf[3], sizeof(buf[3])),

View File

@ -153,7 +153,6 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
struct ospf6_inter_router_lsa *router_lsa; struct ospf6_inter_router_lsa *router_lsa;
struct ospf6_route_table *summary_table = NULL; struct ospf6_route_table *summary_table = NULL;
uint16_t type; uint16_t type;
char buf[PREFIX2STR_BUFFER];
int is_debug = 0; int is_debug = 0;
/* Only destination type network, range or ASBR are considered */ /* 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 (route->type == OSPF6_DEST_TYPE_ROUTER) {
if (ADV_ROUTER_IN_PREFIX(&route->prefix) if (ADV_ROUTER_IN_PREFIX(&route->prefix)
== area->ospf6->router_id) { == area->ospf6->router_id) {
inet_ntop(AF_INET,
&(ADV_ROUTER_IN_PREFIX(&route->prefix)), buf,
sizeof(buf));
zlog_debug( zlog_debug(
"%s: Skipping ASBR announcement for ABR (%s)", "%s: Skipping ASBR announcement for ABR (%pFX)",
__func__, buf); __func__,
&ADV_ROUTER_IN_PREFIX(&route->prefix));
return 0; return 0;
} }
} }
@ -210,11 +207,10 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
if (IS_OSPF6_DEBUG_ABR if (IS_OSPF6_DEBUG_ABR
|| IS_OSPF6_DEBUG_ORIGINATE(INTER_ROUTER)) { || IS_OSPF6_DEBUG_ORIGINATE(INTER_ROUTER)) {
is_debug++; is_debug++;
inet_ntop(AF_INET, zlog_debug(
&(ADV_ROUTER_IN_PREFIX(&route->prefix)), buf, "Originating summary in area %s for ASBR %pFX",
sizeof(buf)); area->name,
zlog_debug("Originating summary in area %s for ASBR %s", &ADV_ROUTER_IN_PREFIX(&route->prefix));
area->name, buf);
} }
summary_table = area->summary_router; summary_table = area->summary_router;
} else { } else {
@ -226,16 +222,13 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
route->path.origin.type == route->path.origin.type ==
htons(OSPF6_LSTYPE_INTER_PREFIX)) { htons(OSPF6_LSTYPE_INTER_PREFIX)) {
if (!CHECK_FLAG(route->flag, OSPF6_ROUTE_BEST)) { if (!CHECK_FLAG(route->flag, OSPF6_ROUTE_BEST)) {
if (is_debug) { if (is_debug)
inet_ntop(AF_INET,
&(ADV_ROUTER_IN_PREFIX(
&route->prefix)), buf,
sizeof(buf));
zlog_debug( zlog_debug(
"%s: route %s with cost %u is not best, ignore.", "%s: route %pFX with cost %u is not best, ignore.",
__func__, buf, __func__,
&ADV_ROUTER_IN_PREFIX(
&route->prefix),
route->path.cost); route->path.cost);
}
return 0; return 0;
} }
} }
@ -243,23 +236,19 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
if (route->path.origin.type == if (route->path.origin.type ==
htons(OSPF6_LSTYPE_INTRA_PREFIX)) { htons(OSPF6_LSTYPE_INTRA_PREFIX)) {
if (!CHECK_FLAG(route->flag, OSPF6_ROUTE_BEST)) { if (!CHECK_FLAG(route->flag, OSPF6_ROUTE_BEST)) {
if (is_debug) { if (is_debug)
prefix2str(&route->prefix, buf,
sizeof(buf));
zlog_debug( zlog_debug(
"%s: intra-prefix route %s with cost %u is not best, ignore.", "%s: intra-prefix route %pFX with cost %u is not best, ignore.",
__func__, buf, __func__, &route->prefix,
route->path.cost); route->path.cost);
}
return 0; return 0;
} }
} }
if (is_debug) { if (is_debug)
prefix2str(&route->prefix, buf, sizeof(buf)); zlog_debug(
zlog_debug("Originating summary in area %s for %s cost %u", "Originating summary in area %s for %pFX cost %u",
area->name, buf, route->path.cost); area->name, &route->prefix, route->path.cost);
}
summary_table = area->summary_prefix; 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) if (range && !CHECK_FLAG(range->flag, OSPF6_ROUTE_REMOVE)
&& (route->path.area_id != OSPF_AREA_BACKBONE && (route->path.area_id != OSPF_AREA_BACKBONE
|| !IS_AREA_TRANSIT(area))) { || !IS_AREA_TRANSIT(area))) {
if (is_debug) { if (is_debug)
prefix2str(&range->prefix, buf, sizeof(buf)); zlog_debug(
zlog_debug("Suppressed by range %s of area %s", "Suppressed by range %pFX of area %s",
buf, route_area->name); &range->prefix, route_area->name);
}
ospf6_abr_delete_route(route, summary, summary_table, ospf6_abr_delete_route(route, summary, summary_table,
old); old);
return 0; return 0;
@ -411,15 +399,11 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
if (EXPORT_LIST(area)) if (EXPORT_LIST(area))
if (access_list_apply(EXPORT_LIST(area), &route->prefix) if (access_list_apply(EXPORT_LIST(area), &route->prefix)
== FILTER_DENY) { == FILTER_DENY) {
if (is_debug) { if (is_debug)
inet_ntop(AF_INET,
&(ADV_ROUTER_IN_PREFIX(
&route->prefix)),
buf, sizeof(buf));
zlog_debug( zlog_debug(
"prefix %s was denied by export list", "prefix %pFX was denied by export list",
buf); &ADV_ROUTER_IN_PREFIX(
} &route->prefix));
return 0; 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_OUT(area))
if (prefix_list_apply(PREFIX_LIST_OUT(area), &route->prefix) if (prefix_list_apply(PREFIX_LIST_OUT(area), &route->prefix)
!= PREFIX_PERMIT) { != PREFIX_PERMIT) {
if (is_debug) { if (is_debug)
inet_ntop(
AF_INET,
&(ADV_ROUTER_IN_PREFIX(&route->prefix)),
buf, sizeof(buf));
zlog_debug( zlog_debug(
"prefix %s was denied by filter-list out", "prefix %pFX was denied by filter-list out",
buf); &ADV_ROUTER_IN_PREFIX(&route->prefix));
}
return 0; return 0;
} }
@ -798,7 +777,6 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa,
struct ospf6_path *o_path; struct ospf6_path *o_path;
struct ospf6_nexthop *nh, *rnh; struct ospf6_nexthop *nh, *rnh;
bool nh_updated = false; bool nh_updated = false;
char buf[PREFIX2STR_BUFFER];
for (ALL_LIST_ELEMENTS(old->paths, anode, anext, o_path)) { for (ALL_LIST_ELEMENTS(old->paths, anode, anext, o_path)) {
if (o_path->origin.adv_router != lsa->header->adv_router 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 (nh_updated) {
if (listcount(old->paths)) { if (listcount(old->paths)) {
if (IS_OSPF6_DEBUG_ABR || if (IS_OSPF6_DEBUG_ABR
IS_OSPF6_DEBUG_EXAMIN(INTER_PREFIX)) { || IS_OSPF6_DEBUG_EXAMIN(INTER_PREFIX))
prefix2str(&old->prefix, buf, zlog_debug("%s: old %pFX updated nh %u",
sizeof(buf)); __func__, &old->prefix,
zlog_debug("%s: old %s updated nh %u",
__func__, buf,
old->nh_list ? listcount( old->nh_list ? listcount(
old->nh_list) old->nh_list)
: 0); : 0);
}
if (table->hook_add) if (table->hook_add)
(*table->hook_add)(old); (*table->hook_add)(old);
@ -1140,13 +1115,11 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
continue; continue;
if ((ospf6_route_cmp(route, old_route) != 0)) { if ((ospf6_route_cmp(route, old_route) != 0)) {
if (is_debug) { if (is_debug)
prefix2str(&prefix, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: old %p %s cost %u new route cost %u are not same", "%s: old %p %pFX cost %u new route cost %u are not same",
__func__, (void *)old_route, buf, __func__, (void *)old_route, &prefix,
old_route->path.cost, route->path.cost); old_route->path.cost, route->path.cost);
}
/* Check new route's adv. router is same in one of /* Check new route's adv. router is same in one of
* the paths with differed cost, if so remove the * the paths with differed cost, if so remove the

View File

@ -505,13 +505,12 @@ void ospf6_area_config_write(struct vty *vty)
struct listnode *node; struct listnode *node;
struct ospf6_area *oa; struct ospf6_area *oa;
struct ospf6_route *range; struct ospf6_route *range;
char buf[PREFIX2STR_BUFFER];
for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) {
for (range = ospf6_route_head(oa->range_table); range; for (range = ospf6_route_head(oa->range_table); range;
range = ospf6_route_next(range)) { range = ospf6_route_next(range)) {
prefix2str(&range->prefix, buf, sizeof(buf)); vty_out(vty, " area %s range %pFX", oa->name,
vty_out(vty, " area %s range %s", oa->name, buf); &range->prefix);
if (CHECK_FLAG(range->flag, if (CHECK_FLAG(range->flag,
OSPF6_ROUTE_DO_NOT_ADVERTISE)) { OSPF6_ROUTE_DO_NOT_ADVERTISE)) {

View File

@ -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_external_info *info = route->route_option;
struct ospf6_as_external_lsa *as_external_lsa; struct ospf6_as_external_lsa *as_external_lsa;
char buf[PREFIX2STR_BUFFER];
caddr_t p; caddr_t p;
if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE(AS_EXTERNAL)) { if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE(AS_EXTERNAL))
prefix2str(&route->prefix, buf, sizeof(buf)); zlog_debug("Originate AS-External-LSA for %pFX",
zlog_debug("Originate AS-External-LSA for %s", buf); &route->prefix);
}
/* prepare buffer */ /* prepare buffer */
memset(buffer, 0, sizeof(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 *anode, *anext;
struct listnode *nnode, *rnode, *rnext; struct listnode *nnode, *rnode, *rnext;
struct ospf6_nexthop *nh, *rnh; struct ospf6_nexthop *nh, *rnh;
char buf[PREFIX2STR_BUFFER];
bool route_found = false; bool route_found = false;
/* check for old entry match with new route origin, /* 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); listnode_add_sort(old_route->paths, ecmp_path);
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
prefix2str(&route->prefix, buf,
sizeof(buf));
zlog_debug( zlog_debug(
"%s: route %s another path added with nh %u, effective paths %u nh %u", "%s: route %pFX another path added with nh %u, effective paths %u nh %u",
__func__, buf, __func__, &route->prefix,
listcount(ecmp_path->nh_list), listcount(ecmp_path->nh_list),
old_route->paths ? listcount( old_route->paths ? listcount(
old_route->paths) old_route->paths)
@ -401,32 +396,27 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
&o_path->ls_prefix, &o_path->ls_prefix,
ospf6->brouter_table); ospf6->brouter_table);
if (asbr_entry == NULL) { if (asbr_entry == NULL) {
if (IS_OSPF6_DEBUG_EXAMIN( if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
AS_EXTERNAL)) {
prefix2str(&old_route->prefix,
buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: ls_prfix %s asbr_entry not found.", "%s: ls_prfix %pFX asbr_entry not found.",
__func__, buf); __func__,
} &old_route->prefix);
continue; continue;
} }
ospf6_route_merge_nexthops(old_route, ospf6_route_merge_nexthops(old_route,
asbr_entry); asbr_entry);
} }
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
prefix2str(&route->prefix, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: route %s with effective paths %u nh %u", "%s: route %pFX with effective paths %u nh %u",
__func__, buf, __func__, &route->prefix,
old_route->paths old_route->paths
? listcount(old_route->paths) ? listcount(old_route->paths)
: 0, : 0,
old_route->nh_list old_route->nh_list
? listcount(old_route->nh_list) ? listcount(old_route->nh_list)
: 0); : 0);
}
/* Update RIB/FIB */ /* Update RIB/FIB */
if (ospf6->route_table->hook_add) if (ospf6->route_table->hook_add)
@ -453,7 +443,6 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
struct prefix asbr_id; struct prefix asbr_id;
struct ospf6_route *asbr_entry, *route, *old; struct ospf6_route *asbr_entry, *route, *old;
struct ospf6_path *path; struct ospf6_path *path;
char buf[PREFIX2STR_BUFFER];
external = (struct ospf6_as_external_lsa *)OSPF6_LSA_HEADER_END( external = (struct ospf6_as_external_lsa *)OSPF6_LSA_HEADER_END(
lsa->header); 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); asbr_entry = ospf6_route_lookup(&asbr_id, ospf6->brouter_table);
if (asbr_entry == NULL if (asbr_entry == NULL
|| !CHECK_FLAG(asbr_entry->path.router_bits, OSPF6_ROUTER_BIT_E)) { || !CHECK_FLAG(asbr_entry->path.router_bits, OSPF6_ROUTER_BIT_E)) {
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
prefix2str(&asbr_id, buf, sizeof(buf)); zlog_debug("ASBR entry not found: %pFX", &asbr_id);
zlog_debug("ASBR entry not found: %s", buf);
}
return; return;
} }
@ -527,15 +514,13 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
listnode_add_sort(route->paths, path); listnode_add_sort(route->paths, path);
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
prefix2str(&route->prefix, buf, sizeof(buf)); zlog_debug(
zlog_debug("%s: AS-External %u route add %s cost %u(%u) nh %u", "%s: AS-External %u route add %pFX cost %u(%u) nh %u",
__func__, __func__,
(route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1 (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1 : 2,
: 2, &route->prefix, route->path.cost, route->path.u.cost_e2,
buf, route->path.cost, route->path.u.cost_e2, listcount(route->nh_list));
listcount(route->nh_list));
}
old = ospf6_route_lookup(&route->prefix, ospf6->route_table); old = ospf6_route_lookup(&route->prefix, ospf6->route_table);
if (!old) { if (!old) {
@ -1029,7 +1014,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
struct ospf6_external_info *info; struct ospf6_external_info *info;
struct prefix prefix_id; struct prefix prefix_id;
struct route_node *node; struct route_node *node;
char pbuf[PREFIX2STR_BUFFER], ibuf[16]; char ibuf[16];
struct listnode *lnode, *lnnode; struct listnode *lnode, *lnnode;
struct ospf6_area *oa; struct ospf6_area *oa;
@ -1039,10 +1024,8 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
memset(&troute, 0, sizeof(troute)); memset(&troute, 0, sizeof(troute));
memset(&tinfo, 0, sizeof(tinfo)); memset(&tinfo, 0, sizeof(tinfo));
if (IS_OSPF6_DEBUG_ASBR) { if (IS_OSPF6_DEBUG_ASBR)
prefix2str(prefix, pbuf, sizeof(pbuf)); zlog_debug("Redistribute %pFX (%s)", prefix, ZROUTE_NAME(type));
zlog_debug("Redistribute %s (%s)", pbuf, ZROUTE_NAME(type));
}
/* if route-map was specified but not found, do not advertise */ /* if route-map was specified but not found, do not advertise */
if (ospf6->rmap[type].name) { if (ospf6->rmap[type].name) {
@ -1109,10 +1092,9 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
if (IS_OSPF6_DEBUG_ASBR) { if (IS_OSPF6_DEBUG_ASBR) {
inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf,
sizeof(ibuf)); sizeof(ibuf));
prefix2str(prefix, pbuf, sizeof(pbuf));
zlog_debug( zlog_debug(
"Advertise as AS-External Id:%s prefix %s metric %u", "Advertise as AS-External Id:%s prefix %pFX metric %u",
ibuf, pbuf, match->path.metric_type); ibuf, prefix, match->path.metric_type);
} }
match->path.origin.id = htonl(info->id); 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) { if (IS_OSPF6_DEBUG_ASBR) {
inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf)); inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf));
prefix2str(prefix, pbuf, sizeof(pbuf)); zlog_debug(
zlog_debug("Advertise as AS-External Id:%s prefix %s metric %u", "Advertise as AS-External Id:%s prefix %pFX metric %u",
ibuf, pbuf, route->path.metric_type); ibuf, prefix, route->path.metric_type);
} }
route->path.origin.id = htonl(info->id); 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 route_node *node;
struct ospf6_lsa *lsa; struct ospf6_lsa *lsa;
struct prefix prefix_id; struct prefix prefix_id;
char pbuf[PREFIX2STR_BUFFER], ibuf[16]; char ibuf[16];
struct listnode *lnode, *lnnode; struct listnode *lnode, *lnnode;
struct ospf6_area *oa; struct ospf6_area *oa;
match = ospf6_route_lookup(prefix, ospf6->external_table); match = ospf6_route_lookup(prefix, ospf6->external_table);
if (match == NULL) { if (match == NULL) {
if (IS_OSPF6_DEBUG_ASBR) { if (IS_OSPF6_DEBUG_ASBR)
prefix2str(prefix, pbuf, sizeof(pbuf)); zlog_debug("No such route %pFX to withdraw", prefix);
zlog_debug("No such route %s to withdraw", pbuf);
}
return; return;
} }
@ -1201,17 +1181,14 @@ void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex,
assert(info); assert(info);
if (info->type != type) { if (info->type != type) {
if (IS_OSPF6_DEBUG_ASBR) { if (IS_OSPF6_DEBUG_ASBR)
prefix2str(prefix, pbuf, sizeof(pbuf)); zlog_debug("Original protocol mismatch: %pFX", prefix);
zlog_debug("Original protocol mismatch: %s", pbuf);
}
return; return;
} }
if (IS_OSPF6_DEBUG_ASBR) { if (IS_OSPF6_DEBUG_ASBR) {
prefix2str(prefix, pbuf, sizeof(pbuf));
inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf)); 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), 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_route *route)
{ {
struct ospf6_external_info *info = route->route_option; 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; uint32_t tmp_id;
prefix2str(&route->prefix, prefix, sizeof(prefix));
tmp_id = ntohl(info->id); tmp_id = ntohl(info->id);
inet_ntop(AF_INET, &tmp_id, id, sizeof(id)); inet_ntop(AF_INET, &tmp_id, id, sizeof(id));
if (!IN6_IS_ADDR_UNSPECIFIED(&info->forwarding)) 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)", snprintf(forwarding, sizeof(forwarding), ":: (ifindex %d)",
ospf6_route_get_first_nh_index(route)); ospf6_route_get_first_nh_index(route));
vty_out(vty, "%c %-32s %-15s type-%d %5lu %s\n", vty_out(vty, "%c %-32pFX %-15s type-%d %5lu %s\n",
zebra_route_char(info->type), prefix, id, zebra_route_char(info->type), &route->prefix, id,
route->path.metric_type, route->path.metric_type,
(unsigned long)(route->path.metric_type == 2 (unsigned long)(route->path.metric_type == 2
? route->path.u.cost_e2 ? route->path.u.cost_e2

View File

@ -204,12 +204,9 @@ static int ospf6_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
if ((ifp == NULL) || (dp.family != AF_INET6)) if ((ifp == NULL) || (dp.family != AF_INET6))
return 0; return 0;
if (IS_OSPF6_DEBUG_ZEBRA(RECV)) { if (IS_OSPF6_DEBUG_ZEBRA(RECV))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Zebra: interface %s bfd destination %pFX %s",
prefix2str(&dp, buf, sizeof(buf)); ifp->name, &dp, bfd_get_status_str(status));
zlog_debug("Zebra: interface %s bfd destination %s %s",
ifp->name, buf, bfd_get_status_str(status));
}
oi = (struct ospf6_interface *)ifp->info; oi = (struct ospf6_interface *)ifp->info;

View File

@ -436,16 +436,14 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
if (oi->plist_name) { if (oi->plist_name) {
struct prefix_list *plist; struct prefix_list *plist;
enum prefix_list_type ret; enum prefix_list_type ret;
char buf[PREFIX2STR_BUFFER];
prefix2str(c->address, buf, sizeof(buf));
plist = prefix_list_lookup(AFI_IP6, oi->plist_name); plist = prefix_list_lookup(AFI_IP6, oi->plist_name);
ret = prefix_list_apply(plist, (void *)c->address); ret = prefix_list_apply(plist, (void *)c->address);
if (ret == PREFIX_DENY) { if (ret == PREFIX_DENY) {
if (IS_OSPF6_DEBUG_INTERFACE) if (IS_OSPF6_DEBUG_INTERFACE)
zlog_debug( zlog_debug(
"%s on %s filtered by prefix-list %s ", "%pFX on %s filtered by prefix-list %s ",
buf, oi->interface->name, c->address, oi->interface->name,
oi->plist_name); oi->plist_name);
continue; 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)) { for (ALL_LIST_ELEMENTS_RO(ifp->connected, i, c)) {
p = c->address; p = c->address;
prefix2str(p, strbuf, sizeof(strbuf));
switch (p->family) { switch (p->family) {
case AF_INET: case AF_INET:
vty_out(vty, " inet : %s\n", strbuf); vty_out(vty, " inet : %pFX\n", p);
break; break;
case AF_INET6: case AF_INET6:
vty_out(vty, " inet6: %s\n", strbuf); vty_out(vty, " inet6: %pFX\n", p);
break; break;
default: default:
vty_out(vty, " ??? : %s\n", strbuf); vty_out(vty, " ??? : %pFX\n", p);
break; break;
} }
} }

View File

@ -907,7 +907,6 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
struct listnode *i, *j; struct listnode *i, *j;
int full_count = 0; int full_count = 0;
unsigned short prefix_num = 0; unsigned short prefix_num = 0;
char buf[PREFIX2STR_BUFFER];
struct ospf6_route_table *route_advertise; struct ospf6_route_table *route_advertise;
int ls_id = 0; int ls_id = 0;
@ -985,10 +984,8 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
/* connected prefix to advertise */ /* connected prefix to advertise */
for (route = ospf6_route_head(oi->route_connected); route; for (route = ospf6_route_head(oi->route_connected); route;
route = ospf6_route_best_next(route)) { route = ospf6_route_best_next(route)) {
if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) { if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
prefix2str(&route->prefix, buf, sizeof(buf)); zlog_debug(" include %pFX", &route->prefix);
zlog_debug(" include %s", buf);
}
ospf6_route_add(ospf6_route_copy(route), ospf6_route_add(ospf6_route_copy(route),
route_advertise); route_advertise);
} }
@ -1144,7 +1141,6 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
struct ospf6_link_lsa *link_lsa; struct ospf6_link_lsa *link_lsa;
char *start, *end, *current; char *start, *end, *current;
uint16_t type; uint16_t type;
char buf[PREFIX2STR_BUFFER];
oi = (struct ospf6_interface *)THREAD_ARG(thread); oi = (struct ospf6_interface *)THREAD_ARG(thread);
oi->thread_intra_prefix_lsa = NULL; 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.area_id = oi->area->area_id;
route->path.type = OSPF6_PATH_TYPE_INTRA; route->path.type = OSPF6_PATH_TYPE_INTRA;
if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) { if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
prefix2str(&route->prefix, buf, sizeof(buf)); zlog_debug(" include %pFX", &route->prefix);
zlog_debug(" include %s", buf);
}
ospf6_route_add(route, route_advertise); ospf6_route_add(route, route_advertise);
prefix_num--; prefix_num--;
@ -1554,11 +1548,9 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
ospf6_linkstate_prefix( ospf6_linkstate_prefix(
o_path->origin.adv_router, o_path->origin.adv_router,
o_path->origin.id, &adv_prefix); o_path->origin.id, &adv_prefix);
prefix2str(&adv_prefix, buf,
sizeof(buf));
zlog_debug( zlog_debug(
"%s: adv_router %s lsa not found", "%s: adv_router %pFX lsa not found",
__func__, buf); __func__, &adv_prefix);
} }
continue; continue;
} }
@ -1582,16 +1574,15 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
} }
} }
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) { if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX))
prefix2str(&route->prefix, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: route %s %p with final effective paths %u nh%u", "%s: route %pFX %p with final effective paths %u nh%u",
__func__, buf, (void *)old_route, __func__, &route->prefix,
(void *)old_route,
old_route->paths old_route->paths
? listcount(old_route->paths) ? listcount(old_route->paths)
: 0, : 0,
listcount(old_route->nh_list)); listcount(old_route->nh_list));
}
/* used in intra_route_calculation() to add to /* used in intra_route_calculation() to add to
* global ospf6 route table. * global ospf6 route table.

View File

@ -156,46 +156,36 @@ extern vector ospf6_lsa_handler_vector;
/* addr is (struct prefix *) */ /* addr is (struct prefix *) */
#define CONTINUE_IF_ADDRESS_LINKLOCAL(debug, addr) \ #define CONTINUE_IF_ADDRESS_LINKLOCAL(debug, addr) \
if (IN6_IS_ADDR_LINKLOCAL(&(addr)->u.prefix6)) { \ if (IN6_IS_ADDR_LINKLOCAL(&(addr)->u.prefix6)) { \
char buf[PREFIX2STR_BUFFER]; \
prefix2str(addr, buf, sizeof(buf)); \
if (debug) \ if (debug) \
zlog_debug("Filter out Linklocal: %s", buf); \ zlog_debug("Filter out Linklocal: %pFX", addr); \
continue; \ continue; \
} }
#define CONTINUE_IF_ADDRESS_UNSPECIFIED(debug, addr) \ #define CONTINUE_IF_ADDRESS_UNSPECIFIED(debug, addr) \
if (IN6_IS_ADDR_UNSPECIFIED(&(addr)->u.prefix6)) { \ if (IN6_IS_ADDR_UNSPECIFIED(&(addr)->u.prefix6)) { \
char buf[PREFIX2STR_BUFFER]; \
prefix2str(addr, buf, sizeof(buf)); \
if (debug) \ if (debug) \
zlog_debug("Filter out Unspecified: %s", buf); \ zlog_debug("Filter out Unspecified: %pFX", addr); \
continue; \ continue; \
} }
#define CONTINUE_IF_ADDRESS_LOOPBACK(debug, addr) \ #define CONTINUE_IF_ADDRESS_LOOPBACK(debug, addr) \
if (IN6_IS_ADDR_LOOPBACK(&(addr)->u.prefix6)) { \ if (IN6_IS_ADDR_LOOPBACK(&(addr)->u.prefix6)) { \
char buf[PREFIX2STR_BUFFER]; \
prefix2str(addr, buf, sizeof(buf)); \
if (debug) \ if (debug) \
zlog_debug("Filter out Loopback: %s", buf); \ zlog_debug("Filter out Loopback: %pFX", addr); \
continue; \ continue; \
} }
#define CONTINUE_IF_ADDRESS_V4COMPAT(debug, addr) \ #define CONTINUE_IF_ADDRESS_V4COMPAT(debug, addr) \
if (IN6_IS_ADDR_V4COMPAT(&(addr)->u.prefix6)) { \ if (IN6_IS_ADDR_V4COMPAT(&(addr)->u.prefix6)) { \
char buf[PREFIX2STR_BUFFER]; \
prefix2str(addr, buf, sizeof(buf)); \
if (debug) \ if (debug) \
zlog_debug("Filter out V4Compat: %s", buf); \ zlog_debug("Filter out V4Compat: %pFX", addr); \
continue; \ continue; \
} }
#define CONTINUE_IF_ADDRESS_V4MAPPED(debug, addr) \ #define CONTINUE_IF_ADDRESS_V4MAPPED(debug, addr) \
if (IN6_IS_ADDR_V4MAPPED(&(addr)->u.prefix6)) { \ if (IN6_IS_ADDR_V4MAPPED(&(addr)->u.prefix6)) { \
char buf[PREFIX2STR_BUFFER]; \
prefix2str(addr, buf, sizeof(buf)); \
if (debug) \ if (debug) \
zlog_debug("Filter out V4Mapped: %s", buf); \ zlog_debug("Filter out V4Mapped: %pFX", addr); \
continue; \ continue; \
} }

View File

@ -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, &adv_router, sizeof(adv_router));
ospf6_lsdb_set_key(&key, &id, sizeof(id)); ospf6_lsdb_set_key(&key, &id, sizeof(id));
{ zlog_debug("lsdb_lookup_next: key: %pFX", &key);
char buf[PREFIX2STR_BUFFER];
prefix2str(&key, buf, sizeof(buf));
zlog_debug("lsdb_lookup_next: key: %s", buf);
}
node = route_table_get_next(lsdb->table, &key); node = route_table_get_next(lsdb->table, &key);

View File

@ -550,7 +550,6 @@ ospf6_route_lookup_bestmatch(struct prefix *prefix,
static void route_table_assert(struct ospf6_route_table *table) static void route_table_assert(struct ospf6_route_table *table)
{ {
struct ospf6_route *prev, *r, *next; struct ospf6_route *prev, *r, *next;
char buf[PREFIX2STR_BUFFER];
unsigned int link_error = 0, num = 0; unsigned int link_error = 0, num = 0;
r = ospf6_route_head(table); 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); "Something has gone wrong with ospf6_route_table[%p]", table);
zlog_debug("table count = %d, real number = %d", table->count, num); zlog_debug("table count = %d, real number = %d", table->count, num);
zlog_debug("DUMP START"); zlog_debug("DUMP START");
for (r = ospf6_route_head(table); r; r = ospf6_route_next(r)) { for (r = ospf6_route_head(table); r; r = ospf6_route_next(r))
prefix2str(&r->prefix, buf, sizeof(buf)); zlog_info("%p<-[%p]->%p : %pFX", r->prev, r, r->next,
zlog_info("%p<-[%p]->%p : %s", r->prev, r, r->next, buf); &r->prefix);
}
zlog_debug("DUMP END"); zlog_debug("DUMP END");
assert(link_error == 0 && num == table->count); assert(link_error == 0 && num == table->count);

View File

@ -320,7 +320,6 @@ static int ospf6_spf_install(struct ospf6_vertex *v,
{ {
struct ospf6_route *route, *parent_route; struct ospf6_route *route, *parent_route;
struct ospf6_vertex *prev; struct ospf6_vertex *prev;
char pbuf[PREFIX2STR_BUFFER];
if (IS_OSPF6_DEBUG_SPF(PROCESS)) if (IS_OSPF6_DEBUG_SPF(PROCESS))
zlog_debug("SPF install %s (lsa %s) hops %d cost %d", v->name, 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); ospf6_vertex_delete(v);
return -1; return -1;
} else if (route && route->path.cost == v->cost) { } else if (route && route->path.cost == v->cost) {
if (IS_OSPF6_DEBUG_SPF(PROCESS)) { if (IS_OSPF6_DEBUG_SPF(PROCESS))
prefix2str(&route->prefix, pbuf, sizeof(pbuf));
zlog_debug( zlog_debug(
" another path found to route %s lsa %s, merge", " another path found to route %pFX lsa %s, merge",
pbuf, v->lsa->name); &route->prefix, v->lsa->name);
}
ospf6_spf_merge_nexthops_to_route(route, v); ospf6_spf_merge_nexthops_to_route(route, v);
prev = (struct ospf6_vertex *)route->route_option; prev = (struct ospf6_vertex *)route->route_option;

View File

@ -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)) for (rn = route_top(ospf6->distance_table); rn; rn = route_next(rn))
if ((odistance = rn->info) != NULL) { if ((odistance = rn->info) != NULL)
char buf[PREFIX_STRLEN]; vty_out(vty, " distance %u %pFX %s\n",
odistance->distance, &rn->p,
vty_out(vty, " distance %u %s %s\n",
odistance->distance,
prefix2str(&rn->p, buf, sizeof(buf)),
odistance->access_list ? odistance->access_list odistance->access_list ? odistance->access_list
: ""); : "");
}
return 0; return 0;
} }

View File

@ -163,19 +163,13 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS)
ifindex = api.nexthops[0].ifindex; ifindex = api.nexthops[0].ifindex;
nexthop = &api.nexthops[0].gate.ipv6; nexthop = &api.nexthops[0].gate.ipv6;
if (IS_OSPF6_DEBUG_ZEBRA(RECV)) { 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));
zlog_debug( 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" (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD ? "add"
: "delete"), : "delete"),
zebra_route_string(api.type), prefixstr, nexthopstr, zebra_route_string(api.type), &api.prefix, nexthop,
ifindex, api.tag); ifindex, api.tag);
}
if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD)
ospf6_asbr_redistribute_add(api.type, ifindex, &api.prefix, 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) static void ospf6_zebra_route_update(int type, struct ospf6_route *request)
{ {
struct zapi_route api; struct zapi_route api;
char buf[PREFIX2STR_BUFFER];
int nhcount; int nhcount;
int ret = 0; int ret = 0;
struct prefix *dest; struct prefix *dest;
if (IS_OSPF6_DEBUG_ZEBRA(SEND)) { if (IS_OSPF6_DEBUG_ZEBRA(SEND))
prefix2str(&request->prefix, buf, sizeof(buf)); zlog_debug("Send %s route: %pFX",
zlog_debug("Send %s route: %s", (type == REM ? "remove" : "add"), &request->prefix);
(type == REM ? "remove" : "add"), buf);
}
if (zclient->sock < 0) { if (zclient->sock < 0) {
if (IS_OSPF6_DEBUG_ZEBRA(SEND)) if (IS_OSPF6_DEBUG_ZEBRA(SEND))

View File

@ -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); lsa = ospf_lsa_refresh(area->ospf, old);
if (!lsa) { if (!lsa) {
char buf[PREFIX2STR_BUFFER];
prefix2str((struct prefix *)p, buf,
sizeof(buf));
flog_warn(EC_OSPF_LSA_MISSING, flog_warn(EC_OSPF_LSA_MISSING,
"%s: Could not refresh %s to %s", "%s: Could not refresh %pFX to %s",
__func__, buf, __func__, (struct prefix *)p,
inet_ntoa(area->area_id)); inet_ntoa(area->area_id));
return; return;
} }
@ -762,12 +758,10 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost,
/* This will flood through area. */ /* This will flood through area. */
if (!lsa) { if (!lsa) {
char buf[PREFIX2STR_BUFFER];
prefix2str((struct prefix *)p, buf, sizeof(buf));
flog_warn(EC_OSPF_LSA_MISSING, flog_warn(EC_OSPF_LSA_MISSING,
"%s: Could not originate %s to %s", __func__, "%s: Could not originate %pFX to %s",
buf, inet_ntoa(area->area_id)); __func__, (struct prefix *)p,
inet_ntoa(area->area_id));
return; return;
} }
@ -1118,12 +1112,10 @@ static void ospf_abr_announce_rtr_to_area(struct prefix_ipv4 *p, uint32_t cost,
} else } else
lsa = ospf_summary_asbr_lsa_originate(p, cost, area); lsa = ospf_summary_asbr_lsa_originate(p, cost, area);
if (!lsa) { if (!lsa) {
char buf[PREFIX2STR_BUFFER];
prefix2str((struct prefix *)p, buf, sizeof(buf));
flog_warn(EC_OSPF_LSA_MISSING, flog_warn(EC_OSPF_LSA_MISSING,
"%s: Could not refresh/originate %s to %s", "%s: Could not refresh/originate %pFX to %s",
__func__, buf, inet_ntoa(area->area_id)); __func__, (struct prefix *)p,
inet_ntoa(area->area_id));
return; return;
} }

View File

@ -217,12 +217,9 @@ static int ospf_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
if ((ifp == NULL) || (p.family != AF_INET)) if ((ifp == NULL) || (p.family != AF_INET))
return 0; return 0;
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) { if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Zebra: interface %s bfd destination %pFX %s",
prefix2str(&p, buf, sizeof(buf)); ifp->name, &p, bfd_get_status_str(status));
zlog_debug("Zebra: interface %s bfd destination %s %s",
ifp->name, buf, bfd_get_status_str(status));
}
params = IF_DEF_PARAMS(ifp); params = IF_DEF_PARAMS(ifp);
if (!params->bfd_info) if (!params->bfd_info)

View File

@ -73,12 +73,9 @@ static int ospf_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
struct prefix router_id; struct prefix router_id;
zebra_router_id_update_read(zclient->ibuf, &router_id); zebra_router_id_update_read(zclient->ibuf, &router_id);
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) { if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Zebra rcvd: router id update %pFX vrf %s id %u",
prefix2str(&router_id, buf, sizeof(buf)); &router_id, ospf_vrf_id_to_name(vrf_id), vrf_id);
zlog_debug("Zebra rcvd: router id update %s vrf %s id %u", buf,
ospf_vrf_id_to_name(vrf_id), vrf_id);
}
ospf = ospf_lookup_by_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_zebra = router_id.u.prefix4;
ospf_router_id_update(ospf); ospf_router_id_update(ospf);
} else { } else {
if (IS_DEBUG_OSPF_EVENT) { if (IS_DEBUG_OSPF_EVENT)
char buf[PREFIX2STR_BUFFER];
prefix2str(&router_id, buf, sizeof(buf));
zlog_debug( 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, __func__, ospf_vrf_id_to_name(vrf_id), vrf_id,
buf); &router_id);
}
} }
return 0; return 0;
} }
@ -110,13 +103,10 @@ static int ospf_interface_address_add(ZAPI_CALLBACK_ARGS)
if (c == NULL) if (c == NULL)
return 0; return 0;
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) { if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Zebra: interface %s address add %pFX vrf %s id %u",
prefix2str(c->address, buf, sizeof(buf)); c->ifp->name, c->address,
zlog_debug("Zebra: interface %s address add %s vrf %s id %u", ospf_vrf_id_to_name(vrf_id), vrf_id);
c->ifp->name, buf, ospf_vrf_id_to_name(vrf_id),
vrf_id);
}
ospf = ospf_lookup_by_vrf_id(vrf_id); ospf = ospf_lookup_by_vrf_id(vrf_id);
if (!ospf) if (!ospf)
@ -142,12 +132,9 @@ static int ospf_interface_address_delete(ZAPI_CALLBACK_ARGS)
if (c == NULL) if (c == NULL)
return 0; return 0;
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) { if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Zebra: interface %s address delete %pFX",
prefix2str(c->address, buf, sizeof(buf)); c->ifp->name, c->address);
zlog_debug("Zebra: interface %s address delete %s",
c->ifp->name, buf);
}
ifp = c->ifp; ifp = c->ifp;
p = *c->address; p = *c->address;
@ -279,17 +266,14 @@ void ospf_zebra_add(struct ospf *ospf, struct prefix_ipv4 *p,
count++; count++;
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) { if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
char buf[2][PREFIX2STR_BUFFER];
struct interface *ifp; struct interface *ifp;
ifp = if_lookup_by_index(path->ifindex, ospf->vrf_id); ifp = if_lookup_by_index(path->ifindex, ospf->vrf_id);
zlog_debug( zlog_debug(
"Zebra: Route add %s nexthop %s, ifindex=%d %s", "Zebra: Route add %pFX nexthop %pI4, ifindex=%d %s",
prefix2str(p, buf[0], sizeof(buf[0])), p, &path->nexthop, path->ifindex,
inet_ntop(AF_INET, &path->nexthop, ifp ? ifp->name : " ");
buf[1], sizeof(buf[1])),
path->ifindex, ifp ? ifp->name : " ");
} }
} }
api.nexthop_num = count; api.nexthop_num = count;
@ -309,11 +293,8 @@ void ospf_zebra_delete(struct ospf *ospf, struct prefix_ipv4 *p,
api.safi = SAFI_UNICAST; api.safi = SAFI_UNICAST;
memcpy(&api.prefix, p, sizeof(*p)); memcpy(&api.prefix, p, sizeof(*p));
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) { if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Zebra: Route delete %pFX", p);
zlog_debug("Zebra: Route delete %s",
prefix2str(p, buf, sizeof(buf)));
}
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); 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); zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) { if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Zebra: Route add discard %pFX", p);
zlog_debug("Zebra: Route add discard %s",
prefix2str(p, buf, sizeof(buf)));
}
} }
void ospf_zebra_delete_discard(struct ospf *ospf, struct prefix_ipv4 *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); zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) { if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
char buf[PREFIX2STR_BUFFER]; zlog_debug("Zebra: Route delete discard %pFX", p);
zlog_debug("Zebra: Route delete discard %s",
prefix2str(p, buf, sizeof(buf)));
}
} }
struct ospf_external *ospf_external_lookup(struct ospf *ospf, uint8_t type, 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 (DISTRIBUTE_LIST(ospf, type))
if (access_list_apply(DISTRIBUTE_LIST(ospf, type), p) if (access_list_apply(DISTRIBUTE_LIST(ospf, type), p)
== FILTER_DENY) { == FILTER_DENY) {
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) { if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
char buf[PREFIX2STR_BUFFER];
zlog_debug( zlog_debug(
"Redistribute[%s]: %s filtered by distribute-list.", "Redistribute[%s]: %pFX filtered by distribute-list.",
ospf_redist_string(type), ospf_redist_string(type), p);
prefix2str(p, buf, sizeof(buf)));
}
return 0; return 0;
} }
@ -1088,13 +1060,10 @@ int ospf_redistribute_check(struct ospf *ospf, struct external_info *ei,
if (ret == RMAP_DENYMATCH) { if (ret == RMAP_DENYMATCH) {
ei->route_map_set = save_values; ei->route_map_set = save_values;
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) { if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
char buf[PREFIX2STR_BUFFER];
zlog_debug( zlog_debug(
"Redistribute[%s]: %s filtered by route-map.", "Redistribute[%s]: %pFX filtered by route-map.",
ospf_redist_string(type), ospf_redist_string(type), p);
prefix2str(p, buf, sizeof(buf)));
}
return 0; return 0;
} }
@ -1171,14 +1140,10 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
if (is_prefix_default(&p)) if (is_prefix_default(&p))
rt_type = DEFAULT_ROUTE; rt_type = DEFAULT_ROUTE;
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) { if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
char buf_prefix[PREFIX_STRLEN]; zlog_debug("%s: cmd %s from client %s: vrf_id %d, p %pFX",
prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
zlog_debug("%s: cmd %s from client %s: vrf_id %d, p %s",
__func__, zserv_command_string(cmd), __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) { if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) {
/* XXX|HACK|TODO|FIXME: /* XXX|HACK|TODO|FIXME:

View File

@ -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_nexthop_cache *pnhc = b->data;
struct pbr_nht_individual *pnhi = data; struct pbr_nht_individual *pnhi = data;
char buf[PREFIX_STRLEN];
bool old_valid; bool old_valid;
old_valid = pnhc->valid; old_valid = pnhc->valid;
pbr_nht_individual_nexthop_update(pnhc, pnhi); pbr_nht_individual_nexthop_update(pnhc, pnhi);
DEBUGD(&pbr_dbg_nht, "\tFound %s: old: %d new: %d", DEBUGD(&pbr_dbg_nht, "\tFound %pFX: old: %d new: %d",
prefix2str(&pnhi->nhr->prefix, buf, sizeof(buf)), old_valid, &pnhi->nhr->prefix, old_valid, pnhc->valid);
pnhc->valid);
if (pnhc->valid) if (pnhc->valid)
pnhi->valid = true; pnhi->valid = true;

View File

@ -648,7 +648,6 @@ pbrms_nexthop_group_write_individual_nexthop(
static void vty_show_pbrms(struct vty *vty, static void vty_show_pbrms(struct vty *vty,
const struct pbr_map_sequence *pbrms, bool detail) const struct pbr_map_sequence *pbrms, bool detail)
{ {
char buf[PREFIX_STRLEN];
char rbuf[64]; char rbuf[64];
if (pbrms->reason) if (pbrms->reason)
@ -666,11 +665,9 @@ static void vty_show_pbrms(struct vty *vty,
pbrms->reason ? rbuf : "Valid"); pbrms->reason ? rbuf : "Valid");
if (pbrms->src) if (pbrms->src)
vty_out(vty, " SRC Match: %s\n", vty_out(vty, " SRC Match: %pFX\n", pbrms->src);
prefix2str(pbrms->src, buf, sizeof(buf)));
if (pbrms->dst) if (pbrms->dst)
vty_out(vty, " DST Match: %s\n", vty_out(vty, " DST Match: %pFX\n", pbrms->dst);
prefix2str(pbrms->dst, buf, sizeof(buf)));
if (pbrms->dsfield & PBR_DSFIELD_DSCP) if (pbrms->dsfield & PBR_DSFIELD_DSCP)
vty_out(vty, " DSCP Match: %u\n", vty_out(vty, " DSCP Match: %u\n",
(pbrms->dsfield & PBR_DSFIELD_DSCP) >> 2); (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 *pbrm,
struct pbr_map_sequence *pbrms) struct pbr_map_sequence *pbrms)
{ {
char buff[PREFIX_STRLEN];
vty_out(vty, "pbr-map %s seq %u\n", pbrm->name, pbrms->seqno); vty_out(vty, "pbr-map %s seq %u\n", pbrm->name, pbrms->seqno);
if (pbrms->src) if (pbrms->src)
vty_out(vty, " match src-ip %s\n", vty_out(vty, " match src-ip %pFX\n", pbrms->src);
prefix2str(pbrms->src, buff, sizeof(buff)));
if (pbrms->dst) if (pbrms->dst)
vty_out(vty, " match dst-ip %s\n", vty_out(vty, " match dst-ip %pFX\n", pbrms->dst);
prefix2str(pbrms->dst, buff, sizeof(buff)));
if (pbrms->dsfield & PBR_DSFIELD_DSCP) if (pbrms->dsfield & PBR_DSFIELD_DSCP)
vty_out(vty, " match dscp %u\n", vty_out(vty, " match dscp %u\n",

View File

@ -102,15 +102,14 @@ static int interface_address_add(ZAPI_CALLBACK_ARGS)
static int interface_address_delete(ZAPI_CALLBACK_ARGS) static int interface_address_delete(ZAPI_CALLBACK_ARGS)
{ {
struct connected *c; struct connected *c;
char buf[PREFIX_STRLEN];
c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (!c) if (!c)
return 0; return 0;
DEBUGD(&pbr_dbg_zebra, "%s: %s deleted %s", __func__, c->ifp->name, DEBUGD(&pbr_dbg_zebra, "%s: %s deleted %pFX", __func__, c->ifp->name,
prefix2str(c->address, buf, sizeof(buf))); c->address);
connected_free(&c); connected_free(&c);
return 0; return 0;
@ -162,40 +161,37 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS)
struct prefix p; struct prefix p;
enum zapi_route_notify_owner note; enum zapi_route_notify_owner note;
uint32_t table_id; uint32_t table_id;
char buf[PREFIX_STRLEN];
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, &note)) if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, &note))
return -1; return -1;
prefix2str(&p, buf, sizeof(buf));
switch (note) { switch (note) {
case ZAPI_ROUTE_FAIL_INSTALL: case ZAPI_ROUTE_FAIL_INSTALL:
DEBUGD(&pbr_dbg_zebra, DEBUGD(&pbr_dbg_zebra,
"%s: [%s] Route install failure for table: %u", __func__, "%s: [%pFX] Route install failure for table: %u",
buf, table_id); __func__, &p, table_id);
break; break;
case ZAPI_ROUTE_BETTER_ADMIN_WON: case ZAPI_ROUTE_BETTER_ADMIN_WON:
DEBUGD(&pbr_dbg_zebra, DEBUGD(&pbr_dbg_zebra,
"%s: [%s] Route better admin distance won for table: %u", "%s: [%pFX] Route better admin distance won for table: %u",
__func__, buf, table_id); __func__, &p, table_id);
break; break;
case ZAPI_ROUTE_INSTALLED: case ZAPI_ROUTE_INSTALLED:
DEBUGD(&pbr_dbg_zebra, DEBUGD(&pbr_dbg_zebra,
"%s: [%s] Route installed succeeded for table: %u", "%s: [%pFX] Route installed succeeded for table: %u",
__func__, buf, table_id); __func__, &p, table_id);
pbr_nht_route_installed_for_table(table_id); pbr_nht_route_installed_for_table(table_id);
break; break;
case ZAPI_ROUTE_REMOVED: case ZAPI_ROUTE_REMOVED:
DEBUGD(&pbr_dbg_zebra, DEBUGD(&pbr_dbg_zebra,
"%s: [%s] Route Removed succeeded for table: %u", "%s: [%pFX] Route Removed succeeded for table: %u",
__func__, buf, table_id); __func__, &p, table_id);
pbr_nht_route_removed_for_table(table_id); pbr_nht_route_removed_for_table(table_id);
break; break;
case ZAPI_ROUTE_REMOVE_FAIL: case ZAPI_ROUTE_REMOVE_FAIL:
DEBUGD(&pbr_dbg_zebra, DEBUGD(&pbr_dbg_zebra,
"%s: [%s] Route remove fail for table: %u", __func__, "%s: [%pFX] Route remove fail for table: %u", __func__,
buf, table_id); &p, table_id);
break; break;
} }
@ -259,14 +255,12 @@ static void route_add_helper(struct zapi_route *api, struct nexthop_group nhg,
uint8_t install_afi) uint8_t install_afi)
{ {
struct zapi_nexthop *api_nh; struct zapi_nexthop *api_nh;
char buf[PREFIX_STRLEN];
struct nexthop *nhop; struct nexthop *nhop;
int i; int i;
api->prefix.family = install_afi; api->prefix.family = install_afi;
DEBUGD(&pbr_dbg_zebra, "\tEncoding %s", DEBUGD(&pbr_dbg_zebra, "\tEncoding %pFX", &api->prefix);
prefix2str(&api->prefix, buf, sizeof(buf)));
i = 0; i = 0;
for (ALL_NEXTHOPS(nhg, nhop)) { 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) static int pbr_zebra_nexthop_update(ZAPI_CALLBACK_ARGS)
{ {
struct zapi_route nhr; struct zapi_route nhr;
char buf[PREFIX2STR_BUFFER];
uint32_t i; uint32_t i;
if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) { 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)) { if (DEBUG_MODE_CHECK(&pbr_dbg_zebra, DEBUG_MODE_ALL)) {
DEBUGD(&pbr_dbg_zebra, "%s: Received Nexthop update: %s", DEBUGD(&pbr_dbg_zebra, "%s: Received Nexthop update: %pFX",
__func__, prefix2str(&nhr.prefix, buf, sizeof(buf))); __func__, &nhr.prefix);
DEBUGD(&pbr_dbg_zebra, "%s: (\tNexthops(%u)", __func__, DEBUGD(&pbr_dbg_zebra, "%s: (\tNexthops(%u)", __func__,
nhr.nexthop_num); nhr.nexthop_num);

View File

@ -244,12 +244,9 @@ static int pim_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
return 0; return 0;
} }
if (PIM_DEBUG_PIM_TRACE) { if (PIM_DEBUG_PIM_TRACE)
char buf[PREFIX2STR_BUFFER]; zlog_debug("%s: interface %s bfd destination %pFX %s", __func__,
prefix2str(&p, buf, sizeof(buf)); ifp->name, &p, bfd_get_status_str(status));
zlog_debug("%s: interface %s bfd destination %s %s", __func__,
ifp->name, buf, bfd_get_status_str(status));
}
for (ALL_LIST_ELEMENTS(pim_ifp->pim_neighbor_list, neigh_node, for (ALL_LIST_ELEMENTS(pim_ifp->pim_neighbor_list, neigh_node,
neigh_nextnode, neigh)) { neigh_nextnode, neigh)) {

View File

@ -170,7 +170,6 @@ static int pim_on_bs_timer(struct thread *t)
struct bsgrp_node *bsgrp_node; struct bsgrp_node *bsgrp_node;
struct bsm_rpinfo *bsrp; struct bsm_rpinfo *bsrp;
struct prefix nht_p; struct prefix nht_p;
char buf[PREFIX2STR_BUFFER];
bool is_bsr_tracking = true; bool is_bsr_tracking = true;
scope = THREAD_ARG(t); scope = THREAD_ARG(t);
@ -184,11 +183,9 @@ static int pim_on_bs_timer(struct thread *t)
nht_p.family = AF_INET; nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN; nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = scope->current_bsr; nht_p.u.prefix4 = scope->current_bsr;
if (PIM_DEBUG_BSM) { if (PIM_DEBUG_BSM)
prefix2str(&nht_p, buf, sizeof(buf)); zlog_debug("%s: Deregister BSR addr %pFX with Zebra NHT",
zlog_debug("%s: Deregister BSR addr %s with Zebra NHT", __func__, &nht_p);
__func__, buf);
}
pim_delete_tracked_nexthop(scope->pim, &nht_p, NULL, NULL, pim_delete_tracked_nexthop(scope->pim, &nht_p, NULL, NULL,
is_bsr_tracking); is_bsr_tracking);
@ -377,15 +374,12 @@ static void pim_g2rp_timer_start(struct bsm_rpinfo *bsrp, int hold_time)
return; return;
} }
THREAD_OFF(bsrp->g2rp_timer); THREAD_OFF(bsrp->g2rp_timer);
if (PIM_DEBUG_BSM) { if (PIM_DEBUG_BSM)
char buf[48];
zlog_debug( zlog_debug(
"%s : starting g2rp timer for grp: %s - rp: %s with timeout %d secs(Actual Hold time : %d secs)", "%s : starting g2rp timer for grp: %pFX - rp: %s with timeout %d secs(Actual Hold time : %d secs)",
__func__, prefix2str(&bsrp->bsgrp_node->group, buf, 48), __func__, &bsrp->bsgrp_node->group,
inet_ntoa(bsrp->rp_address), hold_time, inet_ntoa(bsrp->rp_address), hold_time,
bsrp->rp_holdtime); bsrp->rp_holdtime);
}
thread_add_timer(router->master, pim_on_g2rp_timer, bsrp, hold_time, thread_add_timer(router->master, pim_on_g2rp_timer, bsrp, hold_time,
&bsrp->g2rp_timer); &bsrp->g2rp_timer);
@ -402,14 +396,10 @@ static void pim_g2rp_timer_stop(struct bsm_rpinfo *bsrp)
if (!bsrp) if (!bsrp)
return; return;
if (PIM_DEBUG_BSM) { if (PIM_DEBUG_BSM)
char buf[48]; zlog_debug("%s : stopping g2rp timer for grp: %pFX - rp: %s",
__func__, &bsrp->bsgrp_node->group,
zlog_debug("%s : stopping g2rp timer for grp: %s - rp: %s",
__func__,
prefix2str(&bsrp->bsgrp_node->group, buf, 48),
inet_ntoa(bsrp->rp_address)); inet_ntoa(bsrp->rp_address));
}
THREAD_OFF(bsrp->g2rp_timer); 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) { if (bsr.s_addr != pim->global_scope.current_bsr.s_addr) {
struct prefix nht_p; struct prefix nht_p;
char buf[PREFIX2STR_BUFFER];
bool is_bsr_tracking = true; bool is_bsr_tracking = true;
/* De-register old BSR and register new BSR with Zebra NHT */ /* 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) { if (pim->global_scope.current_bsr.s_addr != INADDR_ANY) {
nht_p.u.prefix4 = pim->global_scope.current_bsr; nht_p.u.prefix4 = pim->global_scope.current_bsr;
if (PIM_DEBUG_BSM) { if (PIM_DEBUG_BSM)
prefix2str(&nht_p, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: Deregister BSR addr %s with Zebra NHT", "%s: Deregister BSR addr %pFX with Zebra NHT",
__func__, buf); __func__, &nht_p);
}
pim_delete_tracked_nexthop(pim, &nht_p, NULL, NULL, pim_delete_tracked_nexthop(pim, &nht_p, NULL, NULL,
is_bsr_tracking); is_bsr_tracking);
} }
nht_p.u.prefix4 = bsr; nht_p.u.prefix4 = bsr;
if (PIM_DEBUG_BSM) { if (PIM_DEBUG_BSM)
prefix2str(&nht_p, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: NHT Register BSR addr %s with Zebra NHT", "%s: NHT Register BSR addr %pFX with Zebra NHT",
__func__, buf); __func__, &nht_p);
}
memset(&pnc, 0, sizeof(struct pim_nexthop_cache)); memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
pim_find_or_track_nexthop(pim, &nht_p, NULL, NULL, pim_find_or_track_nexthop(pim, &nht_p, NULL, NULL,

View File

@ -1164,16 +1164,13 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
inet_ntoa(pim_ifp->update_source)); inet_ntoa(pim_ifp->update_source));
} }
if (pim_ifp->sec_addr_list) { if (pim_ifp->sec_addr_list) {
char pbuf[PREFIX2STR_BUFFER];
vty_out(vty, "Address : %s (primary)\n", vty_out(vty, "Address : %s (primary)\n",
inet_ntoa(ifaddr)); inet_ntoa(ifaddr));
for (ALL_LIST_ELEMENTS_RO( for (ALL_LIST_ELEMENTS_RO(
pim_ifp->sec_addr_list, sec_node, pim_ifp->sec_addr_list, sec_node,
sec_addr)) { sec_addr))
vty_out(vty, " %s\n", vty_out(vty, " %pFX\n",
prefix2str(&sec_addr->addr, &sec_addr->addr);
pbuf, sizeof(pbuf)));
}
} else { } else {
vty_out(vty, "Address : %s\n", vty_out(vty, "Address : %s\n",
inet_ntoa(ifaddr)); inet_ntoa(ifaddr));
@ -2331,16 +2328,10 @@ static void pim_show_neighbors_secondary(struct pim_instance *pim,
neigh_src_str, sizeof(neigh_src_str)); neigh_src_str, sizeof(neigh_src_str));
for (ALL_LIST_ELEMENTS_RO(neigh->prefix_list, for (ALL_LIST_ELEMENTS_RO(neigh->prefix_list,
prefix_node, p)) { prefix_node, p))
char neigh_sec_str[PREFIX2STR_BUFFER]; vty_out(vty, "%-16s %-15s %-15s %-15pFX\n",
prefix2str(p, neigh_sec_str,
sizeof(neigh_sec_str));
vty_out(vty, "%-16s %-15s %-15s %-15s\n",
ifp->name, inet_ntoa(ifaddr), 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); json_group);
} }
} else { } 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, "--------------------------\n");
vty_out(vty, "%-15s %-15s %-15s %-15s\n", "Rp Address", vty_out(vty, "%-15s %-15s %-15s %-15s\n", "Rp Address",
"priority", "Holdtime", "Hash"); "priority", "Holdtime", "Hash");

View File

@ -518,15 +518,12 @@ void pim_if_addr_add(struct connected *ifc)
if (!if_is_operative(ifp)) if (!if_is_operative(ifp))
return; return;
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA)
char buf[BUFSIZ]; zlog_debug("%s: %s ifindex=%d connected IP address %pFX %s",
prefix2str(ifc->address, buf, BUFSIZ); __func__, ifp->name, ifp->ifindex, ifc->address,
zlog_debug("%s: %s ifindex=%d connected IP address %s %s",
__func__, ifp->name, ifp->ifindex, buf,
CHECK_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY) CHECK_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY)
? "secondary" ? "secondary"
: "primary"); : "primary");
}
ifaddr = ifc->address->u.prefix4; 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; ifp = ifc->ifp;
zassert(ifp); zassert(ifp);
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA)
char buf[BUFSIZ]; zlog_debug("%s: %s ifindex=%d disconnected IP address %pFX %s",
prefix2str(ifc->address, buf, BUFSIZ); __func__, ifp->name, ifp->ifindex, ifc->address,
zlog_debug("%s: %s ifindex=%d disconnected IP address %s %s",
__func__, ifp->name, ifp->ifindex, buf,
CHECK_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY) CHECK_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY)
? "secondary" ? "secondary"
: "primary"); : "primary");
}
detect_address_change(ifp, force_prim_as_any, __func__); detect_address_change(ifp, force_prim_as_any, __func__);

View File

@ -26,6 +26,8 @@
#include "hash.h" #include "hash.h"
#include "jhash.h" #include "jhash.h"
#include "lib/printfrr.h"
#include "pimd.h" #include "pimd.h"
#include "pimd/pim_nht.h" #include "pimd/pim_nht.h"
#include "log.h" #include "log.h"
@ -56,15 +58,12 @@ void pim_sendmsg_zebra_rnh(struct pim_instance *pim, struct zclient *zclient,
if (ret < 0) if (ret < 0)
zlog_warn("sendmsg_nexthop: zclient_send_message() failed"); zlog_warn("sendmsg_nexthop: zclient_send_message() failed");
if (PIM_DEBUG_PIM_NHT) { if (PIM_DEBUG_PIM_NHT)
char buf[PREFIX2STR_BUFFER];
prefix2str(p, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: NHT %sregistered addr %s(%s) with Zebra ret:%d ", "%s: NHT %sregistered addr %pFX(%s) with Zebra ret:%d ",
__func__, __func__,
(command == ZEBRA_NEXTHOP_REGISTER) ? " " : "de", buf, (command == ZEBRA_NEXTHOP_REGISTER) ? " " : "de", p,
pim->vrf->name, ret); pim->vrf->name, ret);
}
return; return;
} }
@ -89,7 +88,6 @@ static struct pim_nexthop_cache *pim_nexthop_cache_add(struct pim_instance *pim,
{ {
struct pim_nexthop_cache *pnc; struct pim_nexthop_cache *pnc;
char hash_name[64]; char hash_name[64];
char buf1[64];
pnc = XCALLOC(MTYPE_PIM_NEXTHOP_CACHE, pnc = XCALLOC(MTYPE_PIM_NEXTHOP_CACHE,
sizeof(struct 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 = list_new();
pnc->rp_list->cmp = pim_rp_list_cmp; pnc->rp_list->cmp = pim_rp_list_cmp;
snprintf(hash_name, sizeof(hash_name), "PNC %s(%s) Upstream Hash", snprintfrr(hash_name, sizeof(hash_name), "PNC %pFX(%s) Upstream Hash",
prefix2str(&pnc->rpf.rpf_addr, buf1, 64), pim->vrf->name); &pnc->rpf.rpf_addr, pim->vrf->name);
pnc->upstream_hash = hash_create_size(8192, pim_upstream_hash_key, pnc->upstream_hash = hash_create_size(8192, pim_upstream_hash_key,
pim_upstream_equal, hash_name); 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); pnc = pim_nexthop_cache_add(pim, &rpf);
pim_sendmsg_zebra_rnh(pim, zclient, pnc, pim_sendmsg_zebra_rnh(pim, zclient, pnc,
ZEBRA_NEXTHOP_REGISTER); ZEBRA_NEXTHOP_REGISTER);
if (PIM_DEBUG_PIM_NHT) { if (PIM_DEBUG_PIM_NHT)
char buf[PREFIX2STR_BUFFER];
prefix2str(addr, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: NHT cache and zebra notification added for %s(%s)", "%s: NHT cache and zebra notification added for %pFX(%s)",
__func__, buf, pim->vrf->name); __func__, addr, pim->vrf->name);
}
} }
if (rp != NULL) { if (rp != NULL) {
@ -215,14 +210,11 @@ void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
if (del_bsr_tracking) if (del_bsr_tracking)
pnc->bsr_tracking = false; pnc->bsr_tracking = false;
if (PIM_DEBUG_PIM_NHT) { if (PIM_DEBUG_PIM_NHT)
char buf[PREFIX_STRLEN];
prefix2str(addr, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: NHT %s(%s) rp_list count:%d upstream count:%ld", "%s: NHT %pFX(%s) rp_list count:%d upstream count:%ld",
__func__, buf, pim->vrf->name, __func__, addr, pim->vrf->name,
pnc->rp_list->count, pnc->upstream_hash->count); pnc->rp_list->count, pnc->upstream_hash->count);
}
if (pnc->rp_list->count == 0 if (pnc->rp_list->count == 0
&& pnc->upstream_hash->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); prefix_copy(&rpf.rpf_addr, &nhr.prefix);
pnc = pim_nexthop_cache_find(pim, &rpf); pnc = pim_nexthop_cache_find(pim, &rpf);
if (!pnc) { if (!pnc) {
if (PIM_DEBUG_PIM_NHT) { if (PIM_DEBUG_PIM_NHT)
char buf[PREFIX2STR_BUFFER];
prefix2str(&rpf.rpf_addr, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: Skipping NHT update, addr %s is not in local cached DB.", "%s: Skipping NHT update, addr %pFX is not in local cached DB.",
__func__, buf); __func__, &rpf.rpf_addr);
}
return 0; return 0;
} }
} else { } else {
@ -819,17 +808,13 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
continue; continue;
} }
if (PIM_DEBUG_PIM_NHT) { if (PIM_DEBUG_PIM_NHT)
char p_str[PREFIX2STR_BUFFER];
prefix2str(&nhr.prefix, p_str, sizeof(p_str));
zlog_debug( zlog_debug(
"%s: NHT addr %s(%s) %d-nhop via %s(%s) type %d distance:%u metric:%u ", "%s: NHT addr %pFX(%s) %d-nhop via %s(%s) type %d distance:%u metric:%u ",
__func__, p_str, pim->vrf->name, i + 1, __func__, &nhr.prefix, pim->vrf->name,
inet_ntoa(nexthop->gate.ipv4), i + 1, inet_ntoa(nexthop->gate.ipv4),
ifp->name, nexthop->type, nhr.distance, ifp->name, nexthop->type, nhr.distance,
nhr.metric); nhr.metric);
}
if (!ifp->info) { if (!ifp->info) {
/* /*
@ -879,15 +864,12 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
} }
SET_FLAG(pnc->flags, PIM_NEXTHOP_ANSWER_RECEIVED); SET_FLAG(pnc->flags, PIM_NEXTHOP_ANSWER_RECEIVED);
if (PIM_DEBUG_PIM_NHT) { if (PIM_DEBUG_PIM_NHT)
char buf[PREFIX2STR_BUFFER];
prefix2str(&nhr.prefix, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: NHT Update for %s(%s) num_nh %d num_pim_nh %d vrf:%u up %ld rp %d", "%s: NHT Update for %pFX(%s) num_nh %d num_pim_nh %d vrf:%u up %ld rp %d",
__func__, buf, pim->vrf->name, nhr.nexthop_num, __func__, &nhr.prefix, pim->vrf->name, nhr.nexthop_num,
pnc->nexthop_num, vrf_id, pnc->upstream_hash->count, pnc->nexthop_num, vrf_id, pnc->upstream_hash->count,
listcount(pnc->rp_list)); listcount(pnc->rp_list));
}
pim_rpf_set_refresh_time(pim); pim_rpf_set_refresh_time(pim);

View File

@ -248,14 +248,10 @@ struct rp_info *pim_rp_find_match_group(struct pim_instance *pim,
} }
rp_info = rn->info; rp_info = rn->info;
if (PIM_DEBUG_PIM_TRACE) { if (PIM_DEBUG_PIM_TRACE)
char buf[PREFIX_STRLEN]; zlog_debug("Lookedup: %p for rp_info: %p(%pFX) Lock: %d", rn,
rp_info, &rp_info->group,
zlog_debug("Lookedup: %p for rp_info: %p(%s) Lock: %d", rn,
rp_info,
prefix2str(&rp_info->group, buf, sizeof(buf)),
route_node_get_lock_count(rn)); route_node_get_lock_count(rn));
}
route_unlock_node(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.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN; nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = old_upstream_addr; nht_p.u.prefix4 = old_upstream_addr;
if (PIM_DEBUG_PIM_TRACE) { if (PIM_DEBUG_PIM_TRACE)
char buf[PREFIX2STR_BUFFER];
prefix2str(&nht_p, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: Deregister upstream %s addr %s with Zebra NHT", "%s: Deregister upstream %s addr %pFX with Zebra NHT",
__func__, up->sg_str, buf); __func__, up->sg_str, &nht_p);
}
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL, false); 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.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = nht_p.u.prefix4 =
rp_all->rp.rpf_addr.u.prefix4; // RP address rp_all->rp.rpf_addr.u.prefix4; // RP address
if (PIM_DEBUG_PIM_NHT_RP) { 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));
zlog_debug( zlog_debug(
"%s: NHT Register rp_all addr %s grp %s ", "%s: NHT Register rp_all addr %pFX grp %pFX ",
__func__, buf, buf1); __func__, &nht_p, &rp_all->group);
}
frr_each (rb_pim_upstream, &pim->upstream_head, up) { frr_each (rb_pim_upstream, &pim->upstream_head, up) {
/* Find (*, G) upstream whose RP is not /* 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 = route_node_get(pim->rp_table, &rp_info->group);
rn->info = rp_info; rn->info = rp_info;
if (PIM_DEBUG_PIM_TRACE) { if (PIM_DEBUG_PIM_TRACE)
char buf[PREFIX_STRLEN]; zlog_debug("Allocated: %p for rp_info: %p(%pFX) Lock: %d", rn,
rp_info, &rp_info->group,
zlog_debug("Allocated: %p for rp_info: %p(%s) Lock: %d", rn,
rp_info,
prefix2str(&rp_info->group, buf, sizeof(buf)),
route_node_get_lock_count(rn)); route_node_get_lock_count(rn));
}
frr_each (rb_pim_upstream, &pim->upstream_head, up) { frr_each (rb_pim_upstream, &pim->upstream_head, up) {
if (up->sg.src.s_addr == INADDR_ANY) { 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.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN; nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4; nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
if (PIM_DEBUG_PIM_NHT_RP) { if (PIM_DEBUG_PIM_NHT_RP)
char buf[PREFIX2STR_BUFFER]; zlog_debug("%s: NHT Register RP addr %pFX grp %pFX with Zebra ",
char buf1[PREFIX2STR_BUFFER]; __func__, &nht_p, &rp_info->group);
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);
}
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false, NULL); 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, if (!pim_ecmp_nexthop_lookup(pim, &rp_info->rp.source_nexthop, &nht_p,
&rp_info->group, 1)) &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 pim_upstream *up;
struct bsgrp_node *bsgrp = NULL; struct bsgrp_node *bsgrp = NULL;
struct bsm_rpinfo *bsrp = NULL; struct bsm_rpinfo *bsrp = NULL;
char grp_str[PREFIX2STR_BUFFER];
char rp_str[INET_ADDRSTRLEN]; char rp_str[INET_ADDRSTRLEN];
if (!inet_ntop(AF_INET, &rp_addr, rp_str, sizeof(rp_str))) if (!inet_ntop(AF_INET, &rp_addr, rp_str, sizeof(rp_str)))
snprintf(rp_str, sizeof(rp_str), "<rp?>"); snprintf(rp_str, sizeof(rp_str), "<rp?>");
prefix2str(&group, grp_str, sizeof(grp_str));
if (plist) if (plist)
rp_info = pim_rp_find_prefix_list(pim, rp_addr, 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) if (PIM_DEBUG_PIM_TRACE)
zlog_debug("%s: Delete RP %s for the group %s", __func__, zlog_debug("%s: Delete RP %s for the group %pFX", __func__,
rp_str, grp_str); rp_str, &group);
/* While static RP is getting deleted, we need to check if dynamic RP /* 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 * 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?>"); "<bsrp?>");
zlog_debug( zlog_debug(
"%s: BSM RP %s found for the group %s", "%s: BSM RP %s found for the group %pFX",
__func__, bsrp_str, grp_str); __func__, bsrp_str, &group);
} }
return pim_rp_change(pim, bsrp->rp_address, return pim_rp_change(pim, bsrp->rp_address,
group, RP_SRC_BSR); group, RP_SRC_BSR);
@ -780,8 +756,8 @@ int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr,
} else { } else {
if (PIM_DEBUG_PIM_TRACE) if (PIM_DEBUG_PIM_TRACE)
zlog_debug( zlog_debug(
"%s: BSM RP not found for the group %s", "%s: BSM RP not found for the group %pFX",
__func__, grp_str); __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.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN; nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4; nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
if (PIM_DEBUG_PIM_NHT_RP) { if (PIM_DEBUG_PIM_NHT_RP)
char buf[PREFIX2STR_BUFFER]; zlog_debug("%s: Deregister RP addr %pFX with Zebra ", __func__,
prefix2str(&nht_p, buf, sizeof(buf)); &nht_p);
zlog_debug("%s: Deregister RP addr %s with Zebra ", __func__,
buf);
}
pim_delete_tracked_nexthop(pim, &nht_p, NULL, rp_info, false); pim_delete_tracked_nexthop(pim, &nht_p, NULL, rp_info, false);
if (!str2prefix("224.0.0.0/4", &g_all)) 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, EC_LIB_DEVELOPMENT,
"Expected rn->info to be equal to rp_info"); "Expected rn->info to be equal to rp_info");
if (PIM_DEBUG_PIM_TRACE) { if (PIM_DEBUG_PIM_TRACE)
char buf[PREFIX_STRLEN];
zlog_debug( zlog_debug(
"%s:Found for Freeing: %p for rp_info: %p(%s) Lock: %d", "%s:Found for Freeing: %p for rp_info: %p(%pFX) Lock: %d",
__func__, rn, rp_info, __func__, rn, rp_info, &rp_info->group,
prefix2str(&rp_info->group, buf,
sizeof(buf)),
route_node_get_lock_count(rn)); route_node_get_lock_count(rn));
}
rn->info = NULL; rn->info = NULL;
route_unlock_node(rn); route_unlock_node(rn);
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 */ /* Deregister old RP addr with Zebra NHT */
if (rp_info->rp.rpf_addr.u.prefix4.s_addr != INADDR_ANY) { if (rp_info->rp.rpf_addr.u.prefix4.s_addr != INADDR_ANY) {
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4; nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
if (PIM_DEBUG_PIM_NHT_RP) { if (PIM_DEBUG_PIM_NHT_RP)
char buf[PREFIX2STR_BUFFER]; zlog_debug("%s: Deregister RP addr %pFX with Zebra ",
__func__, &nht_p);
prefix2str(&nht_p, buf, sizeof(buf));
zlog_debug("%s: Deregister RP addr %s with Zebra ",
__func__, buf);
}
pim_delete_tracked_nexthop(pim, &nht_p, NULL, rp_info, false); 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 */ /* Register new RP addr with Zebra NHT */
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4; nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
if (PIM_DEBUG_PIM_NHT_RP) { if (PIM_DEBUG_PIM_NHT_RP)
char buf[PREFIX2STR_BUFFER]; zlog_debug("%s: NHT Register RP addr %pFX grp %pFX with Zebra ",
char buf1[PREFIX2STR_BUFFER]; __func__, &nht_p, &rp_info->group);
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);
}
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false, NULL); 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, 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.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN; nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4; nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
if (PIM_DEBUG_PIM_NHT_RP) { 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( zlog_debug(
"%s: NHT Register RP addr %s grp %s with Zebra", "%s: NHT Register RP addr %pFX grp %pFX with Zebra",
__func__, buf, buf1); __func__, &nht_p, &rp_info->group);
}
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false, pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false,
NULL); NULL);
pim_rpf_set_refresh_time(pim); 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 listnode *node;
struct rp_info *rp_info; struct rp_info *rp_info;
char rp_buffer[32]; char rp_buffer[32];
char group_buffer[32];
int count = 0; int count = 0;
for (ALL_LIST_ELEMENTS_RO(pim->rp_list, node, rp_info)) { 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_buffer, 32),
rp_info->plist); rp_info->plist);
else 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, inet_ntop(AF_INET,
&rp_info->rp.rpf_addr.u.prefix4, &rp_info->rp.rpf_addr.u.prefix4,
rp_buffer, 32), rp_buffer, 32),
prefix2str(&rp_info->group, group_buffer, 32)); &rp_info->group);
count++; count++;
} }
@ -1335,9 +1288,8 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj)
if (rp_info->plist) if (rp_info->plist)
vty_out(vty, "%-18s ", rp_info->plist); vty_out(vty, "%-18s ", rp_info->plist);
else else
vty_out(vty, "%-18s ", vty_out(vty, "%-18pFX ",
prefix2str(&rp_info->group, buf, &rp_info->group);
48));
if (rp_info->rp.source_nexthop.interface) if (rp_info->rp.source_nexthop.interface)
vty_out(vty, "%-16s ", vty_out(vty, "%-16s ",

View File

@ -267,13 +267,10 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
nht_p.family = AF_INET; nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN; nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = up->upstream_addr; nht_p.u.prefix4 = up->upstream_addr;
if (PIM_DEBUG_PIM_TRACE) { if (PIM_DEBUG_PIM_TRACE)
char buf[PREFIX2STR_BUFFER];
prefix2str(&nht_p, buf, sizeof(buf));
zlog_debug( zlog_debug(
"%s: Deregister upstream %s addr %s with Zebra NHT", "%s: Deregister upstream %s addr %pFX with Zebra NHT",
__func__, up->sg_str, buf); __func__, up->sg_str, &nht_p);
}
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL, false); 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 (PIM_DEBUG_PIM_TRACE) {
if (up) { if (up)
char buf[PREFIX2STR_BUFFER]; zlog_debug("%s(%s): %s, iif %pFX (%s) found: %d: ref_count: %d",
prefix2str(&up->rpf.rpf_addr, buf, sizeof(buf));
zlog_debug("%s(%s): %s, iif %s (%s) found: %d: ref_count: %d",
__func__, name, __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" , up->rpf.source_nexthop.interface->name : "Unknown" ,
found, up->ref_count); found, up->ref_count);
} else else
zlog_debug("%s(%s): (%s) failure to create", __func__, zlog_debug("%s(%s): (%s) failure to create", __func__,
name, pim_str_sg_dump(sg)); name, pim_str_sg_dump(sg));
} }

View File

@ -130,10 +130,8 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
p = c->address; p = c->address;
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA) {
char buf[BUFSIZ]; zlog_debug("%s: %s(%u) connected IP address %pFX flags %u %s",
prefix2str(p, buf, BUFSIZ); __func__, c->ifp->name, vrf_id, p, c->flags,
zlog_debug("%s: %s(%u) connected IP address %s flags %u %s",
__func__, c->ifp->name, vrf_id, buf, c->flags,
CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY) CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
? "secondary" ? "secondary"
: "primary"); : "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); struct in_addr primary_addr = pim_find_primary_addr(c->ifp);
if (p->family != AF_INET if (p->family != AF_INET
|| primary_addr.s_addr != p->u.prefix4.s_addr) { || primary_addr.s_addr != p->u.prefix4.s_addr) {
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA)
/* but we had a primary address already */
char buf[BUFSIZ];
prefix2str(p, buf, BUFSIZ);
zlog_warn( zlog_warn(
"%s: %s : forcing secondary flag on %s", "%s: %s : forcing secondary flag on %pFX",
__func__, c->ifp->name, buf); __func__, c->ifp->name, p);
}
SET_FLAG(c->flags, ZEBRA_IFA_SECONDARY); SET_FLAG(c->flags, ZEBRA_IFA_SECONDARY);
} }
} }
@ -211,11 +202,9 @@ static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS)
p = c->address; p = c->address;
if (p->family == AF_INET) { if (p->family == AF_INET) {
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA) {
char buf[BUFSIZ];
prefix2str(p, buf, BUFSIZ);
zlog_debug( zlog_debug(
"%s: %s(%u) disconnected IP address %s flags %u %s", "%s: %s(%u) disconnected IP address %pFX flags %u %s",
__func__, c->ifp->name, vrf_id, buf, c->flags, __func__, c->ifp->name, vrf_id, p, c->flags,
CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY) CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
? "secondary" ? "secondary"
: "primary"); : "primary");

View File

@ -60,14 +60,9 @@ void sharp_nh_tracker_dump(struct vty *vty)
struct listnode *node; struct listnode *node;
struct sharp_nh_tracker *nht; struct sharp_nh_tracker *nht;
for (ALL_LIST_ELEMENTS_RO(sg.nhs, node, nht)) { for (ALL_LIST_ELEMENTS_RO(sg.nhs, node, nht))
char buf[PREFIX_STRLEN]; vty_out(vty, "%pFX: Nexthops: %u Updates: %u\n", &nht->p,
nht->nhop_num, nht->updates);
vty_out(vty, "%s: Nexthops: %u Updates: %u\n",
prefix2str(&nht->p, buf, sizeof(buf)),
nht->nhop_num,
nht->updates);
}
} }
PREDECL_RBTREE_UNIQ(sharp_nhg_rb); PREDECL_RBTREE_UNIQ(sharp_nhg_rb);

View File

@ -146,16 +146,12 @@ DEFPY (install_routes_data_dump,
"Data about what is going on\n" "Data about what is going on\n"
"Route Install/Removal Information\n") "Route Install/Removal Information\n")
{ {
char buf[PREFIX_STRLEN];
struct timeval r; struct timeval r;
timersub(&sg.r.t_end, &sg.r.t_start, &r); timersub(&sg.r.t_end, &sg.r.t_start, &r);
vty_out(vty, "Prefix: %s Total: %u %u %u Time: %jd.%ld\n", vty_out(vty, "Prefix: %pFX Total: %u %u %u Time: %jd.%ld\n",
prefix2str(&sg.r.orig_prefix, buf, sizeof(buf)), &sg.r.orig_prefix, sg.r.total_routes, sg.r.installed_routes,
sg.r.total_routes, sg.r.removed_routes, (intmax_t)r.tv_sec, (long)r.tv_usec);
sg.r.installed_routes,
sg.r.removed_routes,
(intmax_t)r.tv_sec, (long)r.tv_usec);
return CMD_SUCCESS; return CMD_SUCCESS;
} }

View File

@ -109,24 +109,21 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS)
struct prefix p; struct prefix p;
enum zapi_route_notify_owner note; enum zapi_route_notify_owner note;
uint32_t table_id; uint32_t table_id;
char buf[PREFIX_STRLEN];
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, &note)) if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, &note))
return -1; return -1;
prefix2str(&p, buf, sizeof(buf));
switch (note) { switch (note) {
case ZAPI_ROUTE_FAIL_INSTALL: case ZAPI_ROUTE_FAIL_INSTALL:
static_nht_mark_state(&p, vrf_id, STATIC_NOT_INSTALLED); static_nht_mark_state(&p, vrf_id, STATIC_NOT_INSTALLED);
zlog_warn("%s: Route %s failed to install for table: %u", zlog_warn("%s: Route %pFX failed to install for table: %u",
__func__, buf, table_id); __func__, &p, table_id);
break; break;
case ZAPI_ROUTE_BETTER_ADMIN_WON: case ZAPI_ROUTE_BETTER_ADMIN_WON:
static_nht_mark_state(&p, vrf_id, STATIC_NOT_INSTALLED); static_nht_mark_state(&p, vrf_id, STATIC_NOT_INSTALLED);
zlog_warn( zlog_warn(
"%s: Route %s over-ridden by better route for table: %u", "%s: Route %pFX over-ridden by better route for table: %u",
__func__, buf, table_id); __func__, &p, table_id);
break; break;
case ZAPI_ROUTE_INSTALLED: case ZAPI_ROUTE_INSTALLED:
static_nht_mark_state(&p, vrf_id, STATIC_INSTALLED); static_nht_mark_state(&p, vrf_id, STATIC_INSTALLED);
@ -136,8 +133,8 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS)
break; break;
case ZAPI_ROUTE_REMOVE_FAIL: case ZAPI_ROUTE_REMOVE_FAIL:
static_nht_mark_state(&p, vrf_id, STATIC_INSTALLED); static_nht_mark_state(&p, vrf_id, STATIC_INSTALLED);
zlog_warn("%s: Route %s failure to remove for table: %u", zlog_warn("%s: Route %pFX failure to remove for table: %u",
__func__, buf, table_id); __func__, &p, table_id);
break; break;
} }

View File

@ -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) if (bgp_dest_has_bgp_path_info_data(dest)
&& !prefix_in_array(dest_p, prefixes, prefix_count)) { && !prefix_in_array(dest_p, prefixes, prefix_count)) {
char buf[PREFIX2STR_BUFFER]; printf("prefix %pFX was not expected!\n", dest_p);
prefix2str(dest_p, buf, PREFIX2STR_BUFFER);
printf("prefix %s was not expected!\n", buf);
assert(0); assert(0);
} }
} }

View File

@ -47,12 +47,10 @@ DEFPY(magic_test, magic_test_cmd,
"magic (0-100) {ipv4net A.B.C.D/M|X:X::X:X$ipv6}", "magic (0-100) {ipv4net A.B.C.D/M|X:X::X:X$ipv6}",
"1\n2\n3\n4\n5\n") "1\n2\n3\n4\n5\n")
{ {
char buf[256];
vty_out(vty, "def: %s\n", self->string); vty_out(vty, "def: %s\n", self->string);
vty_out(vty, "num: %ld\n", magic); vty_out(vty, "num: %ld\n", magic);
vty_out(vty, "ipv4: %s\n", prefix2str(ipv4net, buf, sizeof(buf))); vty_out(vty, "ipv4: %pFX\n", ipv4net);
vty_out(vty, "ipv6: %s\n", vty_out(vty, "ipv6: %pI6\n", &ipv6);
inet_ntop(AF_INET6, &ipv6, buf, sizeof(buf)));
return CMD_SUCCESS; return CMD_SUCCESS;
} }

View File

@ -104,7 +104,6 @@ static void add_nodes(struct route_table *table, ...)
static void print_subtree(struct route_node *rn, const char *legend, static void print_subtree(struct route_node *rn, const char *legend,
int indent_level) int indent_level)
{ {
char buf[PREFIX2STR_BUFFER];
int i; int i;
/* /*
@ -114,8 +113,7 @@ static void print_subtree(struct route_node *rn, const char *legend,
printf(" "); printf(" ");
} }
prefix2str(&rn->p, buf, sizeof(buf)); printf("%s: %pFX", legend, &rn->p);
printf("%s: %s", legend, buf);
if (!rn->info) { if (!rn->info) {
printf(" (internal)"); printf(" (internal)");
} }

View File

@ -259,14 +259,10 @@ void connected_up(struct interface *ifp, struct connected *ifc)
/* Schedule LSP forwarding entries for processing, if appropriate. */ /* Schedule LSP forwarding entries for processing, if appropriate. */
if (zvrf->vrf->vrf_id == VRF_DEFAULT) { if (zvrf->vrf->vrf_id == VRF_DEFAULT) {
if (IS_ZEBRA_DEBUG_MPLS) { if (IS_ZEBRA_DEBUG_MPLS)
char buf[PREFIX_STRLEN];
zlog_debug( zlog_debug(
"%u: IF %s IP %s address add/up, scheduling MPLS processing", "%u: IF %s IP %pFX address add/up, scheduling MPLS processing",
zvrf->vrf->vrf_id, ifp->name, zvrf->vrf->vrf_id, ifp->name, &p);
prefix2str(&p, buf, sizeof(buf)));
}
mpls_mark_lsps_for_processing(zvrf, &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. */ /* Schedule LSP forwarding entries for processing, if appropriate. */
if (zvrf->vrf->vrf_id == VRF_DEFAULT) { if (zvrf->vrf->vrf_id == VRF_DEFAULT) {
if (IS_ZEBRA_DEBUG_MPLS) { if (IS_ZEBRA_DEBUG_MPLS)
char buf[PREFIX_STRLEN];
zlog_debug( zlog_debug(
"%u: IF %s IP %s address down, scheduling MPLS processing", "%u: IF %s IP %pFX address down, scheduling MPLS processing",
zvrf->vrf->vrf_id, ifp->name, zvrf->vrf->vrf_id, ifp->name, &p);
prefix2str(&p, buf, sizeof(buf)));
}
mpls_mark_lsps_for_processing(zvrf, &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. */ /* Schedule LSP forwarding entries for processing, if appropriate. */
if (ifp->vrf_id == VRF_DEFAULT) { if (ifp->vrf_id == VRF_DEFAULT) {
if (IS_ZEBRA_DEBUG_MPLS) { if (IS_ZEBRA_DEBUG_MPLS)
char buf[PREFIX_STRLEN];
zlog_debug( zlog_debug(
"%u: IF %s IP %s address delete, scheduling MPLS processing", "%u: IF %s IP %pFX address delete, scheduling MPLS processing",
ifp->vrf_id, ifp->name, ifp->vrf_id, ifp->name, p);
prefix2str(p, buf, sizeof(buf)));
}
mpls_mark_lsps_for_processing(vrf_info_lookup(ifp->vrf_id), p); mpls_mark_lsps_for_processing(vrf_info_lookup(ifp->vrf_id), p);
} }
} }

View File

@ -1296,8 +1296,6 @@ static void ifs_dump_brief_vty(struct vty *vty, struct vrf *vrf)
bool print_header = true; bool print_header = true;
FOR_ALL_INTERFACES (vrf, ifp) { FOR_ALL_INTERFACES (vrf, ifp) {
char global_pfx[PREFIX_STRLEN] = {0};
char buf[PREFIX_STRLEN] = {0};
bool first_pfx_printed = false; bool first_pfx_printed = false;
if (print_header) { if (print_header) {
@ -1329,17 +1327,17 @@ static void ifs_dump_brief_vty(struct vty *vty, struct vrf *vrf)
if (!CHECK_FLAG(connected->flags, if (!CHECK_FLAG(connected->flags,
ZEBRA_IFA_SECONDARY)) { ZEBRA_IFA_SECONDARY)) {
p = connected->address; p = connected->address;
prefix2str(p, buf, sizeof(buf));
if (first_pfx_printed) { if (first_pfx_printed) {
/* padding to prepare row only for ip addr */ /* padding to prepare row only
* for ip addr */
vty_out(vty, "%-40s", ""); vty_out(vty, "%-40s", "");
if (list_size > 1) if (list_size > 1)
vty_out(vty, "+ "); vty_out(vty, "+ ");
vty_out(vty, "%s\n", buf); vty_out(vty, "%pFX\n", p);
} else { } else {
if (list_size > 1) if (list_size > 1)
vty_out(vty, "+ "); vty_out(vty, "+ ");
vty_out(vty, "%s\n", buf); vty_out(vty, "%pFX\n", p);
} }
first_pfx_printed = true; first_pfx_printed = true;
break; break;
@ -1361,17 +1359,17 @@ static void ifs_dump_brief_vty(struct vty *vty, struct vrf *vrf)
p = connected->address; p = connected->address;
/* Don't print link local pfx */ /* Don't print link local pfx */
if (!IN6_IS_ADDR_LINKLOCAL(&p->u.prefix6)) { if (!IN6_IS_ADDR_LINKLOCAL(&p->u.prefix6)) {
prefix2str(p, global_pfx, PREFIX_STRLEN);
if (first_pfx_printed) { if (first_pfx_printed) {
/* padding to prepare row only for ip addr */ /* padding to prepare row only
* for ip addr */
vty_out(vty, "%-40s", ""); vty_out(vty, "%-40s", "");
if (v6_list_size > 1) if (v6_list_size > 1)
vty_out(vty, "+ "); vty_out(vty, "+ ");
vty_out(vty, "%s\n", global_pfx); vty_out(vty, "%pFX\n", p);
} else { } else {
if (v6_list_size > 1) if (v6_list_size > 1)
vty_out(vty, "+ "); vty_out(vty, "+ ");
vty_out(vty, "%s\n", global_pfx); vty_out(vty, "%pFX\n", p);
} }
first_pfx_printed = true; first_pfx_printed = true;
break; break;

View File

@ -175,7 +175,6 @@ static void irdp_send(struct interface *ifp, struct prefix *p, struct stream *s)
{ {
struct zebra_if *zi = ifp->info; struct zebra_if *zi = ifp->info;
struct irdp_interface *irdp = zi->irdp; struct irdp_interface *irdp = zi->irdp;
char buf[PREFIX_STRLEN];
uint32_t dst; uint32_t dst;
uint32_t ttl = 1; 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); dst = htonl(INADDR_ALLHOSTS_GROUP);
if (irdp->flags & IF_DEBUG_MESSAGES) if (irdp->flags & IF_DEBUG_MESSAGES)
zlog_debug("IRDP: TX Advert on %s %s Holdtime=%d Preference=%d", zlog_debug(
ifp->name, prefix2str(p, buf, sizeof(buf)), "IRDP: TX Advert on %s %pFX Holdtime=%d Preference=%d",
irdp->flags & IF_SHUTDOWN ? 0 : irdp->Lifetime, ifp->name, p,
get_pref(irdp, p)); irdp->flags & IF_SHUTDOWN ? 0 : irdp->Lifetime,
get_pref(irdp, p));
send_packet(ifp, s, dst, p, ttl); send_packet(ifp, s, dst, p, ttl);
} }

View File

@ -119,18 +119,17 @@ static void zebra_redistribute(struct zserv *client, int type,
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
RNODE_FOREACH_RE (rn, newre) { RNODE_FOREACH_RE (rn, newre) {
const struct prefix *dst_p, *src_p; const struct prefix *dst_p, *src_p;
char buf[PREFIX_STRLEN];
srcdest_rnode_prefixes(rn, &dst_p, &src_p); srcdest_rnode_prefixes(rn, &dst_p, &src_p);
if (IS_ZEBRA_DEBUG_RIB) if (IS_ZEBRA_DEBUG_RIB)
zlog_debug( 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__, __func__,
zebra_route_string(client->proto), zebra_route_string(client->proto),
prefix2str(dst_p, buf, sizeof(buf)), dst_p, vrf_id,
vrf_id, CHECK_FLAG(newre->flags, CHECK_FLAG(newre->flags,
ZEBRA_FLAG_SELECTED), ZEBRA_FLAG_SELECTED),
newre->type, newre->distance, newre->type, newre->distance,
newre->metric, zebra_check_addr(dst_p)); 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 listnode *node, *nnode;
struct zserv *client; struct zserv *client;
int afi; int afi;
char buf[PREFIX_STRLEN];
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB)
zlog_debug( zlog_debug(
"(%u:%u):%s: Redist update re %p (%s), old %p (%s)", "(%u:%u):%pFX: Redist update re %p (%s), old %p (%s)",
re->vrf_id, re->table, prefix2str(p, buf, sizeof(buf)), re->vrf_id, re->table, p, re,
re, zebra_route_string(re->type), prev_re, zebra_route_string(re->type), prev_re,
prev_re ? zebra_route_string(prev_re->type) : "None"); prev_re ? zebra_route_string(prev_re->type) : "None");
}
afi = family2afi(p->family); afi = family2afi(p->family);
if (!afi) { if (!afi) {
@ -214,8 +211,7 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,
} }
if (!zebra_check_addr(p)) { if (!zebra_check_addr(p)) {
if (IS_ZEBRA_DEBUG_RIB) if (IS_ZEBRA_DEBUG_RIB)
zlog_debug("Redist update filter prefix %s", zlog_debug("Redist update filter prefix %pFX", p);
prefix2str(p, buf, sizeof(buf)));
return; 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 (zebra_redistribute_check(re, client, p, afi)) {
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
zlog_debug( 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__, __func__,
zebra_route_string(client->proto), zebra_route_string(client->proto), p,
prefix2str(p, buf, sizeof(buf)),
re->vrf_id, re->table, re->type, re->vrf_id, re->table, re->type,
re->distance, re->metric); 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 listnode *node, *nnode;
struct zserv *client; struct zserv *client;
int afi; int afi;
char buf[PREFIX_STRLEN];
vrf_id_t vrfid; vrf_id_t vrfid;
if (old_re) if (old_re)
@ -265,13 +259,11 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
return; return;
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
zlog_debug( zlog_debug("%u:%pFX: Redist del: re %p (%s), new re %p (%s)",
"%u:%s: Redist del: re %p (%s), new re %p (%s)", vrfid, p, old_re,
vrfid, prefix2str(p, buf, sizeof(buf)), old_re ? zebra_route_string(old_re->type) : "None",
old_re, new_re,
old_re ? zebra_route_string(old_re->type) : "None", new_re ? zebra_route_string(new_re->type) : "None");
new_re,
new_re ? zebra_route_string(new_re->type) : "None");
} }
/* Add DISTANCE_INFINITY check. */ /* 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 (!zebra_check_addr(p)) {
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
zlog_debug( zlog_debug(
"%u:%s: Redist del old: skipping invalid prefix", "%u:%pFX: Redist del old: skipping invalid prefix",
vrfid, prefix2str(p, buf, sizeof(buf))); vrfid, p);
} }
return; return;
} }
@ -541,12 +533,10 @@ void zebra_interface_address_add_update(struct interface *ifp,
struct prefix *p; struct prefix *p;
if (IS_ZEBRA_DEBUG_EVENT) { if (IS_ZEBRA_DEBUG_EVENT) {
char buf[PREFIX_STRLEN];
p = ifc->address; p = ifc->address;
zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %s on %s(%u)", zlog_debug(
prefix2str(p, buf, sizeof(buf)), ifp->name, "MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %pFX on %s(%u)",
ifp->vrf_id); p, ifp->name, ifp->vrf_id);
} }
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
@ -580,12 +570,10 @@ void zebra_interface_address_delete_update(struct interface *ifp,
struct prefix *p; struct prefix *p;
if (IS_ZEBRA_DEBUG_EVENT) { if (IS_ZEBRA_DEBUG_EVENT) {
char buf[PREFIX_STRLEN];
p = ifc->address; p = ifc->address;
zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %s on %s(%u)", zlog_debug(
prefix2str(p, buf, sizeof(buf)), "MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %pFX on %s(%u)",
ifp->name, ifp->vrf_id); p, ifp->name, ifp->vrf_id);
} }
zebra_vxlan_add_del_gw_macip(ifp, ifc->address, 0); zebra_vxlan_add_del_gw_macip(ifp, ifc->address, 0);

View File

@ -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; p.prefixlen = rtm->rtm_dst_len;
if (rtm->rtm_src_len != 0) { if (rtm->rtm_src_len != 0) {
char buf[PREFIX_STRLEN];
flog_warn( flog_warn(
EC_ZEBRA_UNSUPPORTED_V4_SRCDEST, EC_ZEBRA_UNSUPPORTED_V4_SRCDEST,
"unsupported IPv4 sourcedest route (dest %s vrf %u)", "unsupported IPv4 sourcedest route (dest %pFX vrf %u)",
prefix2str(&p, buf, sizeof(buf)), vrf_id); &p, vrf_id);
return 0; 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) { if (IS_ZEBRA_DEBUG_KERNEL) {
char buf[PREFIX_STRLEN];
char buf2[PREFIX_STRLEN]; char buf2[PREFIX_STRLEN];
zlog_debug( zlog_debug(
"%s %s%s%s vrf %s(%u) table_id: %u metric: %d Admin Distance: %d", "%s %pFX%s%s vrf %s(%u) table_id: %u metric: %d Admin Distance: %d",
nl_msg_type_to_str(h->nlmsg_type), nl_msg_type_to_str(h->nlmsg_type), &p,
prefix2str(&p, buf, sizeof(buf)),
src_p.prefixlen ? " from " : "", src_p.prefixlen ? " from " : "",
src_p.prefixlen ? prefix2str(&src_p, buf2, sizeof(buf2)) src_p.prefixlen ? prefix2str(&src_p, buf2, sizeof(buf2))
: "", : "",

View File

@ -80,19 +80,15 @@ static int kernel_rtm(int cmd, const struct prefix *p,
bool gate = false; bool gate = false;
int error; int error;
char gate_buf[INET6_BUFSIZ]; char gate_buf[INET6_BUFSIZ];
char prefix_buf[PREFIX_STRLEN];
enum blackhole_type bh_type = BLACKHOLE_UNSPEC; 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 * We only have the ability to ADD or DELETE at this point
* in time. * in time.
*/ */
if (cmd != RTM_ADD && cmd != RTM_DELETE) { if (cmd != RTM_ADD && cmd != RTM_DELETE) {
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("%s: %s odd command %s", zlog_debug("%s: %pFX odd command %s", __func__, p,
__func__, prefix_buf,
lookup_msg(rtm_type_str, cmd, NULL)); lookup_msg(rtm_type_str, cmd, NULL));
return 0; return 0;
} }
@ -237,8 +233,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,
if (IS_ZEBRA_DEBUG_KERNEL) { if (IS_ZEBRA_DEBUG_KERNEL) {
if (!gate) { if (!gate) {
zlog_debug( zlog_debug(
"%s: %s: attention! gate not found for re", "%s: %pFX: attention! gate not found for re",
__func__, prefix_buf); __func__, p);
} else { } else {
switch (p->family) { switch (p->family) {
case AF_INET: case AF_INET:
@ -266,8 +262,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,
case ZEBRA_ERR_NOERROR: case ZEBRA_ERR_NOERROR:
nexthop_num++; nexthop_num++;
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("%s: %s: successfully did NH %s", zlog_debug("%s: %pFX: successfully did NH %s",
__func__, prefix_buf, gate_buf); __func__, p, gate_buf);
if (cmd == RTM_ADD) if (cmd == RTM_ADD)
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB); SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
break; break;
@ -289,8 +285,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,
default: default:
flog_err( flog_err(
EC_LIB_SYSTEM_CALL, EC_LIB_SYSTEM_CALL,
"%s: %s: rtm_write() unexpectedly returned %d for command %s", "%s: %pFX: rtm_write() unexpectedly returned %d for command %s",
__func__, prefix_buf, error, __func__, p, error,
lookup_msg(rtm_type_str, cmd, NULL)); lookup_msg(rtm_type_str, cmd, NULL));
break; break;
} }
@ -300,8 +296,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,
if (nexthop_num == 0) { if (nexthop_num == 0) {
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug( zlog_debug(
"%s: No useful nexthops were found in RIB prefix %s", "%s: No useful nexthops were found in RIB prefix %pFX",
__func__, prefix_buf); __func__, p);
return 1; return 1;
} }

View File

@ -2337,7 +2337,6 @@ static int rtadv_config_write(struct vty *vty, struct interface *ifp)
struct rtadv_prefix *rprefix; struct rtadv_prefix *rprefix;
struct rtadv_rdnss *rdnss; struct rtadv_rdnss *rdnss;
struct rtadv_dnssl *dnssl; struct rtadv_dnssl *dnssl;
char buf[PREFIX_STRLEN];
int interval; int interval;
zif = ifp->info; 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)) { for (ALL_LIST_ELEMENTS_RO(zif->rtadv.AdvPrefixList, node, rprefix)) {
if ((rprefix->AdvPrefixCreate == PREFIX_SRC_MANUAL) if ((rprefix->AdvPrefixCreate == PREFIX_SRC_MANUAL)
|| (rprefix->AdvPrefixCreate == PREFIX_SRC_BOTH)) { || (rprefix->AdvPrefixCreate == PREFIX_SRC_BOTH)) {
vty_out(vty, " ipv6 nd prefix %s", vty_out(vty, " ipv6 nd prefix %pFX", &rprefix->prefix);
prefix2str(&rprefix->prefix, buf, sizeof(buf)));
if ((rprefix->AdvValidLifetime != RTADV_VALID_LIFETIME) if ((rprefix->AdvValidLifetime != RTADV_VALID_LIFETIME)
|| (rprefix->AdvPreferredLifetime || (rprefix->AdvPreferredLifetime
!= RTADV_PREFERRED_LIFETIME)) { != RTADV_PREFERRED_LIFETIME)) {

View File

@ -75,8 +75,6 @@ netlink_rule_msg_encode(int cmd, const struct zebra_dplane_ctx *ctx,
} *req = buf; } *req = buf;
const char *ifname = dplane_ctx_rule_get_ifname(ctx); const char *ifname = dplane_ctx_rule_get_ifname(ctx);
char buf1[PREFIX_STRLEN];
char buf2[PREFIX_STRLEN];
if (buflen < sizeof(*req)) if (buflen < sizeof(*req))
return 0; return 0;
@ -141,11 +139,9 @@ netlink_rule_msg_encode(int cmd, const struct zebra_dplane_ctx *ctx,
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug( 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), nl_msg_type_to_str(cmd), nl_family_to_str(family),
ifname, priority, fwmark, ifname, priority, fwmark, src_ip, dst_ip, table);
prefix2str(src_ip, buf1, sizeof(buf1)),
prefix2str(dst_ip, buf2, sizeof(buf2)), table);
return NLMSG_ALIGN(req->n.nlmsg_len); 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; int len;
char *ifname; char *ifname;
struct zebra_pbr_rule rule = {}; struct zebra_pbr_rule rule = {};
char buf1[PREFIX_STRLEN];
char buf2[PREFIX_STRLEN];
uint8_t proto = 0; uint8_t proto = 0;
/* Basic validation followed by extracting attributes. */ /* 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); ret = dplane_pbr_rule_delete(&rule);
zlog_debug( 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__, __func__,
((ret == ZEBRA_DPLANE_REQUEST_FAILURE) ((ret == ZEBRA_DPLANE_REQUEST_FAILURE)
? "Failed to remove" ? "Failed to remove"
: "Removed"), : "Removed"),
nl_family_to_str(frh->family), rule.ifname, nl_family_to_str(frh->family), rule.ifname,
rule.rule.priority, rule.rule.priority, &rule.rule.filter.src_ip,
prefix2str(&rule.rule.filter.src_ip, buf1, &rule.rule.filter.dst_ip,
sizeof(buf1)),
prefix2str(&rule.rule.filter.dst_ip, buf2,
sizeof(buf2)),
rule.rule.action.table); 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) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug( 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_msg_type_to_str(h->nlmsg_type),
nl_family_to_str(frh->family), rule.ifname, nl_family_to_str(frh->family), rule.ifname,
rule.rule.priority, rule.rule.priority, &rule.rule.filter.src_ip,
prefix2str(&rule.rule.filter.src_ip, buf1, &rule.rule.filter.dst_ip, rule.rule.action.table);
sizeof(buf1)),
prefix2str(&rule.rule.filter.dst_ip, buf2,
sizeof(buf2)),
rule.rule.action.table);
return kernel_pbr_rule_del(&rule); return kernel_pbr_rule_del(&rule);
} }

View File

@ -644,17 +644,12 @@ int zsend_redistribute_route(int cmd, struct zserv *client,
return -1; return -1;
} }
if (IS_ZEBRA_DEBUG_SEND) { if (IS_ZEBRA_DEBUG_SEND)
char buf_prefix[PREFIX_STRLEN]; zlog_debug("%s: %s to client %s: type %s, vrf_id %d, p %pFX",
prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
zlog_debug("%s: %s to client %s: type %s, vrf_id %d, p %s",
__func__, zserv_command_string(cmd), __func__, zserv_command_string(cmd),
zebra_route_string(client->proto), zebra_route_string(client->proto),
zebra_route_string(api.type), api.vrf_id, zebra_route_string(api.type), api.vrf_id,
buf_prefix); &api.prefix);
}
return zserv_send_message(client, s); 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); client = zserv_find_client(type, instance);
if (!client || !client->notify_owner) { if (!client || !client->notify_owner) {
if (IS_ZEBRA_DEBUG_PACKET) { if (IS_ZEBRA_DEBUG_PACKET)
char buff[PREFIX_STRLEN];
zlog_debug( zlog_debug(
"Not Notifying Owner: %s about prefix %s(%u) %d vrf: %u", "Not Notifying Owner: %s about prefix %pFX(%u) %d vrf: %u",
zebra_route_string(type), zebra_route_string(type), p, table_id, note,
prefix2str(p, buff, sizeof(buff)), table_id, vrf_id);
note, vrf_id);
}
return 0; return 0;
} }
if (IS_ZEBRA_DEBUG_PACKET) { if (IS_ZEBRA_DEBUG_PACKET)
char buff[PREFIX_STRLEN]; zlog_debug(
"Notifying Owner: %s about prefix %pFX(%u) %d vrf: %u",
zlog_debug("Notifying Owner: %s about prefix %s(%u) %d vrf: %u", zebra_route_string(type), p, table_id, note, vrf_id);
zebra_route_string(type),
prefix2str(p, buff, sizeof(buff)), table_id, note,
vrf_id);
}
s = stream_new(ZEBRA_MAX_PACKET_SIZ); s = stream_new(ZEBRA_MAX_PACKET_SIZ);
stream_reset(s); stream_reset(s);
@ -1903,14 +1890,10 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
vrf_id = zvrf_id(zvrf); vrf_id = zvrf_id(zvrf);
if (IS_ZEBRA_DEBUG_RECV) { if (IS_ZEBRA_DEBUG_RECV)
char buf_prefix[PREFIX_STRLEN]; zlog_debug("%s: p=(%u:%u)%pFX, msg flags=0x%x, flags=0x%x",
__func__, vrf_id, api.tableid, &api.prefix,
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,
(int)api.message, api.flags); (int)api.message, api.flags);
}
/* Allocate new route. */ /* Allocate new route. */
re = XCALLOC(MTYPE_RE, sizeof(struct route_entry)); re = XCALLOC(MTYPE_RE, sizeof(struct route_entry));
@ -2068,14 +2051,10 @@ static void zread_route_del(ZAPI_HANDLER_ARGS)
else else
table_id = zvrf->table_id; table_id = zvrf->table_id;
if (IS_ZEBRA_DEBUG_RECV) { if (IS_ZEBRA_DEBUG_RECV)
char buf_prefix[PREFIX_STRLEN]; zlog_debug("%s: p=(%u:%u)%pFX, msg flags=0x%x, flags=0x%x",
__func__, zvrf_id(zvrf), table_id, &api.prefix,
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,
(int)api.message, api.flags); (int)api.message, api.flags);
}
rib_delete(afi, api.safi, zvrf_id(zvrf), api.type, api.instance, rib_delete(afi, api.safi, zvrf_id(zvrf), api.type, api.instance,
api.flags, &api.prefix, src_p, NULL, 0, table_id, api.metric, api.flags, &api.prefix, src_p, NULL, 0, table_id, api.metric,

View File

@ -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 *new_rule,
struct zebra_pbr_rule *old_rule) struct zebra_pbr_rule *old_rule)
{ {
if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) { if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
char buf1[PREFIX_STRLEN];
char buf2[PREFIX_STRLEN];
zlog_debug( 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, dplane_op2str(op), new_rule->ifname,
new_rule->rule.priority, new_rule->rule.filter.fwmark, new_rule->rule.priority, new_rule->rule.filter.fwmark,
prefix2str(&new_rule->rule.filter.src_ip, buf1, &new_rule->rule.filter.src_ip,
sizeof(buf1)), &new_rule->rule.filter.dst_ip,
prefix2str(&new_rule->rule.filter.dst_ip, buf2,
sizeof(buf2)),
new_rule->rule.action.table); new_rule->rule.action.table);
}
ctx->zd_op = op; ctx->zd_op = op;
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS; 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_dplane_ctx *ctx = NULL;
struct zebra_ns *zns; struct zebra_ns *zns;
if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) { if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
char addr_str[PREFIX_STRLEN]; zlog_debug("init intf ctx %s: idx %d, addr %u:%pFX",
prefix2str(ifc->address, addr_str, sizeof(addr_str));
zlog_debug("init intf ctx %s: idx %d, addr %u:%s",
dplane_op2str(op), ifp->ifindex, ifp->vrf_id, dplane_op2str(op), ifp->ifindex, ifp->vrf_id,
addr_str); ifc->address);
}
ctx = dplane_ctx_alloc(); 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_INSTALL:
case DPLANE_OP_ROUTE_UPDATE: case DPLANE_OP_ROUTE_UPDATE:
case DPLANE_OP_ROUTE_DELETE: case DPLANE_OP_ROUTE_DELETE:
prefix2str(dplane_ctx_get_dest(ctx), buf, sizeof(buf)); zlog_debug("%u:%pFX Dplane route update ctx %p op %s",
dplane_ctx_get_vrf(ctx), dplane_ctx_get_dest(ctx),
zlog_debug("%u:%s Dplane route update ctx %p op %s", ctx, dplane_op2str(dplane_ctx_get_op(ctx)));
dplane_ctx_get_vrf(ctx), buf, ctx,
dplane_op2str(dplane_ctx_get_op(ctx)));
break; break;
case DPLANE_OP_NH_INSTALL: 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_INSTALL:
case DPLANE_OP_ADDR_UNINSTALL: case DPLANE_OP_ADDR_UNINSTALL:
prefix2str(dplane_ctx_get_intf_addr(ctx), buf, sizeof(buf)); zlog_debug("Dplane intf %s, idx %u, addr %pFX",
zlog_debug("Dplane intf %s, idx %u, addr %s",
dplane_op2str(dplane_ctx_get_op(ctx)), 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; break;
case DPLANE_OP_MAC_INSTALL: case DPLANE_OP_MAC_INSTALL:

View File

@ -349,7 +349,6 @@ static int ip_prefix_send_to_client(vrf_id_t vrf_id, struct prefix *p,
{ {
struct zserv *client = NULL; struct zserv *client = NULL;
struct stream *s = NULL; struct stream *s = NULL;
char buf[PREFIX_STRLEN];
client = zserv_find_client(ZEBRA_ROUTE_BGP, 0); client = zserv_find_client(ZEBRA_ROUTE_BGP, 0);
/* BGP may not be running. */ /* 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)); stream_putw_at(s, 0, stream_get_endp(s));
if (IS_ZEBRA_DEBUG_VXLAN) if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Send ip prefix %s %s on vrf %s", zlog_debug("Send ip prefix %pFX %s on vrf %s", p,
prefix2str(p, buf, sizeof(buf)),
(cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) ? "ADD" : "DEL", (cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) ? "ADD" : "DEL",
vrf_id_to_name(vrf_id)); vrf_id_to_name(vrf_id));

View File

@ -1437,7 +1437,6 @@ static inline int zfpm_conn_is_up(void)
static int zfpm_trigger_update(struct route_node *rn, const char *reason) static int zfpm_trigger_update(struct route_node *rn, const char *reason)
{ {
rib_dest_t *dest; rib_dest_t *dest;
char buf[PREFIX_STRLEN];
/* /*
* Ignore if the connection is down. We will update the FPM about * 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) { if (reason) {
zfpm_debug("%s triggering update to FPM - Reason: %s", zfpm_debug("%pFX triggering update to FPM - Reason: %s", &rn->p,
prefix2str(&rn->p, buf, sizeof(buf)), reason); reason);
} }
SET_FLAG(dest->flags, RIB_DEST_UPDATE_FPM); SET_FLAG(dest->flags, RIB_DEST_UPDATE_FPM);

View File

@ -490,19 +490,15 @@ static void zebra_gr_process_route_entry(struct zserv *client,
struct route_node *rn, struct route_node *rn,
struct route_entry *re) struct route_entry *re)
{ {
char buf[PREFIX2STR_BUFFER];
if ((client == NULL) || (rn == NULL) || (re == NULL)) if ((client == NULL) || (rn == NULL) || (re == NULL))
return; return;
/* If the route is not refreshed after restart, delete the entry */ /* If the route is not refreshed after restart, delete the entry */
if (re->uptime < client->restart_time) { if (re->uptime < client->restart_time) {
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB)
prefix2str(&rn->p, buf, sizeof(buf)); zlog_debug("%s: Client %s stale route %pFX is deleted",
zlog_debug("%s: Client %s stale route %s is deleted",
__func__, zebra_route_string(client->proto), __func__, zebra_route_string(client->proto),
buf); &rn->p);
}
rib_delnode(rn, re); rib_delnode(rn, re);
} }
} }

View File

@ -2362,10 +2362,9 @@ int zebra_mpls_fec_unregister(struct zebra_vrf *zvrf, struct prefix *p,
fec = fec_find(table, p); fec = fec_find(table, p);
if (!fec) { if (!fec) {
prefix2str(p, buf, BUFSIZ);
flog_err(EC_ZEBRA_FEC_RM_FAILED, flog_err(EC_ZEBRA_FEC_RM_FAILED,
"Failed to find FEC %s upon unregister, client %s", "Failed to find FEC %pFX upon unregister, client %s",
buf, zebra_route_string(client->proto)); p, zebra_route_string(client->proto));
return -1; 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, fec = fec_add(table, p, in_label, FEC_FLAG_CONFIGURED,
MPLS_INVALID_LABEL_INDEX); MPLS_INVALID_LABEL_INDEX);
if (!fec) { if (!fec) {
prefix2str(p, buf, BUFSIZ);
flog_err(EC_ZEBRA_FEC_ADD_FAILED, 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; return -1;
} }
@ -2585,8 +2583,7 @@ int zebra_mpls_static_fec_del(struct zebra_vrf *zvrf, struct prefix *p)
} }
if (IS_ZEBRA_DEBUG_MPLS) { if (IS_ZEBRA_DEBUG_MPLS) {
prefix2str(p, buf, BUFSIZ); zlog_debug("Delete fec %pFX label %u label index %u", p,
zlog_debug("Delete fec %s label %u label index %u", buf,
fec->label, fec->label_index); 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; struct route_node *rn;
int af; int af;
zebra_fec_t *fec; zebra_fec_t *fec;
char buf[BUFSIZ];
int write = 0; int write = 0;
for (af = AFI_IP; af < AFI_MAX; af++) { 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; continue;
write = 1; write = 1;
prefix2str(&rn->p, buf, BUFSIZ); vty_out(vty, "mpls label bind %pFX %s\n", &rn->p,
vty_out(vty, "mpls label bind %s %s\n", buf,
label2str(fec->label, lstr, BUFSIZ)); 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) const struct zapi_labels *zl)
{ {
int i, counter, ret = 0; int i, counter, ret = 0;
char buf[NEXTHOP_STRLEN], prefix_buf[PREFIX_STRLEN]; char buf[NEXTHOP_STRLEN];
const struct zapi_nexthop *znh; const struct zapi_nexthop *znh;
struct route_table *table; struct route_table *table;
struct route_node *rn = NULL; 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 * attempted to manage LSPs before trying to
* find a route/FEC, so we'll continue that way. * find a route/FEC, so we'll continue that way.
*/ */
if (IS_ZEBRA_DEBUG_RECV || IS_ZEBRA_DEBUG_MPLS) { if (IS_ZEBRA_DEBUG_RECV || IS_ZEBRA_DEBUG_MPLS)
prefix2str(prefix, prefix_buf, zlog_debug(
sizeof(prefix_buf)); "%s: FTN update requested: no route for prefix %pFX",
zlog_debug("%s: FTN update requested: no route for prefix %s", __func__, prefix);
__func__, prefix_buf);
}
} }
} }
@ -2957,9 +2950,9 @@ int mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,
counter++; counter++;
} else if (IS_ZEBRA_DEBUG_RECV | IS_ZEBRA_DEBUG_MPLS) { } else if (IS_ZEBRA_DEBUG_RECV | IS_ZEBRA_DEBUG_MPLS) {
zapi_nexthop2str(znh, buf, sizeof(buf)); zapi_nexthop2str(znh, buf, sizeof(buf));
prefix2str(prefix, prefix_buf, sizeof(prefix_buf)); zlog_debug(
zlog_debug("%s: Unable to update FEC: prefix %s, label %u, znh %s", "%s: Unable to update FEC: prefix %pFX, label %u, znh %s",
__func__, prefix_buf, zl->local_label, buf); __func__, prefix, zl->local_label, buf);
} }
} }
@ -3007,9 +3000,9 @@ int mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,
counter++; counter++;
} else if (IS_ZEBRA_DEBUG_RECV | IS_ZEBRA_DEBUG_MPLS) { } else if (IS_ZEBRA_DEBUG_RECV | IS_ZEBRA_DEBUG_MPLS) {
zapi_nexthop2str(znh, buf, sizeof(buf)); zapi_nexthop2str(znh, buf, sizeof(buf));
prefix2str(prefix, prefix_buf, sizeof(prefix_buf)); zlog_debug(
zlog_debug("%s: Unable to update backup FEC: prefix %s, label %u, znh %s", "%s: Unable to update backup FEC: prefix %pFX, label %u, znh %s",
__func__, prefix_buf, zl->local_label, buf); __func__, prefix, zl->local_label, buf);
} }
} }

View File

@ -21,6 +21,7 @@
#include "lib/log.h" #include "lib/log.h"
#include "lib/northbound.h" #include "lib/northbound.h"
#include "lib/printfrr.h"
#include "libfrr.h" #include "libfrr.h"
#include "lib/command.h" #include "lib/command.h"
#include "lib/routemap.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 interface *ifp;
struct prefix prefix; struct prefix prefix;
char buf[PREFIX_STRLEN] = {0};
ifp = nb_running_get_entry(args->dnode, NULL, true); ifp = nb_running_get_entry(args->dnode, NULL, true);
// addr_family = yang_dnode_get_enum(dnode, "./address-family"); // 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: case NB_EV_VALIDATE:
if (prefix.family == AF_INET if (prefix.family == AF_INET
&& ipv4_martian(&prefix.u.prefix4)) { && ipv4_martian(&prefix.u.prefix4)) {
snprintf(args->errmsg, args->errmsg_len, snprintfrr(args->errmsg, args->errmsg_len,
"invalid address %s", "invalid address %pFX", &prefix);
prefix2str(&prefix, buf, sizeof(buf)));
return NB_ERR_VALIDATION; return NB_ERR_VALIDATION;
} else if (prefix.family == AF_INET6 } else if (prefix.family == AF_INET6
&& ipv6_martian(&prefix.u.prefix6)) { && ipv6_martian(&prefix.u.prefix6)) {
snprintf(args->errmsg, args->errmsg_len, snprintfrr(args->errmsg, args->errmsg_len,
"invalid address %s", "invalid address %pFX", &prefix);
prefix2str(&prefix, buf, sizeof(buf)));
return NB_ERR_VALIDATION; return NB_ERR_VALIDATION;
} }
break; break;

View File

@ -694,15 +694,13 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq)
if (IS_ZEBRA_DEBUG_NHT_DETAILED) { if (IS_ZEBRA_DEBUG_NHT_DETAILED) {
char buf1[PREFIX_STRLEN]; char buf1[PREFIX_STRLEN];
char buf2[PREFIX_STRLEN];
zlog_debug( 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), zvrf_name(zvrf), zvrf_id(zvrf),
srcdest_rnode2str(rn, buf1, srcdest_rnode2str(rn, buf1,
sizeof(buf1)), sizeof(buf1)),
prefix2str(p, buf2, sizeof(buf2)), p, rnh_type2str(rnh->type), seq,
rnh_type2str(rnh->type), seq,
rnh->seqno); rnh->seqno);
} }
@ -1924,11 +1922,9 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)
zsend_route_notify_owner(re, dest_pfx, zsend_route_notify_owner(re, dest_pfx,
ZAPI_ROUTE_FAIL_INSTALL); 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), VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx),
dplane_ctx_get_table(ctx), dplane_ctx_get_table(ctx), dest_pfx);
prefix2str(dest_pfx, dest_str,
sizeof(dest_str)));
} }
break; break;
case DPLANE_OP_ROUTE_DELETE: 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, zsend_route_notify_owner_ctx(ctx,
ZAPI_ROUTE_REMOVE_FAIL); 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), VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx),
dplane_ctx_get_table(ctx), dplane_ctx_get_table(ctx), dest_pfx);
prefix2str(dest_pfx, dest_str,
sizeof(dest_str)));
} }
/* /*
@ -2831,7 +2825,6 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id)
struct route_node *rn; struct route_node *rn;
struct route_entry *re; struct route_entry *re;
struct vrf *vrf; struct vrf *vrf;
char prefix_buf[INET_ADDRSTRLEN];
vrf = vrf_lookup_by_id(vrf_id); 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. */ /* No route for this prefix. */
if (!rn) { if (!rn) {
zlog_debug("%s:%s(%u) lookup failed for %s", __func__, zlog_debug("%s:%s(%u) lookup failed for %pFX", __func__,
VRF_LOGNAME(vrf), vrf_id, VRF_LOGNAME(vrf), vrf_id, (struct prefix *)p);
prefix2str((struct prefix *)p, prefix_buf,
sizeof(prefix_buf)));
return; return;
} }
@ -2911,14 +2902,13 @@ void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id)
*/ */
if (dest->selected_fib) { if (dest->selected_fib) {
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
char buf[PREFIX_STRLEN];
struct vrf *vrf = struct vrf *vrf =
vrf_lookup_by_id(dest->selected_fib->vrf_id); vrf_lookup_by_id(dest->selected_fib->vrf_id);
zlog_debug( 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, 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); route_entry_dump(&rn->p, NULL, dest->selected_fib);
} }
rib_uninstall(rn, 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 */ /* Lookup nhe from route information */
nhe = zebra_nhg_rib_find_nhe(re_nhe, afi); nhe = zebra_nhg_rib_find_nhe(re_nhe, afi);
if (!nhe) { if (!nhe) {
char buf[PREFIX_STRLEN] = "";
char buf2[PREFIX_STRLEN] = ""; char buf2[PREFIX_STRLEN] = "";
flog_err( flog_err(
EC_ZEBRA_TABLE_LOOKUP_FAILED, EC_ZEBRA_TABLE_LOOKUP_FAILED,
"Zebra failed to find or create a nexthop hash entry for %s%s%s", "Zebra failed to find or create a nexthop hash entry for %pFX%s%s",
prefix2str(p, buf, sizeof(buf)), p, src_p ? " from " : "",
src_p ? " from " : "",
src_p ? prefix2str(src_p, buf2, sizeof(buf2)) 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. */ /* Lookup route node. */
rn = srcdest_rnode_lookup(table, p, src_p); rn = srcdest_rnode_lookup(table, p, src_p);
if (!rn) { 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) if (src_p && src_p->prefixlen)
prefix2str(src_p, src_buf, sizeof(src_buf)); prefix2str(src_p, src_buf, sizeof(src_buf));
else 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) { if (IS_ZEBRA_DEBUG_RIB) {
struct vrf *vrf = vrf_lookup_by_id(vrf_id); struct vrf *vrf = vrf_lookup_by_id(vrf_id);
zlog_debug("%s[%d]:%s%s%s doesn't exist in rib", zlog_debug("%s[%d]:%pFX%s%s doesn't exist in rib",
vrf->name, table_id, dst_buf, vrf->name, table_id, p,
(src_buf[0] != '\0') ? " from " : "", (src_buf[0] != '\0') ? " from " : "",
src_buf); src_buf);
} }

View File

@ -480,7 +480,6 @@ static void zebra_rnh_eval_import_check_entry(struct zebra_vrf *zvrf, afi_t afi,
{ {
int state_changed = 0; int state_changed = 0;
struct zserv *client; struct zserv *client;
char bufn[INET6_ADDRSTRLEN];
struct listnode *node; struct listnode *node;
zebra_rnh_remove_from_routing_table(rnh); 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 (state_changed || force) {
if (IS_ZEBRA_DEBUG_NHT) { if (IS_ZEBRA_DEBUG_NHT)
prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
zlog_debug("%s(%u):%pRN: Route import check %s %s", zlog_debug("%s(%u):%pRN: Route import check %s %s",
VRF_LOGNAME(zvrf->vrf), zvrf->vrf->vrf_id, VRF_LOGNAME(zvrf->vrf), zvrf->vrf->vrf_id,
nrn, rnh->state ? "passed" : "failed", nrn, rnh->state ? "passed" : "failed",
state_changed ? "(state changed)" : ""); state_changed ? "(state changed)" : "");
}
/* state changed, notify clients */ /* state changed, notify clients */
for (ALL_LIST_ELEMENTS_RO(rnh->client_list, node, client)) { for (ALL_LIST_ELEMENTS_RO(rnh->client_list, node, client)) {
zebra_send_rnh_update(rnh, client, zebra_send_rnh_update(rnh, client,

View File

@ -310,8 +310,7 @@ static void zl3vni_print_nh(zebra_neigh_t *n, struct vty *vty,
rb_host_count(&n->host_rb)); rb_host_count(&n->host_rb));
vty_out(vty, " Prefixes:\n"); vty_out(vty, " Prefixes:\n");
RB_FOREACH (hle, host_rb_tree_entry, &n->host_rb) RB_FOREACH (hle, host_rb_tree_entry, &n->host_rb)
vty_out(vty, " %s\n", vty_out(vty, " %pFX\n", &hle->p);
prefix2str(&hle->p, buf2, sizeof(buf2)));
} else { } else {
json_hosts = json_object_new_array(); json_hosts = json_object_new_array();
json_object_string_add( 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, " Refcount: %d\n", rb_host_count(&zrmac->host_rb));
vty_out(vty, " Prefixes:\n"); vty_out(vty, " Prefixes:\n");
RB_FOREACH (hle, host_rb_tree_entry, &zrmac->host_rb) RB_FOREACH (hle, host_rb_tree_entry, &zrmac->host_rb)
vty_out(vty, " %s\n", vty_out(vty, " %pFX\n", &hle->p);
prefix2str(&hle->p, buf2, sizeof(buf2)));
} else { } else {
json_hosts = json_object_new_array(); json_hosts = json_object_new_array();
json_object_string_add( json_object_string_add(
@ -1270,7 +1268,6 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni,
{ {
char buf[ETHER_ADDR_STRLEN]; char buf[ETHER_ADDR_STRLEN];
char buf1[INET6_ADDRSTRLEN]; char buf1[INET6_ADDRSTRLEN];
char buf2[PREFIX_STRLEN];
zebra_mac_t *zrmac = NULL; zebra_mac_t *zrmac = NULL;
zrmac = zl3vni_rmac_lookup(zl3vni, rmac); 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); zrmac = zl3vni_rmac_add(zl3vni, rmac);
if (!zrmac) { if (!zrmac) {
zlog_debug( 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)), prefix_mac2str(rmac, buf, sizeof(buf)),
zl3vni->vni, zl3vni->vni,
ipaddr2str(vtep_ip, buf1, sizeof(buf1)), ipaddr2str(vtep_ip, buf1, sizeof(buf1)),
prefix2str(host_prefix, buf2, sizeof(buf2))); host_prefix);
return -1; return -1;
} }
memset(&zrmac->fwd_info, 0, sizeof(zrmac->fwd_info)); 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)) { &vtep_ip->ipaddr_v4)) {
if (IS_ZEBRA_DEBUG_VXLAN) if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug( 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, zl3vni->vni,
inet_ntoa(zrmac->fwd_info.r_vtep_ip), inet_ntoa(zrmac->fwd_info.r_vtep_ip),
ipaddr2str(vtep_ip, buf1, sizeof(buf1)), ipaddr2str(vtep_ip, buf1, sizeof(buf1)),
prefix_mac2str(rmac, buf, sizeof(buf)), prefix_mac2str(rmac, buf, sizeof(buf)),
prefix2str(host_prefix, buf2, sizeof(buf2))); host_prefix);
zrmac->fwd_info.r_vtep_ip = vtep_ip->ipaddr_v4; 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 buf[ETHER_ADDR_STRLEN];
char buf1[ETHER_ADDR_STRLEN]; char buf1[ETHER_ADDR_STRLEN];
char buf2[INET6_ADDRSTRLEN]; char buf2[INET6_ADDRSTRLEN];
char buf3[PREFIX_STRLEN];
zebra_neigh_t *nh = NULL; zebra_neigh_t *nh = NULL;
/* Create the next hop entry, or update its mac, if necessary. */ /* 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); nh = zl3vni_nh_add(zl3vni, vtep_ip, rmac);
if (!nh) { if (!nh) {
zlog_debug( 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)), ipaddr2str(vtep_ip, buf1, sizeof(buf2)),
prefix_mac2str(rmac, buf, sizeof(buf)), prefix_mac2str(rmac, buf, sizeof(buf)),
zl3vni->vni, zl3vni->vni, host_prefix);
prefix2str(host_prefix, buf2, sizeof(buf2)));
return -1; return -1;
} }
@ -1486,12 +1481,13 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni,
zl3vni_nh_install(zl3vni, nh); zl3vni_nh_install(zl3vni, nh);
} else if (memcmp(&nh->emac, rmac, ETH_ALEN) != 0) { } else if (memcmp(&nh->emac, rmac, ETH_ALEN) != 0) {
if (IS_ZEBRA_DEBUG_VXLAN) if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("L3VNI %u RMAC change(%s --> %s) for nexthop %s, prefix %s", zlog_debug(
zl3vni->vni, "L3VNI %u RMAC change(%s --> %s) for nexthop %s, prefix %pFX",
prefix_mac2str(&nh->emac, buf, sizeof(buf)), zl3vni->vni,
prefix_mac2str(rmac, buf1, sizeof(buf1)), prefix_mac2str(&nh->emac, buf, sizeof(buf)),
ipaddr2str(vtep_ip, buf2, sizeof(buf2)), prefix_mac2str(rmac, buf1, sizeof(buf1)),
prefix2str(host_prefix, buf3, sizeof(buf3))); ipaddr2str(vtep_ip, buf2, sizeof(buf2)),
host_prefix);
memcpy(&nh->emac, rmac, ETH_ALEN); memcpy(&nh->emac, rmac, ETH_ALEN);
/* install (update) the nh neigh in kernel */ /* install (update) the nh neigh in kernel */

View File

@ -1172,11 +1172,9 @@ static void zebra_show_stale_client_detail(struct vty *vty,
} }
} }
vty_out(vty, "Current AFI : %d\n", info->current_afi); vty_out(vty, "Current AFI : %d\n", info->current_afi);
if (info->current_prefix) { if (info->current_prefix)
prefix2str(info->current_prefix, buf, vty_out(vty, "Current prefix : %pFX\n",
sizeof(buf)); info->current_prefix);
vty_out(vty, "Current prefix : %s\n", buf);
}
} }
} }
vty_out(vty, "\n"); vty_out(vty, "\n");