static int bfdd_interface_address_update(ZAPI_CALLBACK_ARGS)
{
struct connected *ifc;
- char buf[64];
ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (ifc == NULL)
return 0;
if (bglobal.debug_zebra)
- zlog_debug("zclient: %s local address %s",
+ zlog_debug("zclient: %s local address %pFX",
cmd == ZEBRA_INTERFACE_ADDRESS_ADD ? "add"
: "delete",
- prefix2str(ifc->address, buf, sizeof(buf)));
+ ifc->address);
bfdd_sessions_enable_address(ifc);
if (BGP_DEBUG(zebra, ZEBRA)) {
struct vrf *vrf;
- char buf[2][PREFIX2STR_BUFFER];
vrf = vrf_lookup_by_id(vrf_id);
- prefix2str(&dp, buf[0], sizeof(buf[0]));
- if (ifp) {
+
+ if (ifp)
zlog_debug(
- "Zebra: vrf %s(%u) interface %s bfd destination %s %s %s",
- VRF_LOGNAME(vrf), vrf_id, ifp->name,
- buf[0], bfd_get_status_str(status),
+ "Zebra: vrf %s(%u) interface %s bfd destination %pFX %s %s",
+ VRF_LOGNAME(vrf), vrf_id, ifp->name, &dp,
+ bfd_get_status_str(status),
remote_cbit ? "(cbit on)" : "");
- } else {
- prefix2str(&sp, buf[1], sizeof(buf[1]));
+ else
zlog_debug(
- "Zebra: vrf %s(%u) source %s bfd destination %s %s %s",
- VRF_LOGNAME(vrf), vrf_id, buf[1], buf[0],
+ "Zebra: vrf %s(%u) source %pFX bfd destination %pFX %s %s",
+ VRF_LOGNAME(vrf), vrf_id, &sp, &dp,
bfd_get_status_str(status),
remote_cbit ? "(cbit on)" : "");
- }
}
/* Bring the peer down if BFD is enabled in BGP */
{
struct bgp_debug_filter *filter;
struct listnode *node, *nnode;
- char buf[PREFIX2STR_BUFFER];
vty_out(vty, "%s", desc);
if (filter->p && filter->p->family == AF_EVPN)
bgp_debug_print_evpn_prefix(vty, "", filter->p);
- else if (filter->p) {
- prefix2str(filter->p, buf, sizeof(buf));
- vty_out(vty, " %s", buf);
- }
+ else if (filter->p)
+ vty_out(vty, " %pFX", filter->p);
}
}
{
struct bgp_debug_filter *filter;
struct listnode *node, *nnode;
- char buf[PREFIX2STR_BUFFER];
int write = 0;
if (list && !list_isempty(list)) {
filter->p);
write++;
} else if (filter->p) {
- prefix2str(filter->p, buf, sizeof(buf));
- vty_out(vty, "%s %s\n", desc, buf);
+ vty_out(vty, "%s %pFX\n", desc, filter->p);
write++;
}
}
{
struct prefix *argv_p;
int ret = CMD_SUCCESS;
- char buf[PREFIX2STR_BUFFER];
argv_p = prefix_new();
if (!bgp_debug_update_prefixes)
bgp_debug_update_prefixes = list_new();
- prefix2str(argv_p, buf, sizeof(buf));
-
if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL, argv_p)) {
vty_out(vty,
- "BGP updates debugging is already enabled for %s\n",
- buf);
+ "BGP updates debugging is already enabled for %pFX\n",
+ argv_p);
prefix_free(&argv_p);
return CMD_SUCCESS;
}
DEBUG_ON(update, UPDATE_PREFIX);
} else {
TERM_DEBUG_ON(update, UPDATE_PREFIX);
- vty_out(vty, "BGP updates debugging is on for %s\n", buf);
+ vty_out(vty, "BGP updates debugging is on for %pFX\n", argv_p);
}
prefix_free(&argv_p);
struct prefix *argv_p;
bool found_prefix = false;
int ret = CMD_SUCCESS;
- char buf[PREFIX2STR_BUFFER];
argv_p = prefix_new();
}
}
- prefix2str(argv_p, buf, sizeof(buf));
-
if (found_prefix)
- vty_out(vty, "BGP updates debugging is off for %s\n", buf);
+ vty_out(vty, "BGP updates debugging is off for %pFX\n", argv_p);
else
- vty_out(vty, "BGP updates debugging was not enabled for %s\n",
- buf);
+ vty_out(vty, "BGP updates debugging was not enabled for %pFX\n",
+ argv_p);
prefix_free(&argv_p);
char *str, int size)
{
char rd_buf[RD_ADDRSTRLEN];
- char pfx_buf[PREFIX_STRLEN];
char tag_buf[30];
/* ' with addpath ID ' 17
* max strlen of uint32 + 10
}
if (prd)
- snprintf(str, size, "RD %s %s%s%s %s %s",
- prefix_rd2str(prd, rd_buf, sizeof(rd_buf)),
- prefix2str(pu, pfx_buf, sizeof(pfx_buf)), tag_buf,
- pathid_buf, afi2str(afi), safi2str(safi));
+ snprintfrr(str, size, "RD %s %pFX%s%s %s %s",
+ prefix_rd2str(prd, rd_buf, sizeof(rd_buf)), pu.p,
+ tag_buf, pathid_buf, afi2str(afi), safi2str(safi));
else if (safi == SAFI_FLOWSPEC) {
char return_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
const struct prefix_fs *fs = pu.fs;
snprintf(str, size, "FS %s Match{%s}", afi2str(afi),
return_string);
} else
- snprintf(str, size, "%s%s%s %s %s",
- prefix2str(pu, pfx_buf, sizeof(pfx_buf)), tag_buf,
- pathid_buf, afi2str(afi), safi2str(safi));
+ snprintfrr(str, size, "%pFX%s%s %s %s", pu.p, tag_buf,
+ pathid_buf, afi2str(afi), safi2str(safi));
return str;
}
safi_t safi = SAFI_EVPN;
if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) {
- char prefix_buf[PREFIX_STRLEN];
char esi_buf[ESI_STR_LEN];
char esi_buf2[ESI_STR_LEN];
struct prefix_evpn *evp =
(struct prefix_evpn *)bgp_dest_get_prefix(dest);
- zlog_debug("local path deleted %s es %s; new-path-es %s",
- prefix2str(evp,
- prefix_buf, sizeof(prefix_buf)),
- esi_to_str(&old_local->attr->esi,
- esi_buf, sizeof(esi_buf)),
- new_select ? esi_to_str(&new_select->attr->esi,
- esi_buf2, sizeof(esi_buf2)) : "");
+ zlog_debug("local path deleted %pFX es %s; new-path-es %s", evp,
+ esi_to_str(&old_local->attr->esi, esi_buf,
+ sizeof(esi_buf)),
+ new_select ? esi_to_str(&new_select->attr->esi,
+ esi_buf2, sizeof(esi_buf2))
+ : "");
}
/* Locate route node in the global EVPN routing table. Note that
attr.nexthop = bgp_vrf->evpn_info->pip_ip;
attr.mp_nexthop_global_in = bgp_vrf->evpn_info->pip_ip;
} else if (bgp_vrf->evpn_info->pip_ip.s_addr == INADDR_ANY)
- if (bgp_debug_zebra(NULL)) {
- char buf1[PREFIX_STRLEN];
-
- zlog_debug("VRF %s evp %s advertise-pip primary ip is not configured",
- vrf_id_to_name(bgp_vrf->vrf_id),
- prefix2str(evp, buf1, sizeof(buf1)));
- }
+ if (bgp_debug_zebra(NULL))
+ zlog_debug(
+ "VRF %s evp %pFX advertise-pip primary ip is not configured",
+ vrf_id_to_name(bgp_vrf->vrf_id), evp);
}
if (bgp_debug_zebra(NULL)) {
char buf[ETHER_ADDR_STRLEN];
- char buf1[PREFIX_STRLEN];
char buf2[INET6_ADDRSTRLEN];
- zlog_debug("VRF %s type-5 route evp %s RMAC %s nexthop %s",
- vrf_id_to_name(bgp_vrf->vrf_id),
- prefix2str(evp, buf1, sizeof(buf1)),
+ zlog_debug("VRF %s type-5 route evp %pFX RMAC %s nexthop %s",
+ vrf_id_to_name(bgp_vrf->vrf_id), evp,
prefix_mac2str(&attr.rmac, buf, sizeof(buf)),
inet_ntop(AF_INET, &attr.nexthop, buf2,
INET_ADDRSTRLEN));
attr->es_flags &= ~ATTR_ES_PEER_ROUTER;
if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) {
- char prefix_buf[PREFIX_STRLEN];
char esi_buf[ESI_STR_LEN];
- zlog_debug("setup sync info for %s es %s max_seq %d %s%s%s",
- prefix2str(evp, prefix_buf,
- sizeof(prefix_buf)),
+ zlog_debug(
+ "setup sync info for %pFX es %s max_seq %d %s%s%s",
+ evp,
esi_to_str(esi, esi_buf,
- sizeof(esi_buf)),
+ sizeof(esi_buf)),
max_sync_seq,
- (attr->es_flags & ATTR_ES_PEER_ACTIVE) ?
- "peer-active " : "",
- (attr->es_flags & ATTR_ES_PEER_PROXY) ?
- "peer-proxy " : "",
- (attr->es_flags & ATTR_ES_PEER_ROUTER) ?
- "peer-router " : "");
+ (attr->es_flags & ATTR_ES_PEER_ACTIVE)
+ ? "peer-active "
+ : "",
+ (attr->es_flags & ATTR_ES_PEER_PROXY)
+ ? "peer-proxy "
+ : "",
+ (attr->es_flags & ATTR_ES_PEER_ROUTER)
+ ? "peer-router "
+ : "");
}
}
} else {
if (bgp_debug_zebra(NULL)) {
char buf[ETHER_ADDR_STRLEN];
- char buf1[PREFIX_STRLEN];
char buf3[ESI_STR_LEN];
zlog_debug(
- "VRF %s vni %u type-2 route evp %s RMAC %s nexthop %pI4 esi %s",
+ "VRF %s vni %u type-2 route evp %pFX RMAC %s nexthop %pI4 esi %s",
vpn->bgp_vrf ? vrf_id_to_name(vpn->bgp_vrf->vrf_id)
: " ",
- vpn->vni, prefix2str(p, buf1, sizeof(buf1)),
+ vpn->vni, p,
prefix_mac2str(&attr.rmac, buf, sizeof(buf)),
&attr.mp_nexthop_global_in,
esi_to_str(esi, buf3, sizeof(buf3)));
if (bgp_debug_zebra(NULL)) {
char buf[ETHER_ADDR_STRLEN];
- char buf1[PREFIX_STRLEN];
char buf3[ESI_STR_LEN];
zlog_debug(
- "VRF %s vni %u evp %s RMAC %s nexthop %pI4 esi %s esf 0x%x from %s",
+ "VRF %s vni %u evp %pFX RMAC %s nexthop %pI4 esi %s esf 0x%x from %s",
vpn->bgp_vrf ? vrf_id_to_name(vpn->bgp_vrf->vrf_id)
: " ",
- vpn->vni, prefix2str(evp, buf1, sizeof(buf1)),
+ vpn->vni, evp,
prefix_mac2str(&attr.rmac, buf, sizeof(buf)),
&attr.mp_nexthop_global_in,
esi_to_str(&attr.esi, buf3, sizeof(buf3)),
struct prefix *pp = &p;
afi_t afi = 0;
safi_t safi = 0;
- char buf[PREFIX_STRLEN];
bool new_pi = false;
memset(pp, 0, sizeof(struct prefix));
ip_prefix_from_evpn_prefix(evp, pp);
- if (bgp_debug_zebra(NULL)) {
+ if (bgp_debug_zebra(NULL))
zlog_debug(
- "vrf %s: import evpn prefix %s parent %p flags 0x%x",
- vrf_id_to_name(bgp_vrf->vrf_id),
- prefix2str(evp, buf, sizeof(buf)),
- parent_pi, parent_pi->flags);
- }
+ "vrf %s: import evpn prefix %pFX parent %p flags 0x%x",
+ vrf_id_to_name(bgp_vrf->vrf_id), evp, parent_pi,
+ parent_pi->flags);
/* Create (or fetch) route within the VRF. */
/* NOTE: There is no RD here. */
struct prefix *pp = &p;
afi_t afi = 0;
safi_t safi = 0;
- char buf[PREFIX_STRLEN];
memset(pp, 0, sizeof(struct prefix));
ip_prefix_from_evpn_prefix(evp, pp);
- if (bgp_debug_zebra(NULL)) {
+ if (bgp_debug_zebra(NULL))
zlog_debug(
- "vrf %s: unimport evpn prefix %s parent %p flags 0x%x",
- vrf_id_to_name(bgp_vrf->vrf_id),
- prefix2str(evp, buf, sizeof(buf)),
- parent_pi, parent_pi->flags);
- }
+ "vrf %s: unimport evpn prefix %pFX parent %p flags 0x%x",
+ vrf_id_to_name(bgp_vrf->vrf_id), evp, parent_pi,
+ parent_pi->flags);
/* Locate route within the VRF. */
/* NOTE: There is no RD here. */
*/
if (memcmp(&bgp_vrf->rmac, &pi->attr->rmac, ETH_ALEN) == 0) {
if (bgp_debug_update(pi->peer, NULL, NULL, 1)) {
- char buf1[PREFIX_STRLEN];
char attr_str[BUFSIZ] = {0};
bgp_dump_attr(pi->attr, attr_str, sizeof(attr_str));
- zlog_debug("%s: bgp %u prefix %s with attr %s - DENIED due to self mac",
- __func__, bgp_vrf->vrf_id,
- prefix2str(evp, buf1, sizeof(buf1)),
- attr_str);
+ zlog_debug(
+ "%s: bgp %u prefix %pFX with attr %s - DENIED due to self mac",
+ __func__, bgp_vrf->vrf_id, evp, attr_str);
}
return 1;
struct bgp_table *table;
struct bgp_path_info *pi;
int ret;
- char buf[PREFIX_STRLEN];
struct bgp *bgp_evpn = NULL;
afi = AFI_L2VPN;
if (ret) {
flog_err(
EC_BGP_EVPN_FAIL,
- "Failed to %s EVPN %s route in VRF %s",
+ "Failed to %s EVPN %pFX route in VRF %s",
install ? "install"
: "uninstall",
- prefix2str(evp, buf,
- sizeof(buf)),
+ evp,
vrf_id_to_name(
bgp_vrf->vrf_id));
return ret;
struct bgp_path_info *pi,
struct list *vrfs, int install)
{
- char buf[PREFIX2STR_BUFFER];
struct bgp *bgp_vrf;
struct listnode *node, *nnode;
if (ret) {
flog_err(EC_BGP_EVPN_FAIL,
- "%u: Failed to %s prefix %s in VRF %s",
+ "%u: Failed to %s prefix %pFX in VRF %s",
bgp_def->vrf_id,
- install ? "install" : "uninstall",
- prefix2str(evp, buf, sizeof(buf)),
+ install ? "install" : "uninstall", evp,
vrf_id_to_name(bgp_vrf->vrf_id));
return ret;
}
{
int ret = 0;
struct prefix_evpn evp;
- char buf[PREFIX_STRLEN];
build_type5_prefix_from_ip_prefix(&evp, p);
ret = delete_evpn_type5_route(bgp_vrf, &evp);
- if (ret) {
+ if (ret)
flog_err(
EC_BGP_EVPN_ROUTE_DELETE,
- "%u failed to delete type-5 route for prefix %s in vrf %s",
- bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)),
- vrf_id_to_name(bgp_vrf->vrf_id));
- }
+ "%u failed to delete type-5 route for prefix %pFX in vrf %s",
+ bgp_vrf->vrf_id, p, vrf_id_to_name(bgp_vrf->vrf_id));
}
/* withdraw all type-5 routes for an address family */
{
int ret = 0;
struct prefix_evpn evp;
- char buf[PREFIX_STRLEN];
build_type5_prefix_from_ip_prefix(&evp, p);
ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr);
if (ret)
flog_err(EC_BGP_EVPN_ROUTE_CREATE,
- "%u: Failed to create type-5 route for prefix %s",
- bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)));
+ "%u: Failed to create type-5 route for prefix %pFX",
+ bgp_vrf->vrf_id, p);
}
/* Inject all prefixes of a particular address-family (currently, IPv4 or
int ret;
afi_t afi;
safi_t safi;
- char buf[PREFIX_STRLEN];
struct bgp_dest *rd_dest, *dest;
struct bgp_table *table;
struct bgp_path_info *pi;
if (ret) {
flog_err(
- EC_BGP_EVPN_FAIL,
- "Failed to %s EVPN %s route in ESI %s",
- install ? "install"
+ EC_BGP_EVPN_FAIL,
+ "Failed to %s EVPN %pFX route in ESI %s",
+ install ? "install"
: "uninstall",
- prefix2str(evp, buf,
- sizeof(buf)),
- es->esi_str);
+ evp, es->esi_str);
return ret;
}
}
#include "zebra.h"
+#include "lib/printfrr.h"
+
#include "prefix.h"
#include "lib_errors.h"
switch (type) {
case BGP_FLOWSPEC_RETURN_STRING:
if (prefix_local.family == AF_INET6) {
- char str[BGP_FLOWSPEC_STRING_DISPLAY_MAX];
int ret;
- prefix2str(&prefix_local, str,
- BGP_FLOWSPEC_STRING_DISPLAY_MAX);
- ret = snprintf(display, BGP_FLOWSPEC_STRING_DISPLAY_MAX,
- "%s/off %u",
- str, prefix_offset);
+ ret = snprintfrr(
+ display, BGP_FLOWSPEC_STRING_DISPLAY_MAX,
+ "%pFX/off %u", &prefix_local, prefix_offset);
if (ret < 0) {
*error = -1;
break;
int command;
uint16_t flags = 0;
size_t flags_pos = 0;
- char addr[PREFIX_STRLEN];
p = bgp_dest_get_prefix(dest);
local_label = &(dest->local_label);
* always takes precedence over auto-assigned labels.
*/
if (!have_label_to_reg) {
- if (BGP_DEBUG(labelpool, LABELPOOL)) {
- prefix2str(p, addr, PREFIX_STRLEN);
- zlog_debug("%s: Requesting label from LP for %s",
- __func__, addr);
- }
+ if (BGP_DEBUG(labelpool, LABELPOOL))
+ zlog_debug(
+ "%s: Requesting label from LP for %pFX",
+ __func__, p);
+
/* bgp_reg_for_label_callback() will call back
* __func__ when it gets a label from the pool.
* This means we'll never register FECs without
return;
}
- if (debug) {
- char buf_prefix[PREFIX_STRLEN];
-
- prefix2str(p, buf_prefix, sizeof(buf_prefix));
- zlog_debug("%s: updating %s to vrf %s", __func__,
- buf_prefix, bgp_vrf->name_pretty);
- }
+ if (debug)
+ zlog_debug("%s: updating %pFX to vrf %s", __func__, p,
+ bgp_vrf->name_pretty);
/* shallow copy */
static_attr = *path_vpn->attr;
bnc->change_flags = 0;
/* debug print the input */
- if (BGP_DEBUG(nht, NHT)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&nhr->prefix, buf, sizeof(buf));
+ if (BGP_DEBUG(nht, NHT))
zlog_debug(
- "%s(%u): Rcvd NH update %s(%u) - metric %d/%d #nhops %d/%d flags 0x%x",
- bnc->bgp->name_pretty, bnc->bgp->vrf_id, buf,
+ "%s(%u): Rcvd NH update %pFX(%u) - metric %d/%d #nhops %d/%d flags 0x%x",
+ bnc->bgp->name_pretty, bnc->bgp->vrf_id, &nhr->prefix,
bnc->srte_color, nhr->metric, bnc->metric,
nhr->nexthop_num, bnc->nexthop_num, bnc->flags);
- }
if (nhr->metric != bnc->metric)
bnc->change_flags |= BGP_NEXTHOP_METRIC_CHANGED;
bnc = bnc_find(tree, &nhr.prefix, nhr.srte_color);
if (!bnc) {
- if (BGP_DEBUG(nht, NHT)) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&nhr.prefix, buf, sizeof(buf));
+ if (BGP_DEBUG(nht, NHT))
zlog_debug(
- "parse nexthop update(%s(%u)(%s)): bnc info not found",
- buf, nhr.srte_color, bgp->name_pretty);
- }
+ "parse nexthop update(%pFX(%u)(%s)): bnc info not found",
+ &nhr.prefix, nhr.srte_color, bgp->name_pretty);
return;
}
#include "jhash.h"
#include "pbr.h"
+#include "lib/printfrr.h"
+
#include "bgpd/bgpd.h"
#include "bgpd/bgp_pbr.h"
#include "bgpd/bgp_debug.h"
int i = 0;
char return_string[512];
char *ptr = return_string;
- char buff[64];
int nb_items = 0;
int delta, len = sizeof(return_string);
struct prefix *p = &(api->src_prefix);
if (api->src_prefix_offset)
- delta = snprintf(ptr, len, "@src %s/off%u",
- prefix2str(p, buff, 64),
- api->src_prefix_offset);
+ delta = snprintfrr(ptr, len, "@src %pFX/off%u", p,
+ api->src_prefix_offset);
else
- delta = snprintf(ptr, len, "@src %s",
- prefix2str(p, buff, 64));
+ delta = snprintfrr(ptr, len, "@src %pFX", p);
len -= delta;
ptr += delta;
INCREMENT_DISPLAY(ptr, nb_items, len);
INCREMENT_DISPLAY(ptr, nb_items, len);
if (api->dst_prefix_offset)
- delta = snprintf(ptr, len, "@dst %s/off%u",
- prefix2str(p, buff, 64),
- api->dst_prefix_offset);
+ delta = snprintfrr(ptr, len, "@dst %pFX/off%u", p,
+ api->dst_prefix_offset);
else
- delta = snprintf(ptr, len, "@dst %s",
- prefix2str(p, buff, 64));
+ delta = snprintfrr(ptr, len, "@dst %pFX", p);
len -= delta;
ptr += delta;
}
onlypeer = ((SUBGRP_PCOUNT(subgrp) == 1) ? (SUBGRP_PFIRST(subgrp))->peer
: NULL);
- if (BGP_DEBUG(update, UPDATE_OUT)) {
- char buf_prefix[PREFIX_STRLEN];
- prefix2str(p, buf_prefix, sizeof(buf_prefix));
- zlog_debug("%s: p=%s, selected=%p", __func__, buf_prefix,
- selected);
- }
+ if (BGP_DEBUG(update, UPDATE_OUT))
+ zlog_debug("%s: p=%pFX, selected=%p", __func__, p, selected);
/* First update is deferred until ORF or ROUTE-REFRESH is received */
if (onlypeer && CHECK_FLAG(onlypeer->af_sflags[afi][safi],
json_object_string_add(json, "network", buf2);
}
} else if (p->family == AF_ETHERNET) {
- prefix2str(p, buf, PREFIX_STRLEN);
len = vty_out(vty, "%pFX", p);
} else if (p->family == AF_EVPN) {
if (!json)
- len = vty_out(vty, "%s",
- prefix2str((struct prefix_evpn *)p, buf,
- BUFSIZ));
+ len = vty_out(vty, "%pFX", (struct prefix_evpn *)p);
else
bgp_evpn_route2json((struct prefix_evpn *)p, json);
} else if (p->family == AF_FLOWSPEC) {
{
char buf[INET6_ADDRSTRLEN];
char buf1[BUFSIZ];
- char buf2[EVPN_ROUTE_STRLEN];
struct attr *attr = path->attr;
int sockunion_vty_out(struct vty *, union sockunion *);
time_t tbuf;
if (path->extra) {
char tag_buf[30];
- buf2[0] = '\0';
tag_buf[0] = '\0';
if (path->extra && path->extra->num_labels) {
bgp_evpn_label2str(path->extra->label,
}
if (safi == SAFI_EVPN) {
if (!json_paths) {
- prefix2str((struct prefix_evpn *)
- bgp_dest_get_prefix(bn),
- buf2, sizeof(buf2));
- vty_out(vty, " Route %s", buf2);
+ vty_out(vty, " Route %pFX",
+ (struct prefix_evpn *)
+ bgp_dest_get_prefix(bn));
if (tag_buf[0] != '\0')
vty_out(vty, " VNI %s", tag_buf);
vty_out(vty, "\n");
pdest),
buf1, sizeof(buf1));
if (is_pi_family_evpn(parent_ri)) {
- prefix2str((struct prefix_evpn *)
- bgp_dest_get_prefix(
- dest),
- buf2, sizeof(buf2));
- vty_out(vty, " Imported from %s:%s, VNI %s\n", buf1, buf2, tag_buf);
+ vty_out(vty,
+ " Imported from %s:%pFX, VNI %s\n",
+ buf1,
+ (struct prefix_evpn *)
+ bgp_dest_get_prefix(
+ dest),
+ tag_buf);
} else
- vty_out(vty, " Imported from %s:%s\n", buf1, buf2);
+ vty_out(vty,
+ " Imported from %s:%pFX\n",
+ buf1,
+ (struct prefix_evpn *)
+ bgp_dest_get_prefix(
+ dest));
}
}
}
struct peer *peer;
struct listnode *node, *nnode;
char buf1[RD_ADDRSTRLEN];
- char buf3[EVPN_ROUTE_STRLEN];
char prefix_str[BUFSIZ];
int count = 0;
int best = 0;
if (safi == SAFI_EVPN) {
if (!json) {
- vty_out(vty, "BGP routing table entry for %s%s%s\n",
+ vty_out(vty, "BGP routing table entry for %s%s%pFX\n",
prd ? prefix_rd2str(prd, buf1, sizeof(buf1))
: "",
- prd ? ":" : "",
- prefix2str((struct prefix_evpn *)p, buf3,
- sizeof(buf3)));
+ prd ? ":" : "", (struct prefix_evpn *)p);
} else {
json_object_string_add(json, "rd",
prd ? prefix_rd2str(prd, buf1, sizeof(buf1)) :
as_t as_number = 0;
struct lrtr_ip_addr ip_addr_prefix;
enum pfxv_state result;
- char buf[BUFSIZ];
- const char *prefix_string;
if (!is_synchronized())
return 0;
prefix->prefixlen, &result);
// Print Debug output
- prefix_string = prefix2str(prefix, buf, sizeof(buf));
switch (result) {
case BGP_PFXV_STATE_VALID:
RPKI_DEBUG(
- "Validating Prefix %s from asn %u Result: VALID",
- prefix_string, as_number);
+ "Validating Prefix %pFX from asn %u Result: VALID",
+ prefix, as_number);
return RPKI_VALID;
case BGP_PFXV_STATE_NOT_FOUND:
RPKI_DEBUG(
- "Validating Prefix %s from asn %u Result: NOT FOUND",
- prefix_string, as_number);
+ "Validating Prefix %pFX from asn %u Result: NOT FOUND",
+ prefix, as_number);
return RPKI_NOTFOUND;
case BGP_PFXV_STATE_INVALID:
RPKI_DEBUG(
- "Validating Prefix %s from asn %u Result: INVALID",
- prefix_string, as_number);
+ "Validating Prefix %pFX from asn %u Result: INVALID",
+ prefix, as_number);
return RPKI_INVALID;
default:
RPKI_DEBUG(
- "Validating Prefix %s from asn %u Result: CANNOT VALIDATE",
- prefix_string, as_number);
+ "Validating Prefix %pFX from asn %u Result: CANNOT VALIDATE",
+ prefix, as_number);
break;
}
return 0;
/* Logging the attribute. */
if (bgp_debug_update(NULL, &p, subgrp->update_group, 0)) {
char attrstr[BUFSIZ];
- char buf[PREFIX_STRLEN];
/* ' with addpath ID ' 17
* max strlen of uint32 + 10
* +/- (just in case) + 1
else
tx_id_buf[0] = '\0';
- zlog_debug("u%" PRIu64 ":s%" PRIu64 " send UPDATE %s%s %s",
- (SUBGRP_UPDGRP(subgrp))->id, subgrp->id,
- prefix2str(&p, buf, sizeof(buf)), tx_id_buf,
- attrstr);
+ zlog_debug("u%" PRIu64 ":s%" PRIu64 " send UPDATE %pFX%s %s",
+ (SUBGRP_UPDGRP(subgrp))->id, subgrp->id, &p,
+ tx_id_buf, attrstr);
}
s = stream_new(BGP_MAX_PACKET_SIZE);
p.prefixlen = 0;
if (bgp_debug_update(NULL, &p, subgrp->update_group, 0)) {
- char buf[PREFIX_STRLEN];
/* ' with addpath ID ' 17
* max strlen of uint32 + 10
* +/- (just in case) + 1
" with addpath ID %u",
BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE);
- zlog_debug("u%" PRIu64 ":s%" PRIu64" send UPDATE %s%s -- unreachable",
- (SUBGRP_UPDGRP(subgrp))->id, subgrp->id,
- prefix2str(&p, buf, sizeof(buf)), tx_id_buf);
+ zlog_debug("u%" PRIu64 ":s%" PRIu64
+ " send UPDATE %pFX%s -- unreachable",
+ (SUBGRP_UPDGRP(subgrp))->id, subgrp->id, &p,
+ tx_id_buf);
}
s = stream_new(BGP_MAX_PACKET_SIZE);
struct listnode *node, *nnode, *rnode, *nrnode;
struct prefix *range;
afi_t afi;
- char buf[PREFIX2STR_BUFFER];
if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT)
vty_out(vty, " bgp listen limit %d\n",
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
for (ALL_LIST_ELEMENTS(group->listen_range[afi], rnode,
nrnode, range)) {
- prefix2str(range, buf, sizeof(buf));
vty_out(vty,
- " bgp listen range %s peer-group %s\n",
- buf, group->name);
+ " bgp listen range %pFX peer-group %s\n",
+ range, group->name);
}
}
}
struct prefix *range;
struct peer *conf;
struct peer *peer;
- char buf[PREFIX2STR_BUFFER];
afi_t afi;
safi_t safi;
const char *peer_status;
for (ALL_LIST_ELEMENTS(group->listen_range[afi], node,
- nnode, range)) {
- prefix2str(range, buf, sizeof(buf));
- vty_out(vty, " %s\n", buf);
- }
+ nnode, range))
+ vty_out(vty, " %pFX\n", range);
}
}
zebra_router_id_update_read(zclient->ibuf, &router_id);
- if (BGP_DEBUG(zebra, ZEBRA)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&router_id, buf, sizeof(buf));
- zlog_debug("Rx Router Id update VRF %u Id %s", vrf_id, buf);
- }
+ if (BGP_DEBUG(zebra, ZEBRA))
+ zlog_debug("Rx Router Id update VRF %u Id %pFX", vrf_id,
+ &router_id);
bgp_router_id_zebra_bump(vrf_id, &router_id);
return 0;
if (ifc == NULL)
return 0;
- if (bgp_debug_zebra(ifc->address)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(ifc->address, buf, sizeof(buf));
- zlog_debug("Rx Intf address add VRF %u IF %s addr %s", vrf_id,
- ifc->ifp->name, buf);
- }
+ if (bgp_debug_zebra(ifc->address))
+ zlog_debug("Rx Intf address add VRF %u IF %s addr %pFX", vrf_id,
+ ifc->ifp->name, ifc->address);
if (!bgp)
return 0;
if (ifc == NULL)
return 0;
- if (bgp_debug_zebra(ifc->address)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(ifc->address, buf, sizeof(buf));
- zlog_debug("Rx Intf address del VRF %u IF %s addr %s", vrf_id,
- ifc->ifp->name, buf);
- }
+ if (bgp_debug_zebra(ifc->address))
+ zlog_debug("Rx Intf address del VRF %u IF %s addr %pFX", vrf_id,
+ ifc->ifp->name, ifc->address);
if (bgp && if_is_operative(ifc->ifp)) {
bgp_connected_delete(bgp, ifc);
if (ifc == NULL)
return 0;
- if (bgp_debug_zebra(ifc->address)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(ifc->address, buf, sizeof(buf));
- zlog_debug("Rx Intf neighbor add VRF %u IF %s addr %s", vrf_id,
- ifc->ifp->name, buf);
- }
+ if (bgp_debug_zebra(ifc->address))
+ zlog_debug("Rx Intf neighbor add VRF %u IF %s addr %pFX",
+ vrf_id, ifc->ifp->name, ifc->address);
if (if_is_operative(ifc->ifp)) {
bgp = bgp_lookup_by_vrf_id(vrf_id);
if (ifc == NULL)
return 0;
- if (bgp_debug_zebra(ifc->address)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(ifc->address, buf, sizeof(buf));
- zlog_debug("Rx Intf neighbor del VRF %u IF %s addr %s", vrf_id,
- ifc->ifp->name, buf);
- }
+ if (bgp_debug_zebra(ifc->address))
+ zlog_debug("Rx Intf neighbor del VRF %u IF %s addr %pFX",
+ vrf_id, ifc->ifp->name, ifc->address);
if (if_is_operative(ifc->ifp)) {
bgp = bgp_lookup_by_vrf_id(vrf_id);
}
if (bgp_debug_zebra(&api.prefix)) {
- char buf[2][PREFIX_STRLEN];
+ char buf[PREFIX_STRLEN];
- prefix2str(&api.prefix, buf[0], sizeof(buf[0]));
if (add) {
- inet_ntop(api.prefix.family, &nexthop, buf[1],
- sizeof(buf[1]));
+ inet_ntop(api.prefix.family, &nexthop, buf,
+ sizeof(buf));
zlog_debug(
- "Rx route ADD VRF %u %s[%d] %s nexthop %s (type %d if %u) metric %u tag %" ROUTE_TAG_PRI,
+ "Rx route ADD VRF %u %s[%d] %pFX nexthop %s (type %d if %u) metric %u tag %" ROUTE_TAG_PRI,
vrf_id, zebra_route_string(api.type),
- api.instance, buf[0], buf[1], nhtype,
- ifindex, api.metric, api.tag);
+ api.instance, &api.prefix, buf, nhtype, ifindex,
+ api.metric, api.tag);
} else {
- zlog_debug(
- "Rx route DEL VRF %u %s[%d] %s",
- vrf_id, zebra_route_string(api.type),
- api.instance, buf[0]);
+ zlog_debug("Rx route DEL VRF %u %s[%d] %s", vrf_id,
+ zebra_route_string(api.type), api.instance,
+ buf);
}
}
}
if (bgp_debug_zebra(p)) {
- char prefix_buf[PREFIX_STRLEN];
char nh_buf[INET6_ADDRSTRLEN];
char eth_buf[ETHER_ADDR_STRLEN + 7] = {'\0'};
char buf1[ETHER_ADDR_STRLEN];
char label_buf[20];
int i;
- prefix2str(&api.prefix, prefix_buf, sizeof(prefix_buf));
- zlog_debug("Tx route %s VRF %u %s metric %u tag %" ROUTE_TAG_PRI
- " count %d",
- valid_nh_count ? "add" : "delete", bgp->vrf_id,
- prefix_buf, api.metric, api.tag, api.nexthop_num);
+ zlog_debug(
+ "Tx route %s VRF %u %pFX metric %u tag %" ROUTE_TAG_PRI
+ " count %d",
+ valid_nh_count ? "add" : "delete", bgp->vrf_id,
+ &api.prefix, api.metric, api.tag, api.nexthop_num);
for (i = 0; i < api.nexthop_num; i++) {
api_nh = &api.nexthops[i];
if (is_route_parent_evpn(info))
SET_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE);
- if (bgp_debug_zebra(p)) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf, sizeof(buf));
- zlog_debug("Tx route delete VRF %u %s", bgp->vrf_id, buf);
- }
+ if (bgp_debug_zebra(p))
+ zlog_debug("Tx route delete VRF %u %pFX", bgp->vrf_id,
+ &api.prefix);
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
}
struct stream *s = NULL;
struct bgp *bgp_vrf = NULL;
struct prefix p;
- char buf[PREFIX_STRLEN];
memset(&p, 0, sizeof(struct prefix));
s = zclient->ibuf;
return;
if (BGP_DEBUG(zebra, ZEBRA))
- zlog_debug("Recv prefix %s %s on vrf %s",
- prefix2str(&p, buf, sizeof(buf)),
+ zlog_debug("Recv prefix %pFX %s on vrf %s", &p,
(cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) ? "ADD" : "DEL",
vrf_id_to_name(vrf_id));
struct listnode *node, *nnode;
struct peer *peer;
afi_t afi;
- char buf[PREFIX2STR_BUFFER];
afi = family2afi(range->family);
if (!prefix)
return BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_NOT_FOUND;
- prefix2str(prefix, buf, sizeof(buf));
-
/* Dispose off any dynamic neighbors that exist due to this listen range
*/
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, peer)) {
if (prefix_match(prefix, &prefix2)) {
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "Deleting dynamic neighbor %s group %s upon delete of listen range %s",
- peer->host, group->name, buf);
+ "Deleting dynamic neighbor %s group %s upon delete of listen range %pFX",
+ peer->host, group->name, prefix);
peer_delete(peer);
}
}
struct prefix *listen_range;
int dncount;
char buf[PREFIX2STR_BUFFER];
- char buf1[PREFIX2STR_BUFFER];
sockunion2hostprefix(su, &prefix);
return NULL;
prefix2str(&prefix, buf, sizeof(buf));
- prefix2str(listen_range, buf1, sizeof(buf1));
if (bgp_debug_neighbor_events(NULL))
zlog_debug(
- "Dynamic Neighbor %s matches group %s listen range %s",
- buf, group->name, buf1);
+ "Dynamic Neighbor %s matches group %s listen range %pFX",
+ buf, group->name, listen_range);
/* Are we within the listen limit? */
dncount = gbgp->dynamic_neighbors_count;
#ifdef BGP_VNC_DEBUG_MATCH_GROUP
{
- char buf[PREFIX_STRLEN];
-
- prefix2str(vn, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s: vn prefix: %s", __func__, buf);
-
- prefix2str(un, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s: un prefix: %s", __func__, buf);
-
+ vnc_zlog_debug_verbose("%s: vn prefix: %pFX", __func__, vn);
+ vnc_zlog_debug_verbose("%s: un prefix: %pFX", __func__, un);
vnc_zlog_debug_verbose(
"%s: rn_vn=%p, rn_un=%p, rfg_vn=%p, rfg_un=%p",
__func__, rn_vn, rn_un, rfg_vn, rfg_un);
++write;
vty_out(vty, " vnc nve-group %s\n", rfg->name);
- if (rfg->vn_prefix.family && rfg->vn_node) {
- char buf[PREFIX_STRLEN];
+ if (rfg->vn_prefix.family && rfg->vn_node)
+ vty_out(vty, " prefix %s %pFX\n", "vn",
+ &rfg->vn_prefix);
- prefix2str(&rfg->vn_prefix, buf,
- sizeof(buf));
- vty_out(vty, " prefix %s %s\n", "vn",
- buf);
- }
-
- if (rfg->un_prefix.family && rfg->un_node) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(&rfg->un_prefix, buf,
- sizeof(buf));
- vty_out(vty, " prefix %s %s\n", "un",
- buf);
- }
+ if (rfg->un_prefix.family && rfg->un_node)
+ vty_out(vty, " prefix %s %pFX\n", "un",
+ &rfg->un_prefix);
if (rfg->rd.prefixlen) {
afi_t afi; /* of the VN address */
struct bgp_dest *bn;
struct bgp_path_info *bpi;
- char buf[PREFIX_STRLEN];
char buf2[RD_ADDRSTRLEN];
struct prefix_rd prd0;
- prefix2str(p, buf, sizeof(buf));
-
afi = family2afi(p->family);
assert(afi == AFI_IP || afi == AFI_IP6);
bn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd);
vnc_zlog_debug_verbose(
- "%s: peer=%p, prefix=%s, prd=%s afi=%d, safi=%d bn=%p, bn->info=%p",
- __func__, peer, buf, prefix_rd2str(prd, buf2, sizeof(buf2)),
- afi, safi, bn, (bn ? bgp_dest_get_bgp_path_info(bn) : NULL));
+ "%s: peer=%p, prefix=%pFX, prd=%s afi=%d, safi=%d bn=%p, bn->info=%p",
+ __func__, peer, p, prefix_rd2str(prd, buf2, sizeof(buf2)), afi,
+ safi, bn, (bn ? bgp_dest_get_bgp_path_info(bn) : NULL));
for (bpi = (bn ? bgp_dest_get_bgp_path_info(bn) : NULL); bpi;
bpi = bpi->next) {
* no local nexthops
*/
vnc_zlog_debug_verbose(
- "%s: lnh list already empty at prefix %s",
- __func__, buf);
+ "%s: lnh list already empty at prefix %pFX",
+ __func__, p);
goto done;
}
* list->del on data */
rfapi_nexthop_free(pLnh);
} else {
- vnc_zlog_debug_verbose("%s: desired lnh not found %s",
- __func__, buf);
+ vnc_zlog_debug_verbose("%s: desired lnh not found %pFX",
+ __func__, p);
}
goto done;
}
rfapiProcessWithdraw(peer, rfd, p, prd, NULL, afi, safi, type, kill);
if (bpi) {
- prefix2str(p, buf, sizeof(buf));
vnc_zlog_debug_verbose(
- "%s: Found route (safi=%d) to delete at prefix %s",
- __func__, safi, buf);
+ "%s: Found route (safi=%d) to delete at prefix %pFX",
+ __func__, safi, p);
if (safi == SAFI_MPLS_VPN) {
struct bgp_dest *pdest = NULL;
bgp_process(bgp, bn, afi, safi);
} else {
vnc_zlog_debug_verbose(
- "%s: Couldn't find route (safi=%d) at prefix %s",
- __func__, safi, buf);
+ "%s: Couldn't find route (safi=%d) at prefix %pFX",
+ __func__, safi, p);
}
done:
bgp_dest_unlock_node(bn);
}
{
- char buf[PREFIX_STRLEN];
char *s;
- prefix2str(&p, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s(rfd=%p, target=%s, ppNextHop=%p)",
- __func__, rfd, buf, ppNextHopEntry);
+ vnc_zlog_debug_verbose("%s(rfd=%p, target=%pFX, ppNextHop=%p)",
+ __func__, rfd, &p, ppNextHopEntry);
s = ecommunity_ecom2str(rfd->import_table->rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
afi = family2afi(prefix->prefix.addr_family);
assert(afi);
-
- {
- char buf[PREFIX_STRLEN];
-
- prefix2str(&p, buf, sizeof(buf));
- vnc_zlog_debug_verbose(
- "%s(rfd=%p, pfx=%s, lifetime=%d, opts_un=%p, opts_vn=%p, action=%s)",
- __func__, rfd, buf, lifetime, options_un, options_vn,
- action_str);
- }
+ vnc_zlog_debug_verbose(
+ "%s(rfd=%p, pfx=%pFX, lifetime=%d, opts_un=%p, opts_vn=%p, action=%s)",
+ __func__, rfd, &p, lifetime, options_un, options_vn,
+ action_str);
/*
* These tests come after the prefix conversion so that we can
#ifdef DEBUG_MONITOR_MOVE_SHORTER
{
- char buf[PREFIX_STRLEN];
-
- prefix2str(&original_vpn_node->p, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s: called with node pfx=%s", __func__,
- buf);
+ vnc_zlog_debug_verbose("%s: called with node pfx=%pFX",
+ __func__, &original_vpn_node->p);
}
#endif
#ifdef DEBUG_MONITOR_MOVE_SHORTER
{
- char buf[PREFIX_STRLEN];
-
- prefix2str(&par->p, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s: moved to node pfx=%s", __func__,
- buf);
+ vnc_zlog_debug_verbose("%s: moved to node pfx=%pFX", __func__,
+ &par->p);
}
#endif
}
if (!skiplist_search(seen_nexthops, &pfx_vn, NULL)) {
#ifdef DEBUG_RETURNED_NHL
- char buf[PREFIX_STRLEN];
-
- prefix2str(&pfx_vn, buf, sizeof(buf));
vnc_zlog_debug_verbose(
- "%s: already put VN/nexthop %s, skip", __func__,
- buf);
+ "%s: already put VN/nexthop %pFX, skip",
+ __func__, &pfx_vn);
#endif
continue;
}
rfapiCopyUnEncap2VPN(ern->info, info_new);
agg_unlock_node(ern); /* undo lock in route_note_match */
} else {
- char bpf[PREFIX_STRLEN];
-
- prefix2str(&vn_prefix, bpf, sizeof(bpf));
/* Not a big deal, just means VPN route got here first */
- vnc_zlog_debug_verbose("%s: no encap route for vn addr %s",
- __func__, bpf);
+ vnc_zlog_debug_verbose("%s: no encap route for vn addr %pFX",
+ __func__, &vn_prefix);
info_new->extra->vnc.import.un_family = 0;
}
struct bgp_path_info *next;
const struct prefix *rn_p = agg_node_get_prefix(rn);
- if (p && VNC_DEBUG(IMPORT_DEL_REMOTE)) {
- char p1line[PREFIX_STRLEN];
-
- prefix2str(p, p1line, sizeof(p1line));
- vnc_zlog_debug_any("%s: want %s, have %pRN",
- __func__, p1line, rn);
- }
+ if (p && VNC_DEBUG(IMPORT_DEL_REMOTE))
+ vnc_zlog_debug_any("%s: want %pFX, have %pRN",
+ __func__, p, rn);
if (p && prefix_cmp(p, rn_p))
continue;
struct bgp *bgp = bgp_get_default();
const struct prefix *p = agg_node_get_prefix(rn);
afi_t afi = family2afi(p->family);
-#if DEBUG_L2_EXTRA
- char buf_prefix[PREFIX_STRLEN];
-#endif
assert(bgp);
assert(import_table);
nves_seen = skiplist_new(0, NULL, NULL);
#if DEBUG_L2_EXTRA
- prefix2str(&it_node->p, buf_prefix, sizeof(buf_prefix));
- vnc_zlog_debug_verbose("%s: it=%p, it_node=%p, it_node->prefix=%s",
- __func__, import_table, it_node, buf_prefix);
+ vnc_zlog_debug_verbose("%s: it=%p, it_node=%p, it_node->prefix=%pFX",
+ __func__, import_table, it_node, &it_node->p);
#endif
if (AFI_L2VPN == afi) {
assert(!skiplist_insert(nves_seen,
m->rfd, NULL));
- char buf_target_pfx[PREFIX_STRLEN];
-
- prefix2str(&m->p, buf_target_pfx,
- sizeof(buf_target_pfx));
vnc_zlog_debug_verbose(
- "%s: update rfd %p attached to pfx %pRN (targ=%s)",
+ "%s: update rfd %p attached to pfx %pRN (targ=%pFX)",
__func__, m->rfd, m->node,
- buf_target_pfx);
+ &m->p);
/*
* update its RIB
rn = agg_node_get(it->imported_vpn[AFI_L2VPN], &pfx_mac_buf);
assert(rn);
-#if DEBUG_L2_EXTRA
- char buf_prefix[PREFIX_STRLEN];
-
- prefix2str(agg_node_get_prefix(rn), buf_prefix, sizeof(buf_prefix));
-#endif
-
/*
* Get sl to detach from
*/
sl = RFAPI_MONITOR_ETH(rn);
#if DEBUG_L2_EXTRA
vnc_zlog_debug_verbose(
- "%s: it=%p, rn=%p, rn->lock=%d, sl=%p, pfx=%s, LNI=%d, detaching eth mon %p",
- __func__, it, rn, rn->lock, sl, buf_prefix, mon->logical_net_id,
- mon);
+ "%s: it=%p, rn=%p, rn->lock=%d, sl=%p, pfx=%pFX, LNI=%d, detaching eth mon %p",
+ __func__, it, rn, rn->lock, sl, agg_node_get_prefix(rn),
+ mon->logical_net_id, mon);
#endif
assert(sl);
delete_list = list_new();
while (0
== skiplist_first(slRibPt, NULL, (void **)&ri)) {
-
- char buf[PREFIX_STRLEN];
- char buf2[PREFIX_STRLEN];
-
listnode_add(delete_list, ri);
vnc_zlog_debug_verbose(
"%s: after listnode_add, delete_list->count=%d",
ri->timer = NULL;
}
- prefix2str(&ri->rk.vn, buf, sizeof(buf));
- prefix2str(&ri->un, buf2, sizeof(buf2));
vnc_zlog_debug_verbose(
- "%s: put dl pfx=%pRN vn=%s un=%s cost=%d life=%d vn_options=%p",
- __func__, pn, buf, buf2, ri->cost,
- ri->lifetime, ri->vn_options);
+ "%s: put dl pfx=%pRN vn=%pFX un=%pFX cost=%d life=%d vn_options=%p",
+ __func__, pn, &ri->rk.vn, &ri->un,
+ ri->cost, ri->lifetime, ri->vn_options);
skiplist_delete_first(slRibPt);
}
afi_t afi;
uint32_t queued_flag;
int count = 0;
- char buf[PREFIX_STRLEN];
vnc_zlog_debug_verbose("%s: entry", __func__);
prefix = agg_node_get_prefix(it_node);
afi = family2afi(prefix->family);
- prefix2str(prefix, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s: prefix=%s", __func__, buf);
+ vnc_zlog_debug_verbose("%s: prefix=%pFX", __func__, prefix);
pn = agg_node_get(rfd->rib_pending[afi], prefix);
assert(pn);
#ifdef DEBUG_FTD_FILTER_RECENT
{
- char buf_pfx[PREFIX_STRLEN];
-
- prefix2str(agg_node_get_prefix(it_rn), buf_pfx,
- sizeof(buf_pfx));
- vnc_zlog_debug_verbose("%s: prefix %s", __func__, buf_pfx);
+ vnc_zlog_debug_verbose("%s: prefix %pFX", __func__,
+ agg_node_get_prefix(it_rn));
}
#endif
#if DEBUG_NHL
{
- char str_vn[PREFIX_STRLEN];
char str_aux_prefix[PREFIX_STRLEN];
- str_vn[0] = 0;
str_aux_prefix[0] = 0;
- prefix2str(&rk.vn, str_vn, sizeof(str_vn));
prefix2str(&rk.aux_prefix, str_aux_prefix,
sizeof(str_aux_prefix));
if (!rk.aux_prefix.family) {
}
vnc_zlog_debug_verbose(
- "%s: rk.vn=%s rk.aux_prefix=%s", __func__,
- str_vn,
+ "%s: rk.vn=%pFX rk.aux_prefix=%s", __func__,
+ &rk.vn,
(rk.aux_prefix.family ? str_aux_prefix : "-"));
}
vnc_zlog_debug_verbose(
if (agg_node_get_lock_count(trn) > 1)
agg_unlock_node(trn);
- {
- char str_pfx[PREFIX_STRLEN];
- char str_pfx_vn[PREFIX_STRLEN];
-
- prefix2str(&pfx, str_pfx, sizeof(str_pfx));
- prefix2str(&rk.vn, str_pfx_vn, sizeof(str_pfx_vn));
- vnc_zlog_debug_verbose(
- "%s: added pfx=%s nh[vn]=%s, cost=%u, lifetime=%u, allowed=%d",
- __func__, str_pfx, str_pfx_vn, nhp->prefix.cost,
- nhp->lifetime, allowed);
- }
+ vnc_zlog_debug_verbose(
+ "%s: added pfx=%pFX nh[vn]=%pFX, cost=%u, lifetime=%u, allowed=%d",
+ __func__, &pfx, &rk.vn, nhp->prefix.cost, nhp->lifetime,
+ allowed);
if (allowed) {
if (tail)
int rc;
afi_t afi;
struct rfapi_adb *adb;
- char buf[PREFIX_STRLEN];
vty_out(vty, "%-10p ", rfd);
rfapiPrintRfapiIpAddr(vty, &rfd->un_addr);
if (family != adb->u.s.prefix_ip.family)
continue;
- prefix2str(&adb->u.s.prefix_ip, buf, sizeof(buf));
-
- vty_out(vty, " Adv Pfx: %s%s", buf, HVTYNL);
+ vty_out(vty, " Adv Pfx: %pFX%s", &adb->u.s.prefix_ip,
+ HVTYNL);
rfapiPrintAdvertisedInfo(vty, rfd, SAFI_MPLS_VPN,
&adb->u.s.prefix_ip);
}
(void **)&adb, &cursor);
rc == 0; rc = skiplist_next(rfd->advertised.ip0_by_ether, NULL,
(void **)&adb, &cursor)) {
-
- prefix2str(&adb->u.s.prefix_eth, buf, sizeof(buf));
-
- vty_out(vty, " Adv Pfx: %s%s", buf, HVTYNL);
+ vty_out(vty, " Adv Pfx: %pFX%s", &adb->u.s.prefix_eth, HVTYNL);
/* TBD update the following function to print ethernet info */
/* Also need to pass/use rd */
break;
case RFAPI_VN_OPTION_TYPE_LOCAL_NEXTHOP:
- prefix2str(&vo->v.local_nexthop.addr,
- pbuf, sizeof(pbuf));
- fp(out, "%sLNH %s cost=%d%s", offset,
- pbuf, vo->v.local_nexthop.cost,
- HVTYNL);
+ fp(out, "%sLNH %pFX cost=%d%s", offset,
+ &vo->v.local_nexthop.addr,
+ vo->v.local_nexthop.cost, HVTYNL);
break;
default:
/* XXX uses secret knowledge of skiplist structure */
for (p = sl->header->forward[0]; p; p = p->forward[0]) {
- char kbuf[PREFIX_STRLEN];
- char hbuf[PREFIX_STRLEN];
- char ubuf[PREFIX_STRLEN];
-
pb = p->value;
- prefix2str(p->key, kbuf, sizeof(kbuf));
- prefix2str(&pb->hpfx, hbuf, sizeof(hbuf));
- prefix2str(&pb->upfx, ubuf, sizeof(ubuf));
-
vnc_zlog_debug_verbose(
- "RHN Entry %d (q=%p): kpfx=%s, upfx=%s, hpfx=%s, ubpi=%p",
- ++count, p, kbuf, ubuf, hbuf, pb->ubpi);
+ "RHN Entry %d (q=%p): kpfx=%pFX, upfx=%pFX, hpfx=%pFX, ubpi=%p",
+ ++count, p, p->key, &pb->upfx, &pb->hpfx, pb->ubpi);
}
}
#endif
* pfx */
assert(!vnc_prefix_cmp(&pb->hpfx, pkey));
if (vnc_prefix_cmp(&pb->hpfx, &pfx_orig_nexthop)) {
- char str_onh[PREFIX_STRLEN];
- char str_nve_pfx[PREFIX_STRLEN];
-
- prefix2str(&pfx_orig_nexthop, str_onh, sizeof(str_onh));
- prefix2str(&pb->hpfx, str_nve_pfx, sizeof(str_nve_pfx));
-
vnc_zlog_debug_verbose(
- "%s: %s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
- __func__, tag, str_onh, str_nve_pfx);
+ "%s: %s: FATAL: resolve_nve_nexthop list item bpi nexthop %pFX != nve pfx %pFX",
+ __func__, tag, &pfx_orig_nexthop, &pb->hpfx);
assert(0);
}
}
if (!table_rd)
return;
- {
- char str_nh[PREFIX_STRLEN];
-
- prefix2str(ubpi_nexthop, str_nh, sizeof(str_nh));
-
- vnc_zlog_debug_verbose("%s: ubpi_nexthop=%s", __func__, str_nh);
- }
+ vnc_zlog_debug_verbose("%s: ubpi_nexthop=%pFX", __func__, ubpi_nexthop);
/* exact match */
bd = bgp_node_lookup(table_rd, ubpi_nexthop);
/*debugging */
if (VNC_DEBUG(VERBOSE)) {
- char str_pfx[PREFIX_STRLEN];
char str_nh[PREFIX_STRLEN];
struct prefix nh;
- prefix2str(prefix, str_pfx, sizeof(str_pfx));
-
nh.prefixlen = 0;
rfapiUnicastNexthop2Prefix(afi, info->attr, &nh);
if (nh.prefixlen) {
}
vnc_zlog_debug_verbose(
- "%s(bgp=%p, unicast prefix=%s, unicast nh=%s)",
- __func__, bgp, str_pfx, str_nh);
+ "%s(bgp=%p, unicast prefix=%pFX, unicast nh=%s)",
+ __func__, bgp, prefix, str_nh);
}
if (info->type != ZEBRA_ROUTE_BGP) {
uint32_t local_pref;
uint32_t *med = NULL;
- {
- char buf[PREFIX_STRLEN];
-
- prefix2str(prefix, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s(prefix=%s) entry", __func__, buf);
- }
+ vnc_zlog_debug_verbose("%s(prefix=%pFX) entry", __func__, prefix);
if (!afi) {
flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of prefix",
ahr_flags |= RFAPI_AHR_NO_TUNNEL_SUBTLV;
}
- if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(vn_pfx, buf, sizeof(buf));
- vnc_zlog_debug_any("%s vn_pfx=%s", __func__, buf);
- }
+ if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE))
+ vnc_zlog_debug_any("%s vn_pfx=%pFX", __func__, vn_pfx);
/*
* Compute VN address
struct route_map *rmap = NULL;
uint32_t local_pref;
- {
- char buf[PREFIX_STRLEN];
-
- prefix2str(prefix, buf, sizeof(buf));
- vnc_zlog_debug_verbose("%s(prefix=%s) entry", __func__, buf);
- }
+ vnc_zlog_debug_verbose("%s(prefix=%pFX) entry", __func__, prefix);
assert(rfg);
vncHDBgpDirect.un_addr = pfx_un.prefix;
}
- if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(vn_pfx, buf, sizeof(buf));
- vnc_zlog_debug_any("%s vn_pfx=%s", __func__, buf);
- }
+ if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE))
+ vnc_zlog_debug_any("%s vn_pfx=%pFX", __func__, vn_pfx);
/*
* Compute VN address
if (!table_rd)
return;
- {
- char str_nh[PREFIX_STRLEN];
-
- prefix2str(ubpi_nexthop, str_nh, sizeof(str_nh));
- vnc_zlog_debug_verbose("%s: ubpi_nexthop=%s", __func__, str_nh);
- }
+ vnc_zlog_debug_verbose("%s: ubpi_nexthop=%pFX", __func__, ubpi_nexthop);
/* exact match */
memset(&pfx_unicast_nexthop, 0,
sizeof(struct prefix)); /* keep valgrind happy */
- if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) {
- char hbuf[PREFIX_STRLEN];
- char ubuf[PREFIX_STRLEN];
-
- prefix2str(&pb->hpfx, hbuf, sizeof(hbuf));
- prefix2str(&pb->upfx, ubuf, sizeof(ubuf));
-
+ if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE))
vnc_zlog_debug_any(
- "%s: examining RHN Entry (q=%p): upfx=%s, hpfx=%s, ubpi=%p",
- __func__, cursor, ubuf, hbuf, pb->ubpi);
- }
+ "%s: examining RHN Entry (q=%p): upfx=%pFX, hpfx=%pFX, ubpi=%p",
+ __func__, cursor, &pb->upfx, &pb->hpfx,
+ pb->ubpi);
if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubpi, &ecom,
&pfx_unicast_nexthop)) {
* Sanity check
*/
if (vnc_prefix_cmp(&pfx_unicast_nexthop, prefix)) {
- char str_unh[PREFIX_STRLEN];
- char str_nve_pfx[PREFIX_STRLEN];
-
- prefix2str(&pfx_unicast_nexthop, str_unh,
- sizeof(str_unh));
- prefix2str(prefix, str_nve_pfx, sizeof(str_nve_pfx));
-
vnc_zlog_debug_verbose(
- "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
- __func__, str_unh, str_nve_pfx);
+ "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %pFX != nve pfx %pFX",
+ __func__, &pfx_unicast_nexthop, prefix);
assert(0);
}
#if DEBUG_RHN_LIST
/* debug */
{
- char pbuf[PREFIX_STRLEN];
-
- prefix2str(prefix, pbuf, sizeof(pbuf));
-
vnc_zlog_debug_verbose(
- "%s: advancing past RHN Entry (q=%p): with prefix %s",
- __func__, cursor, pbuf);
+ "%s: advancing past RHN Entry (q=%p): with prefix %pFX",
+ __func__, cursor, prefix);
print_rhn_list(__func__, NULL); /* debug */
}
#endif
struct rfapi_cfg *hc = NULL;
int rc;
- {
- char str_pfx[PREFIX_STRLEN];
-
- prefix2str(prefix, str_pfx, sizeof(str_pfx));
-
- vnc_zlog_debug_verbose("%s(bgp=%p, nve prefix=%s)", __func__,
- bgp, str_pfx);
- }
+ vnc_zlog_debug_verbose("%s(bgp=%p, nve prefix=%pFX)", __func__, bgp,
+ prefix);
if (afi != AFI_IP && afi != AFI_IP6)
return;
* Sanity check
*/
if (vnc_prefix_cmp(&pfx_unicast_nexthop, prefix)) {
- char str_unh[PREFIX_STRLEN];
- char str_nve_pfx[PREFIX_STRLEN];
-
- prefix2str(&pfx_unicast_nexthop, str_unh,
- sizeof(str_unh));
- prefix2str(prefix, str_nve_pfx, sizeof(str_nve_pfx));
-
vnc_zlog_debug_verbose(
- "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
- __func__, str_unh, str_nve_pfx);
+ "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %pFX != nve pfx %pFX",
+ __func__, &pfx_unicast_nexthop, prefix);
assert(0);
}
(void **)&pfx_exterior, &cursor)) {
struct prefix pfx_nexthop;
- char buf[PREFIX_STRLEN];
afi_t afi_exterior = family2afi(pfx_exterior->family);
- prefix2str(pfx_exterior, buf, sizeof(buf));
vnc_zlog_debug_verbose(
- "%s: checking exterior orphan at prefix %s", __func__,
- buf);
+ "%s: checking exterior orphan at prefix %pFX", __func__,
+ pfx_exterior);
if (afi_exterior != afi) {
vnc_zlog_debug_verbose(
if (VNC_DEBUG(VERBOSE)) {
struct prefix pfx_nexthop;
- char buf[PREFIX_STRLEN];
- char buf_nh[PREFIX_STRLEN];
- prefix2str(prefix, buf, sizeof(buf));
rfapiUnicastNexthop2Prefix(afi, info->attr, &pfx_nexthop);
- prefix2str(&pfx_nexthop, buf_nh, sizeof(buf_nh));
-
- vnc_zlog_debug_verbose("%s: pfx %s, nh %s", __func__, buf,
- buf_nh);
+ vnc_zlog_debug_verbose("%s: pfx %pFX, nh %pFX", __func__,
+ prefix, &pfx_nexthop);
}
#if DEBUG_RHN_LIST
print_rhn_list(__func__, "ENTER ");
{
struct prefix pfx_nexthop;
- char buf[PREFIX_STRLEN];
- char buf_nh[PREFIX_STRLEN];
- prefix2str(prefix, buf, sizeof(buf));
rfapiUnicastNexthop2Prefix(afi, info->attr, &pfx_nexthop);
- prefix2str(&pfx_nexthop, buf_nh, sizeof(buf_nh));
-
- vnc_zlog_debug_verbose("%s: pfx %s, nh %s", __func__, buf,
- buf_nh);
+ vnc_zlog_debug_verbose("%s: pfx %pFX, nh %pFX", __func__,
+ prefix, &pfx_nexthop);
}
#if DEBUG_RHN_LIST
print_rhn_list(__func__, "ENTER ");
else
vnc_redistribute_delete(&api.prefix, api.type);
- if (BGP_DEBUG(zebra, ZEBRA)) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf, sizeof(buf));
+ if (BGP_DEBUG(zebra, ZEBRA))
vnc_zlog_debug_verbose(
- "%s: Zebra rcvd: route delete %s %s metric %u",
- __func__, zebra_route_string(api.type), buf,
+ "%s: Zebra rcvd: route delete %s %pFX metric %u",
+ __func__, zebra_route_string(api.type), &api.prefix,
api.metric);
- }
return 0;
}
}
}
- if (BGP_DEBUG(zebra, ZEBRA)) {
- char buf[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf, sizeof(buf));
+ if (BGP_DEBUG(zebra, ZEBRA))
vnc_zlog_debug_verbose(
- "%s: Zebra send: route %s %s, nhp_count=%d", __func__,
- (add ? "add" : "del"), buf, nhp_count);
- }
+ "%s: Zebra send: route %s %pFX, nhp_count=%d", __func__,
+ (add ? "add" : "del"), &api.prefix, nhp_count);
zclient_route_send((add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE),
zclient_vnc, &api);
void show_ip_eigrp_prefix_entry(struct vty *vty, struct eigrp_prefix_entry *tn)
{
struct list *successors = eigrp_topology_get_successor(tn);
- char buffer[PREFIX_STRLEN];
vty_out(vty, "%-3c", (tn->state > 0) ? 'A' : 'P');
- vty_out(vty, "%s, ",
- prefix2str(tn->destination, buffer, PREFIX_STRLEN));
+ vty_out(vty, "%pFX, ", tn->destination);
vty_out(vty, "%u successors, ", (successors) ? successors->count : 0);
vty_out(vty, "FD is %u, serno: %" PRIu64 " \n", tn->fdistance,
tn->serno);
* Destination must exists
*/
if (!dest) {
- char buf[PREFIX_STRLEN];
-
flog_err(
EC_EIGRP_PACKET,
- "%s: Received prefix %s which we do not know about",
- __func__,
- prefix2str(&dest_addr, buf, sizeof(buf)));
+ "%s: Received prefix %pFX which we do not know about",
+ __func__, &dest_addr);
eigrp_IPv4_InternalTLV_free(tlv);
continue;
}
rn = route_node_get(topology, pe->destination);
if (rn->info) {
- if (IS_DEBUG_EIGRP_EVENT) {
- char buf[PREFIX_STRLEN];
-
+ if (IS_DEBUG_EIGRP_EVENT)
zlog_debug(
- "%s: %s Should we have found this entry in the topo table?",
- __func__,
- prefix2str(pe->destination, buf, sizeof(buf)));
- }
+ "%s: %pFX Should we have found this entry in the topo table?",
+ __func__, pe->destination);
route_unlock_node(rn);
}
/* iterate over all prefixes which weren't advertised by neighbor */
for (ALL_LIST_ELEMENTS_RO(nbr_prefixes, node1, prefix)) {
- char buffer[PREFIX_STRLEN];
- zlog_debug(
- "GR receive: Neighbor not advertised %s",
- prefix2str(prefix->destination, buffer, PREFIX_STRLEN));
+ zlog_debug("GR receive: Neighbor not advertised %pFX",
+ prefix->destination);
fsm_msg.metrics = prefix->reported_metric;
/* set delay to MAX */
if (c == NULL)
return 0;
- if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) {
- char buf[128];
- prefix2str(c->address, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s address add %s", c->ifp->name,
- buf);
- }
+ if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: interface %s address add %pFX", c->ifp->name,
+ c->address);
eigrp_if_update(c->ifp);
if (c == NULL)
return 0;
- if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) {
- char buf[128];
- prefix2str(c->address, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s address delete %s",
- c->ifp->name, buf);
- }
+ if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: interface %s address delete %pFX",
+ c->ifp->name, c->address);
ifp = c->ifp;
ei = ifp->info;
api.nexthop_num = count;
if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[2][PREFIX_STRLEN];
- zlog_debug("Zebra: Route add %s nexthop %s",
- prefix2str(p, buf[0], PREFIX_STRLEN),
- inet_ntop(AF_INET, 0, buf[1], PREFIX_STRLEN));
+ char buf[PREFIX_STRLEN];
+ zlog_debug("Zebra: Route add %pFX nexthop %s", p,
+ inet_ntop(AF_INET, 0, buf, PREFIX_STRLEN));
}
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
memcpy(&api.prefix, p, sizeof(*p));
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
- if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX_STRLEN];
- zlog_debug("Zebra: Route del %s",
- prefix2str(p, buf, PREFIX_STRLEN));
- }
+ if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE))
+ zlog_debug("Zebra: Route del %pFX", p);
return;
}
{
struct listnode *node;
struct prefix_ipv4 *ipv4;
-#if defined(EXTREME_DEBUG)
- char buf[PREFIX2STR_BUFFER];
-#endif
struct prefix_ipv6 *ipv6;
if (connected->address->family == AF_INET) {
0);
#ifdef EXTREME_DEBUG
- prefix2str(connected->address, buf, sizeof(buf));
- zlog_debug("Added IP address %s to circuit %s", buf,
- circuit->interface->name);
+ zlog_debug("Added IP address %pFX to circuit %s",
+ connected->address, circuit->interface->name);
#endif /* EXTREME_DEBUG */
}
if (connected->address->family == AF_INET6) {
0);
#ifdef EXTREME_DEBUG
- prefix2str(connected->address, buf, sizeof(buf));
- zlog_debug("Added IPv6 address %s to circuit %s", buf,
- circuit->interface->name);
+ zlog_debug("Added IPv6 address %pFX to circuit %s",
+ connected->address, circuit->interface->name);
#endif /* EXTREME_DEBUG */
}
return;
{
struct prefix_ipv4 *ipv4, *ip = NULL;
struct listnode *node;
- char buf[PREFIX2STR_BUFFER];
struct prefix_ipv6 *ipv6, *ip6 = NULL;
int found = 0;
lsp_regenerate_schedule(circuit->area,
circuit->is_type, 0);
} else {
- prefix2str(connected->address, buf, sizeof(buf));
zlog_warn(
- "Nonexistent ip address %s removal attempt from circuit %s",
- buf, circuit->interface->name);
+ "Nonexistent ip address %pFX removal attempt from circuit %s",
+ connected->address, circuit->interface->name);
zlog_warn("Current ip addresses on %s:",
circuit->interface->name);
for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node,
ip)) {
- prefix2str(ip, buf, sizeof(buf));
- zlog_warn(" %s", buf);
+ zlog_warn(" %pFX", ip);
}
zlog_warn("End of addresses");
}
}
if (!found) {
- prefix2str(connected->address, buf, sizeof(buf));
zlog_warn(
- "Nonexistent ip address %s removal attempt from circuit %s",
- buf, circuit->interface->name);
+ "Nonexistent ip address %pFX removal attempt from circuit %s",
+ connected->address, circuit->interface->name);
zlog_warn("Current ip addresses on %s:",
circuit->interface->name);
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node,
- ip6)) {
- prefix2str((struct prefix *)ip6, (char *)buf,
- sizeof(buf));
- zlog_warn(" %s", buf);
- }
+ ip6))
+ zlog_warn(" %pFX", (struct prefix *)ip6);
zlog_warn(" -----");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node,
- ip6)) {
- prefix2str((struct prefix *)ip6, (char *)buf,
- sizeof(buf));
- zlog_warn(" %s", buf);
- }
+ ip6))
+ zlog_warn(" %pFX", (struct prefix *)ip6);
zlog_warn("End of addresses");
} else if (circuit->area)
lsp_regenerate_schedule(circuit->area, circuit->is_type,
if (detail == ISIS_UI_LEVEL_DETAIL) {
struct listnode *node;
struct prefix *ip_addr;
- char buf[BUFSIZ];
vty_out(vty, " Interface: %s", circuit->interface->name);
vty_out(vty, ", State: %s",
if (circuit->ip_addrs && listcount(circuit->ip_addrs) > 0) {
vty_out(vty, " IP Prefix(es):\n");
for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node,
- ip_addr)) {
- prefix2str(ip_addr, buf, sizeof(buf));
- vty_out(vty, " %s\n", buf);
- }
+ ip_addr))
+ vty_out(vty, " %pFX\n", ip_addr);
}
if (circuit->ipv6_link && listcount(circuit->ipv6_link) > 0) {
vty_out(vty, " IPv6 Link-Locals:\n");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node,
- ip_addr)) {
- prefix2str(ip_addr, (char *)buf, BUFSIZ);
- vty_out(vty, " %s\n", buf);
- }
+ ip_addr))
+ vty_out(vty, " %pFX\n", ip_addr);
}
if (circuit->ipv6_non_link
&& listcount(circuit->ipv6_non_link) > 0) {
vty_out(vty, " IPv6 Prefixes:\n");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node,
- ip_addr)) {
- prefix2str(ip_addr, (char *)buf, BUFSIZ);
- vty_out(vty, " %s\n", buf);
- }
+ ip_addr))
+ vty_out(vty, " %pFX\n", ip_addr);
}
vty_out(vty, "\n");
static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
{
int level = lsp->level;
- char buf[PREFIX2STR_BUFFER];
struct listnode *node;
struct isis_lsp *frag;
*/
if (area->isis->router_id != 0) {
struct in_addr id = {.s_addr = area->isis->router_id};
- inet_ntop(AF_INET, &id, buf, sizeof(buf));
- lsp_debug("ISIS (%s): Adding router ID %s as IPv4 tlv.",
- area->area_tag, buf);
+ lsp_debug("ISIS (%s): Adding router ID %pI4 as IPv4 tlv.",
+ area->area_tag, &id);
isis_tlvs_add_ipv4_address(lsp->tlvs, &id);
/* If new style TLV's are in use, add TE router ID TLV
ipv4)) {
if (area->oldmetric) {
lsp_debug(
- "ISIS (%s): Adding old-style IP reachability for %s",
- area->area_tag,
- prefix2str(ipv4, buf,
- sizeof(buf)));
+ "ISIS (%s): Adding old-style IP reachability for %pFX",
+ area->area_tag, ipv4);
isis_tlvs_add_oldstyle_ip_reach(
lsp->tlvs, ipv4, metric);
}
struct sr_prefix_cfg *pcfg = NULL;
lsp_debug(
- "ISIS (%s): Adding te-style IP reachability for %s",
- area->area_tag,
- prefix2str(ipv4, buf,
- sizeof(buf)));
+ "ISIS (%s): Adding te-style IP reachability for %pFX",
+ area->area_tag, ipv4);
if (area->srdb.enabled)
pcfg = isis_sr_cfg_prefix_find(
struct sr_prefix_cfg *pcfg = NULL;
lsp_debug(
- "ISIS (%s): Adding IPv6 reachability for %s",
- area->area_tag,
- prefix2str(ipv6, buf, sizeof(buf)));
+ "ISIS (%s): Adding IPv6 reachability for %pFX",
+ area->area_tag, ipv6);
if (area->srdb.enabled)
pcfg = isis_sr_cfg_prefix_find(area,
int level;
struct isis_redist *redist;
- char debug_buf[BUFSIZ];
- prefix2str(p, debug_buf, sizeof(debug_buf));
-
- zlog_debug("%s: New route %s from %s: distance %d.", __func__,
- debug_buf, zebra_route_string(type), distance);
+ zlog_debug("%s: New route %pFX from %s: distance %d.", __func__, p,
+ zebra_route_string(type), distance);
if (!ei_table) {
zlog_warn("%s: External information table not initialized.",
int level;
struct isis_redist *redist;
- char debug_buf[BUFSIZ];
- prefix2str(p, debug_buf, sizeof(debug_buf));
-
- zlog_debug("%s: Removing route %s from %s.", __func__, debug_buf,
+ zlog_debug("%s: Removing route %pFX from %s.", __func__, p,
zebra_route_string(type));
if (is_default_prefix(p)
ei_node = srcdest_rnode_lookup(ei_table, p, src_p);
if (!ei_node || !ei_node->info) {
- char buf[BUFSIZ];
- prefix2str(p, buf, sizeof(buf));
zlog_warn(
- "%s: Got a delete for %s route %s, but that route was never added.",
- __func__, zebra_route_string(type), buf);
+ "%s: Got a delete for %s route %pFX, but that route was never added.",
+ __func__, zebra_route_string(type), p);
if (ei_node)
route_unlock_node(ei_node);
return;
{
struct route_node *route_node;
struct isis_route_info *rinfo_new, *rinfo_old, *route_info = NULL;
- char buff[PREFIX2STR_BUFFER];
char change_buf[64];
- /* for debugs */
- prefix2str(prefix, buff, sizeof(buff));
-
if (!table)
return NULL;
rinfo_old = route_node->info;
if (!rinfo_old) {
if (IS_DEBUG_RTE_EVENTS)
- zlog_debug("ISIS-Rte (%s) route created: %s",
- area->area_tag, buff);
+ zlog_debug("ISIS-Rte (%s) route created: %pFX",
+ area->area_tag, prefix);
route_info = rinfo_new;
UNSET_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
} else {
route_unlock_node(route_node);
#ifdef EXTREME_DEBUG
if (IS_DEBUG_RTE_EVENTS)
- zlog_debug("ISIS-Rte (%s) route already exists: %s",
- area->area_tag, buff);
+ zlog_debug("ISIS-Rte (%s) route already exists: %pFX",
+ area->area_tag, prefix);
#endif /* EXTREME_DEBUG */
if (isis_route_info_same(rinfo_new, rinfo_old, change_buf,
sizeof(change_buf))) {
#ifdef EXTREME_DEBUG
if (IS_DEBUG_RTE_EVENTS)
- zlog_debug("ISIS-Rte (%s) route unchanged: %s",
- area->area_tag, buff);
+ zlog_debug(
+ "ISIS-Rte (%s) route unchanged: %pFX",
+ area->area_tag, prefix);
#endif /* EXTREME_DEBUG */
isis_route_info_delete(rinfo_new);
route_info = rinfo_old;
} else {
if (IS_DEBUG_RTE_EVENTS)
zlog_debug(
- "ISIS-Rte (%s): route changed: %s, change: %s",
- area->area_tag, buff, change_buf);
+ "ISIS-Rte (%s): route changed: %pFX, change: %s",
+ area->area_tag, prefix, change_buf);
isis_route_info_delete(rinfo_old);
route_info = rinfo_new;
UNSET_FLAG(route_info->flag,
{
struct isis_circuit *circuit;
struct connected *c;
-#ifdef EXTREME_DEBUG
- struct prefix *p;
- char buf[PREFIX2STR_BUFFER];
-#endif /* EXTREME_DEBUG */
c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_ADD,
zclient->ibuf, vrf_id);
return 0;
#ifdef EXTREME_DEBUG
- p = c->address;
- prefix2str(p, buf, sizeof(buf));
-
if (p->family == AF_INET)
- zlog_debug("connected IP address %s", buf);
+ zlog_debug("connected IP address %pFX", c->address);
if (p->family == AF_INET6)
- zlog_debug("connected IPv6 address %s", buf);
+ zlog_debug("connected IPv6 address %pFX", c->address);
#endif /* EXTREME_DEBUG */
if (if_is_operative(c->ifp)) {
{
struct isis_circuit *circuit;
struct connected *c;
-#ifdef EXTREME_DEBUG
- struct prefix *p;
- char buf[PREFIX2STR_BUFFER];
-#endif /* EXTREME_DEBUG */
c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_DELETE,
zclient->ibuf, vrf_id);
return 0;
#ifdef EXTREME_DEBUG
- p = c->address;
- prefix2str(p, buf, sizeof(buf));
-
if (p->family == AF_INET)
- zlog_debug("disconnected IP address %s", buf);
+ zlog_debug("disconnected IP address %pFX", c->address);
if (p->family == AF_INET6)
- zlog_debug("disconnected IPv6 address %s", buf);
+ zlog_debug("disconnected IPv6 address %pFX", c->address);
#endif /* EXTREME_DEBUG */
if (if_is_operative(c->ifp)) {
route_map_result_t ret = RMAP_PERMITMATCH;
struct route_map_index *index = NULL;
struct route_map_rule *set = NULL;
- char buf[PREFIX_STRLEN];
bool skip_match_clause = false;
if (recursion > RMAP_RECURSION_LIMIT) {
if (index) {
if (rmap_debug)
zlog_debug(
- "Best match route-map: %s, sequence: %d for pfx: %s, result: %s",
- map->name, index->pref,
- prefix2str(prefix, buf, sizeof(buf)),
+ "Best match route-map: %s, sequence: %d for pfx: %pFX, result: %s",
+ map->name, index->pref, prefix,
route_map_cmd_result_str(match_ret));
} else {
if (rmap_debug)
zlog_debug(
- "No best match sequence for pfx: %s in route-map: %s, result: %s",
- prefix2str(prefix, buf, sizeof(buf)),
- map->name,
+ "No best match sequence for pfx: %pFX in route-map: %s, result: %s",
+ prefix, map->name,
route_map_cmd_result_str(match_ret));
/*
* No index matches this prefix. Return deny unless,
prefix, type, object);
if (rmap_debug) {
zlog_debug(
- "Route-map: %s, sequence: %d, prefix: %s, result: %s",
- map->name, index->pref,
- prefix2str(prefix, buf, sizeof(buf)),
+ "Route-map: %s, sequence: %d, prefix: %pFX, result: %s",
+ map->name, index->pref, prefix,
route_map_cmd_result_str(match_ret));
}
} else
}
route_map_apply_end:
- if (rmap_debug) {
- zlog_debug("Route-map: %s, prefix: %s, result: %s",
- (map ? map->name : "null"),
- prefix2str(prefix, buf, sizeof(buf)),
+ if (rmap_debug)
+ zlog_debug("Route-map: %s, prefix: %pFX, result: %s",
+ (map ? map->name : "null"), prefix,
route_map_result_str(ret));
- }
return (ret);
}
if (CHECK_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP)) {
/* limit the number of nexthops if necessary */
if (api->nexthop_num > MULTIPATH_NUM) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&api->prefix, buf, sizeof(buf));
flog_err(
EC_LIB_ZAPI_ENCODE,
- "%s: prefix %s: can't encode %u nexthops (maximum is %u)",
- __func__, buf, api->nexthop_num, MULTIPATH_NUM);
+ "%s: prefix %pFX: can't encode %u nexthops (maximum is %u)",
+ __func__, &api->prefix, api->nexthop_num,
+ MULTIPATH_NUM);
return -1;
}
/* MPLS labels for BGP-LU or Segment Routing */
if (api_nh->label_num > MPLS_MAX_LABELS) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&api->prefix, buf, sizeof(buf));
-
- flog_err(EC_LIB_ZAPI_ENCODE,
- "%s: prefix %s: can't encode %u labels (maximum is %u)",
- __func__, buf,
- api_nh->label_num,
- MPLS_MAX_LABELS);
+ flog_err(
+ EC_LIB_ZAPI_ENCODE,
+ "%s: prefix %pFX: can't encode %u labels (maximum is %u)",
+ __func__, &api->prefix,
+ api_nh->label_num, MPLS_MAX_LABELS);
return -1;
}
if (CHECK_FLAG(api->message, ZAPI_MESSAGE_BACKUP_NEXTHOPS)) {
/* limit the number of nexthops if necessary */
if (api->backup_nexthop_num > MULTIPATH_NUM) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&api->prefix, buf, sizeof(buf));
flog_err(
EC_LIB_ZAPI_ENCODE,
- "%s: prefix %s: can't encode %u backup nexthops (maximum is %u)",
- __func__, buf, api->backup_nexthop_num,
+ "%s: prefix %pFX: can't encode %u backup nexthops (maximum is %u)",
+ __func__, &api->prefix, api->backup_nexthop_num,
MULTIPATH_NUM);
return -1;
}
/* MPLS labels for BGP-LU or Segment Routing */
if (api_nh->label_num > MPLS_MAX_LABELS) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&api->prefix, buf, sizeof(buf));
-
- flog_err(EC_LIB_ZAPI_ENCODE,
- "%s: prefix %s: backup: can't encode %u labels (maximum is %u)",
- __func__, buf,
- api_nh->label_num,
- MPLS_MAX_LABELS);
+ flog_err(
+ EC_LIB_ZAPI_ENCODE,
+ "%s: prefix %pFX: backup: can't encode %u labels (maximum is %u)",
+ __func__, &api->prefix,
+ api_nh->label_num, MPLS_MAX_LABELS);
return -1;
}
else if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) {
/* carp interfaces on OpenBSD with 0.0.0.0/0 as
* "peer" */
- char buf[PREFIX_STRLEN];
flog_err(
EC_LIB_ZAPI_ENCODE,
- "warning: interface %s address %s with peer flag set, but no peer address!",
- ifp->name,
- prefix2str(ifc->address, buf,
- sizeof(buf)));
+ "warning: interface %s address %pFX with peer flag set, but no peer address!",
+ ifp->name, ifc->address);
UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
}
}
/* On NHRP interfaces a host prefix is required */
if (best && if_ad->configured
&& best->address->prefixlen != 8 * prefix_blen(best->address)) {
- zlog_notice("%s: %s is not a host prefix", ifp->name,
- prefix2str(best->address, buf, sizeof(buf)));
+ zlog_notice("%s: %pFX is not a host prefix", ifp->name,
+ best->address);
best = NULL;
}
int nhrp_interface_address_add(ZAPI_CALLBACK_ARGS)
{
struct connected *ifc;
- char buf[PREFIX_STRLEN];
ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (ifc == NULL)
return 0;
- debugf(NHRP_DEBUG_IF, "if-addr-add: %s: %s", ifc->ifp->name,
- prefix2str(ifc->address, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_IF, "if-addr-add: %s: %pFX", ifc->ifp->name,
+ ifc->address);
nhrp_interface_update_address(
ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0);
int nhrp_interface_address_delete(ZAPI_CALLBACK_ARGS)
{
struct connected *ifc;
- char buf[PREFIX_STRLEN];
ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (ifc == NULL)
return 0;
- debugf(NHRP_DEBUG_IF, "if-addr-del: %s: %s", ifc->ifp->name,
- prefix2str(ifc->address, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_IF, "if-addr-del: %s: %pFX", ifc->ifp->name,
+ ifc->address);
nhrp_interface_update_address(
ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0);
}
if (unlikely(debug_flags & NHRP_DEBUG_ROUTE)) {
- char buf[2][PREFIX_STRLEN];
+ char buf[PREFIX_STRLEN];
- prefix2str(&api.prefix, buf[0], sizeof(buf[0]));
zlog_debug(
- "Zebra send: route %s %s nexthop %s metric %u count %d dev %s",
- add ? "add" : "del", buf[0],
+ "Zebra send: route %s %pFX nexthop %s metric %u count %d dev %s",
+ add ? "add" : "del", &api.prefix,
nexthop ? inet_ntop(api.prefix.family, &api_nh->gate,
- buf[1], sizeof(buf[1]))
+ buf, sizeof(buf))
: "<onlink>",
api.metric, api.nexthop_num, ifp ? ifp->name : "none");
}
struct zapi_nexthop *api_nh;
struct interface *ifp = NULL;
union sockunion nexthop_addr;
- char buf[2][PREFIX_STRLEN];
+ char buf[PREFIX_STRLEN];
int added;
if (zapi_route_decode(zclient->ibuf, &api) < 0)
}
added = (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD);
- debugf(NHRP_DEBUG_ROUTE, "if-route-%s: %s via %s dev %s",
- added ? "add" : "del",
- prefix2str(&api.prefix, buf[0], sizeof(buf[0])),
- sockunion2str(&nexthop_addr, buf[1], sizeof(buf[1])),
+ debugf(NHRP_DEBUG_ROUTE, "if-route-%s: %pFX via %s dev %s",
+ added ? "add" : "del", &api.prefix,
+ sockunion2str(&nexthop_addr, buf, sizeof(buf)),
ifp ? ifp->name : "(none)");
nhrp_route_update_zebra(&api.prefix, &nexthop_addr, ifp);
struct route_info *ri;
struct prefix lookup;
afi_t afi = family2afi(sockunion_family(addr));
- char buf[PREFIX_STRLEN];
sockunion2hostprefix(addr, &lookup);
ri = rn->info;
if (ri->nhrp_ifp) {
- debugf(NHRP_DEBUG_ROUTE, "lookup %s: nhrp_if=%s",
- prefix2str(&lookup, buf, sizeof(buf)),
+ debugf(NHRP_DEBUG_ROUTE, "lookup %pFX: nhrp_if=%s", &lookup,
ri->nhrp_ifp->name);
if (via)
if (ifp)
*ifp = ri->nhrp_ifp;
} else {
- debugf(NHRP_DEBUG_ROUTE, "lookup %s: zebra route dev %s",
- prefix2str(&lookup, buf, sizeof(buf)),
- ri->ifp ? ri->ifp->name : "(none)");
+ debugf(NHRP_DEBUG_ROUTE, "lookup %pFX: zebra route dev %s",
+ &lookup, ri->ifp ? ri->ifp->name : "(none)");
if (via)
*via = ri->via;
static void nhrp_shortcut_check_use(struct nhrp_shortcut *s)
{
- char buf[PREFIX_STRLEN];
-
if (s->expiring && s->cache && s->cache->used) {
- debugf(NHRP_DEBUG_ROUTE, "Shortcut %s used and expiring",
- prefix2str(s->p, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX used and expiring",
+ s->p);
nhrp_shortcut_send_resolution_req(s);
}
}
static void nhrp_shortcut_cache_notify(struct notifier_block *n,
unsigned long cmd)
{
- char buf[PREFIX_STRLEN];
-
struct nhrp_shortcut *s =
container_of(n, struct nhrp_shortcut, cache_notifier);
case NOTIFY_CACHE_UP:
if (!s->route_installed) {
debugf(NHRP_DEBUG_ROUTE,
- "Shortcut: route install %s nh (unspec) dev %s",
- prefix2str(s->p, buf, sizeof(buf)),
- s->cache->ifp->name);
+ "Shortcut: route install %pFX nh (unspec) dev %s",
+ s->p, s->cache->ifp->name);
nhrp_route_announce(1, s->type, s->p, s->cache->ifp,
NULL, 0);
{
struct route_node *rn;
afi_t afi = family2afi(PREFIX_FAMILY(s->p));
- char buf[PREFIX_STRLEN];
THREAD_OFF(s->t_timer);
nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid);
- debugf(NHRP_DEBUG_ROUTE, "Shortcut %s purged",
- prefix2str(s->p, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX purged", s->p);
nhrp_shortcut_update_binding(s, NHRP_CACHE_INVALID, NULL, 0);
{
struct nhrp_shortcut *s;
struct route_node *rn;
- char buf[PREFIX_STRLEN];
afi_t afi = family2afi(PREFIX_FAMILY(p));
if (!shortcut_rib[afi])
s->type = NHRP_CACHE_INVALID;
s->p = &rn->p;
- debugf(NHRP_DEBUG_ROUTE, "Shortcut %s created",
- prefix2str(s->p, buf, sizeof(buf)));
+ debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX created", s->p);
} else {
s = rn->info;
route_unlock_node(rn);
union sockunion *proto, cie_proto, *nbma, cie_nbma, nat_nbma;
struct prefix prefix, route_prefix;
struct zbuf extpl;
- char bufp[PREFIX_STRLEN], buf[4][SU_ADDRSTRLEN];
+ char buf[4][SU_ADDRSTRLEN];
int holding_time = pp->if_ad->holdtime;
nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid);
}
debugf(NHRP_DEBUG_COMMON,
- "Shortcut: %s is at proto %s dst_proto %s cie-nbma %s nat-nbma %s cie-holdtime %d",
- prefix2str(&prefix, bufp, sizeof(bufp)),
- sockunion2str(proto, buf[0], sizeof(buf[0])),
+ "Shortcut: %pFX is at proto %s dst_proto %s cie-nbma %s nat-nbma %s cie-holdtime %d",
+ &prefix, sockunion2str(proto, buf[0], sizeof(buf[0])),
sockunion2str(&pp->dst_proto, buf[1], sizeof(buf[1])),
sockunion2str(&cie_nbma, buf[2], sizeof(buf[2])),
sockunion2str(&nat_nbma, buf[3], sizeof(buf[3])),
struct ospf6_inter_router_lsa *router_lsa;
struct ospf6_route_table *summary_table = NULL;
uint16_t type;
- char buf[PREFIX2STR_BUFFER];
int is_debug = 0;
/* Only destination type network, range or ASBR are considered */
if (route->type == OSPF6_DEST_TYPE_ROUTER) {
if (ADV_ROUTER_IN_PREFIX(&route->prefix)
== area->ospf6->router_id) {
- inet_ntop(AF_INET,
- &(ADV_ROUTER_IN_PREFIX(&route->prefix)), buf,
- sizeof(buf));
zlog_debug(
- "%s: Skipping ASBR announcement for ABR (%s)",
- __func__, buf);
+ "%s: Skipping ASBR announcement for ABR (%pFX)",
+ __func__,
+ &ADV_ROUTER_IN_PREFIX(&route->prefix));
return 0;
}
}
if (IS_OSPF6_DEBUG_ABR
|| IS_OSPF6_DEBUG_ORIGINATE(INTER_ROUTER)) {
is_debug++;
- inet_ntop(AF_INET,
- &(ADV_ROUTER_IN_PREFIX(&route->prefix)), buf,
- sizeof(buf));
- zlog_debug("Originating summary in area %s for ASBR %s",
- area->name, buf);
+ zlog_debug(
+ "Originating summary in area %s for ASBR %pFX",
+ area->name,
+ &ADV_ROUTER_IN_PREFIX(&route->prefix));
}
summary_table = area->summary_router;
} else {
route->path.origin.type ==
htons(OSPF6_LSTYPE_INTER_PREFIX)) {
if (!CHECK_FLAG(route->flag, OSPF6_ROUTE_BEST)) {
- if (is_debug) {
- inet_ntop(AF_INET,
- &(ADV_ROUTER_IN_PREFIX(
- &route->prefix)), buf,
- sizeof(buf));
+ if (is_debug)
zlog_debug(
- "%s: route %s with cost %u is not best, ignore.",
- __func__, buf,
+ "%s: route %pFX with cost %u is not best, ignore.",
+ __func__,
+ &ADV_ROUTER_IN_PREFIX(
+ &route->prefix),
route->path.cost);
- }
return 0;
}
}
if (route->path.origin.type ==
htons(OSPF6_LSTYPE_INTRA_PREFIX)) {
if (!CHECK_FLAG(route->flag, OSPF6_ROUTE_BEST)) {
- if (is_debug) {
- prefix2str(&route->prefix, buf,
- sizeof(buf));
+ if (is_debug)
zlog_debug(
- "%s: intra-prefix route %s with cost %u is not best, ignore.",
- __func__, buf,
+ "%s: intra-prefix route %pFX with cost %u is not best, ignore.",
+ __func__, &route->prefix,
route->path.cost);
- }
return 0;
}
}
- if (is_debug) {
- prefix2str(&route->prefix, buf, sizeof(buf));
- zlog_debug("Originating summary in area %s for %s cost %u",
- area->name, buf, route->path.cost);
- }
+ if (is_debug)
+ zlog_debug(
+ "Originating summary in area %s for %pFX cost %u",
+ area->name, &route->prefix, route->path.cost);
summary_table = area->summary_prefix;
}
if (range && !CHECK_FLAG(range->flag, OSPF6_ROUTE_REMOVE)
&& (route->path.area_id != OSPF_AREA_BACKBONE
|| !IS_AREA_TRANSIT(area))) {
- if (is_debug) {
- prefix2str(&range->prefix, buf, sizeof(buf));
- zlog_debug("Suppressed by range %s of area %s",
- buf, route_area->name);
- }
+ if (is_debug)
+ zlog_debug(
+ "Suppressed by range %pFX of area %s",
+ &range->prefix, route_area->name);
ospf6_abr_delete_route(route, summary, summary_table,
old);
return 0;
if (EXPORT_LIST(area))
if (access_list_apply(EXPORT_LIST(area), &route->prefix)
== FILTER_DENY) {
- if (is_debug) {
- inet_ntop(AF_INET,
- &(ADV_ROUTER_IN_PREFIX(
- &route->prefix)),
- buf, sizeof(buf));
+ if (is_debug)
zlog_debug(
- "prefix %s was denied by export list",
- buf);
- }
+ "prefix %pFX was denied by export list",
+ &ADV_ROUTER_IN_PREFIX(
+ &route->prefix));
return 0;
}
}
if (PREFIX_LIST_OUT(area))
if (prefix_list_apply(PREFIX_LIST_OUT(area), &route->prefix)
!= PREFIX_PERMIT) {
- if (is_debug) {
- inet_ntop(
- AF_INET,
- &(ADV_ROUTER_IN_PREFIX(&route->prefix)),
- buf, sizeof(buf));
+ if (is_debug)
zlog_debug(
- "prefix %s was denied by filter-list out",
- buf);
- }
+ "prefix %pFX was denied by filter-list out",
+ &ADV_ROUTER_IN_PREFIX(&route->prefix));
return 0;
}
struct ospf6_path *o_path;
struct ospf6_nexthop *nh, *rnh;
bool nh_updated = false;
- char buf[PREFIX2STR_BUFFER];
for (ALL_LIST_ELEMENTS(old->paths, anode, anext, o_path)) {
if (o_path->origin.adv_router != lsa->header->adv_router
if (nh_updated) {
if (listcount(old->paths)) {
- if (IS_OSPF6_DEBUG_ABR ||
- IS_OSPF6_DEBUG_EXAMIN(INTER_PREFIX)) {
- prefix2str(&old->prefix, buf,
- sizeof(buf));
- zlog_debug("%s: old %s updated nh %u",
- __func__, buf,
+ if (IS_OSPF6_DEBUG_ABR
+ || IS_OSPF6_DEBUG_EXAMIN(INTER_PREFIX))
+ zlog_debug("%s: old %pFX updated nh %u",
+ __func__, &old->prefix,
old->nh_list ? listcount(
old->nh_list)
: 0);
- }
if (table->hook_add)
(*table->hook_add)(old);
continue;
if ((ospf6_route_cmp(route, old_route) != 0)) {
- if (is_debug) {
- prefix2str(&prefix, buf, sizeof(buf));
+ if (is_debug)
zlog_debug(
- "%s: old %p %s cost %u new route cost %u are not same",
- __func__, (void *)old_route, buf,
+ "%s: old %p %pFX cost %u new route cost %u are not same",
+ __func__, (void *)old_route, &prefix,
old_route->path.cost, route->path.cost);
- }
/* Check new route's adv. router is same in one of
* the paths with differed cost, if so remove the
struct listnode *node;
struct ospf6_area *oa;
struct ospf6_route *range;
- char buf[PREFIX2STR_BUFFER];
for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) {
for (range = ospf6_route_head(oa->range_table); range;
range = ospf6_route_next(range)) {
- prefix2str(&range->prefix, buf, sizeof(buf));
- vty_out(vty, " area %s range %s", oa->name, buf);
+ vty_out(vty, " area %s range %pFX", oa->name,
+ &range->prefix);
if (CHECK_FLAG(range->flag,
OSPF6_ROUTE_DO_NOT_ADVERTISE)) {
struct ospf6_external_info *info = route->route_option;
struct ospf6_as_external_lsa *as_external_lsa;
- char buf[PREFIX2STR_BUFFER];
caddr_t p;
- if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE(AS_EXTERNAL)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
- zlog_debug("Originate AS-External-LSA for %s", buf);
- }
+ if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE(AS_EXTERNAL))
+ zlog_debug("Originate AS-External-LSA for %pFX",
+ &route->prefix);
/* prepare buffer */
memset(buffer, 0, sizeof(buffer));
struct listnode *anode, *anext;
struct listnode *nnode, *rnode, *rnext;
struct ospf6_nexthop *nh, *rnh;
- char buf[PREFIX2STR_BUFFER];
bool route_found = false;
/* check for old entry match with new route origin,
listnode_add_sort(old_route->paths, ecmp_path);
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
- prefix2str(&route->prefix, buf,
- sizeof(buf));
zlog_debug(
- "%s: route %s another path added with nh %u, effective paths %u nh %u",
- __func__, buf,
+ "%s: route %pFX another path added with nh %u, effective paths %u nh %u",
+ __func__, &route->prefix,
listcount(ecmp_path->nh_list),
old_route->paths ? listcount(
old_route->paths)
&o_path->ls_prefix,
ospf6->brouter_table);
if (asbr_entry == NULL) {
- if (IS_OSPF6_DEBUG_EXAMIN(
- AS_EXTERNAL)) {
- prefix2str(&old_route->prefix,
- buf, sizeof(buf));
+ if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
zlog_debug(
- "%s: ls_prfix %s asbr_entry not found.",
- __func__, buf);
- }
+ "%s: ls_prfix %pFX asbr_entry not found.",
+ __func__,
+ &old_route->prefix);
continue;
}
ospf6_route_merge_nexthops(old_route,
asbr_entry);
}
- if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
+ if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
zlog_debug(
- "%s: route %s with effective paths %u nh %u",
- __func__, buf,
+ "%s: route %pFX with effective paths %u nh %u",
+ __func__, &route->prefix,
old_route->paths
? listcount(old_route->paths)
: 0,
old_route->nh_list
? listcount(old_route->nh_list)
: 0);
- }
/* Update RIB/FIB */
if (ospf6->route_table->hook_add)
struct prefix asbr_id;
struct ospf6_route *asbr_entry, *route, *old;
struct ospf6_path *path;
- char buf[PREFIX2STR_BUFFER];
external = (struct ospf6_as_external_lsa *)OSPF6_LSA_HEADER_END(
lsa->header);
asbr_entry = ospf6_route_lookup(&asbr_id, ospf6->brouter_table);
if (asbr_entry == NULL
|| !CHECK_FLAG(asbr_entry->path.router_bits, OSPF6_ROUTER_BIT_E)) {
- if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
- prefix2str(&asbr_id, buf, sizeof(buf));
- zlog_debug("ASBR entry not found: %s", buf);
- }
+ if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
+ zlog_debug("ASBR entry not found: %pFX", &asbr_id);
return;
}
listnode_add_sort(route->paths, path);
- if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
- zlog_debug("%s: AS-External %u route add %s cost %u(%u) nh %u",
- __func__,
- (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1
- : 2,
- buf, route->path.cost, route->path.u.cost_e2,
- listcount(route->nh_list));
- }
+ if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
+ zlog_debug(
+ "%s: AS-External %u route add %pFX cost %u(%u) nh %u",
+ __func__,
+ (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1 : 2,
+ &route->prefix, route->path.cost, route->path.u.cost_e2,
+ listcount(route->nh_list));
old = ospf6_route_lookup(&route->prefix, ospf6->route_table);
if (!old) {
struct ospf6_external_info *info;
struct prefix prefix_id;
struct route_node *node;
- char pbuf[PREFIX2STR_BUFFER], ibuf[16];
+ char ibuf[16];
struct listnode *lnode, *lnnode;
struct ospf6_area *oa;
memset(&troute, 0, sizeof(troute));
memset(&tinfo, 0, sizeof(tinfo));
- if (IS_OSPF6_DEBUG_ASBR) {
- prefix2str(prefix, pbuf, sizeof(pbuf));
- zlog_debug("Redistribute %s (%s)", pbuf, ZROUTE_NAME(type));
- }
+ if (IS_OSPF6_DEBUG_ASBR)
+ zlog_debug("Redistribute %pFX (%s)", prefix, ZROUTE_NAME(type));
/* if route-map was specified but not found, do not advertise */
if (ospf6->rmap[type].name) {
if (IS_OSPF6_DEBUG_ASBR) {
inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf,
sizeof(ibuf));
- prefix2str(prefix, pbuf, sizeof(pbuf));
zlog_debug(
- "Advertise as AS-External Id:%s prefix %s metric %u",
- ibuf, pbuf, match->path.metric_type);
+ "Advertise as AS-External Id:%s prefix %pFX metric %u",
+ ibuf, prefix, match->path.metric_type);
}
match->path.origin.id = htonl(info->id);
if (IS_OSPF6_DEBUG_ASBR) {
inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf));
- prefix2str(prefix, pbuf, sizeof(pbuf));
- zlog_debug("Advertise as AS-External Id:%s prefix %s metric %u",
- ibuf, pbuf, route->path.metric_type);
+ zlog_debug(
+ "Advertise as AS-External Id:%s prefix %pFX metric %u",
+ ibuf, prefix, route->path.metric_type);
}
route->path.origin.id = htonl(info->id);
struct route_node *node;
struct ospf6_lsa *lsa;
struct prefix prefix_id;
- char pbuf[PREFIX2STR_BUFFER], ibuf[16];
+ char ibuf[16];
struct listnode *lnode, *lnnode;
struct ospf6_area *oa;
match = ospf6_route_lookup(prefix, ospf6->external_table);
if (match == NULL) {
- if (IS_OSPF6_DEBUG_ASBR) {
- prefix2str(prefix, pbuf, sizeof(pbuf));
- zlog_debug("No such route %s to withdraw", pbuf);
- }
+ if (IS_OSPF6_DEBUG_ASBR)
+ zlog_debug("No such route %pFX to withdraw", prefix);
return;
}
assert(info);
if (info->type != type) {
- if (IS_OSPF6_DEBUG_ASBR) {
- prefix2str(prefix, pbuf, sizeof(pbuf));
- zlog_debug("Original protocol mismatch: %s", pbuf);
- }
+ if (IS_OSPF6_DEBUG_ASBR)
+ zlog_debug("Original protocol mismatch: %pFX", prefix);
return;
}
if (IS_OSPF6_DEBUG_ASBR) {
- prefix2str(prefix, pbuf, sizeof(pbuf));
inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf));
- zlog_debug("Withdraw %s (AS-External Id:%s)", pbuf, ibuf);
+ zlog_debug("Withdraw %pFX (AS-External Id:%s)", prefix, ibuf);
}
lsa = ospf6_lsdb_lookup(htons(OSPF6_LSTYPE_AS_EXTERNAL),
struct ospf6_route *route)
{
struct ospf6_external_info *info = route->route_option;
- char prefix[PREFIX2STR_BUFFER], id[16], forwarding[64];
+ char id[16], forwarding[64];
uint32_t tmp_id;
- prefix2str(&route->prefix, prefix, sizeof(prefix));
tmp_id = ntohl(info->id);
inet_ntop(AF_INET, &tmp_id, id, sizeof(id));
if (!IN6_IS_ADDR_UNSPECIFIED(&info->forwarding))
snprintf(forwarding, sizeof(forwarding), ":: (ifindex %d)",
ospf6_route_get_first_nh_index(route));
- vty_out(vty, "%c %-32s %-15s type-%d %5lu %s\n",
- zebra_route_char(info->type), prefix, id,
+ vty_out(vty, "%c %-32pFX %-15s type-%d %5lu %s\n",
+ zebra_route_char(info->type), &route->prefix, id,
route->path.metric_type,
(unsigned long)(route->path.metric_type == 2
? route->path.u.cost_e2
if ((ifp == NULL) || (dp.family != AF_INET6))
return 0;
- if (IS_OSPF6_DEBUG_ZEBRA(RECV)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&dp, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s bfd destination %s %s",
- ifp->name, buf, bfd_get_status_str(status));
- }
+ if (IS_OSPF6_DEBUG_ZEBRA(RECV))
+ zlog_debug("Zebra: interface %s bfd destination %pFX %s",
+ ifp->name, &dp, bfd_get_status_str(status));
oi = (struct ospf6_interface *)ifp->info;
if (oi->plist_name) {
struct prefix_list *plist;
enum prefix_list_type ret;
- char buf[PREFIX2STR_BUFFER];
- prefix2str(c->address, buf, sizeof(buf));
plist = prefix_list_lookup(AFI_IP6, oi->plist_name);
ret = prefix_list_apply(plist, (void *)c->address);
if (ret == PREFIX_DENY) {
if (IS_OSPF6_DEBUG_INTERFACE)
zlog_debug(
- "%s on %s filtered by prefix-list %s ",
- buf, oi->interface->name,
+ "%pFX on %s filtered by prefix-list %s ",
+ c->address, oi->interface->name,
oi->plist_name);
continue;
}
for (ALL_LIST_ELEMENTS_RO(ifp->connected, i, c)) {
p = c->address;
- prefix2str(p, strbuf, sizeof(strbuf));
switch (p->family) {
case AF_INET:
- vty_out(vty, " inet : %s\n", strbuf);
+ vty_out(vty, " inet : %pFX\n", p);
break;
case AF_INET6:
- vty_out(vty, " inet6: %s\n", strbuf);
+ vty_out(vty, " inet6: %pFX\n", p);
break;
default:
- vty_out(vty, " ??? : %s\n", strbuf);
+ vty_out(vty, " ??? : %pFX\n", p);
break;
}
}
struct listnode *i, *j;
int full_count = 0;
unsigned short prefix_num = 0;
- char buf[PREFIX2STR_BUFFER];
struct ospf6_route_table *route_advertise;
int ls_id = 0;
/* connected prefix to advertise */
for (route = ospf6_route_head(oi->route_connected); route;
route = ospf6_route_best_next(route)) {
- if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
- zlog_debug(" include %s", buf);
- }
+ if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
+ zlog_debug(" include %pFX", &route->prefix);
ospf6_route_add(ospf6_route_copy(route),
route_advertise);
}
struct ospf6_link_lsa *link_lsa;
char *start, *end, *current;
uint16_t type;
- char buf[PREFIX2STR_BUFFER];
oi = (struct ospf6_interface *)THREAD_ARG(thread);
oi->thread_intra_prefix_lsa = NULL;
route->path.area_id = oi->area->area_id;
route->path.type = OSPF6_PATH_TYPE_INTRA;
- if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
- zlog_debug(" include %s", buf);
- }
+ if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
+ zlog_debug(" include %pFX", &route->prefix);
ospf6_route_add(route, route_advertise);
prefix_num--;
ospf6_linkstate_prefix(
o_path->origin.adv_router,
o_path->origin.id, &adv_prefix);
- prefix2str(&adv_prefix, buf,
- sizeof(buf));
zlog_debug(
- "%s: adv_router %s lsa not found",
- __func__, buf);
+ "%s: adv_router %pFX lsa not found",
+ __func__, &adv_prefix);
}
continue;
}
}
}
- if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
- prefix2str(&route->prefix, buf, sizeof(buf));
+ if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX))
zlog_debug(
- "%s: route %s %p with final effective paths %u nh%u",
- __func__, buf, (void *)old_route,
+ "%s: route %pFX %p with final effective paths %u nh%u",
+ __func__, &route->prefix,
+ (void *)old_route,
old_route->paths
? listcount(old_route->paths)
: 0,
listcount(old_route->nh_list));
- }
/* used in intra_route_calculation() to add to
* global ospf6 route table.
/* addr is (struct prefix *) */
#define CONTINUE_IF_ADDRESS_LINKLOCAL(debug, addr) \
if (IN6_IS_ADDR_LINKLOCAL(&(addr)->u.prefix6)) { \
- char buf[PREFIX2STR_BUFFER]; \
- prefix2str(addr, buf, sizeof(buf)); \
if (debug) \
- zlog_debug("Filter out Linklocal: %s", buf); \
+ zlog_debug("Filter out Linklocal: %pFX", addr); \
continue; \
}
#define CONTINUE_IF_ADDRESS_UNSPECIFIED(debug, addr) \
if (IN6_IS_ADDR_UNSPECIFIED(&(addr)->u.prefix6)) { \
- char buf[PREFIX2STR_BUFFER]; \
- prefix2str(addr, buf, sizeof(buf)); \
if (debug) \
- zlog_debug("Filter out Unspecified: %s", buf); \
+ zlog_debug("Filter out Unspecified: %pFX", addr); \
continue; \
}
#define CONTINUE_IF_ADDRESS_LOOPBACK(debug, addr) \
if (IN6_IS_ADDR_LOOPBACK(&(addr)->u.prefix6)) { \
- char buf[PREFIX2STR_BUFFER]; \
- prefix2str(addr, buf, sizeof(buf)); \
if (debug) \
- zlog_debug("Filter out Loopback: %s", buf); \
+ zlog_debug("Filter out Loopback: %pFX", addr); \
continue; \
}
#define CONTINUE_IF_ADDRESS_V4COMPAT(debug, addr) \
if (IN6_IS_ADDR_V4COMPAT(&(addr)->u.prefix6)) { \
- char buf[PREFIX2STR_BUFFER]; \
- prefix2str(addr, buf, sizeof(buf)); \
if (debug) \
- zlog_debug("Filter out V4Compat: %s", buf); \
+ zlog_debug("Filter out V4Compat: %pFX", addr); \
continue; \
}
#define CONTINUE_IF_ADDRESS_V4MAPPED(debug, addr) \
if (IN6_IS_ADDR_V4MAPPED(&(addr)->u.prefix6)) { \
- char buf[PREFIX2STR_BUFFER]; \
- prefix2str(addr, buf, sizeof(buf)); \
if (debug) \
- zlog_debug("Filter out V4Mapped: %s", buf); \
+ zlog_debug("Filter out V4Mapped: %pFX", addr); \
continue; \
}
ospf6_lsdb_set_key(&key, &adv_router, sizeof(adv_router));
ospf6_lsdb_set_key(&key, &id, sizeof(id));
- {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&key, buf, sizeof(buf));
- zlog_debug("lsdb_lookup_next: key: %s", buf);
- }
+ zlog_debug("lsdb_lookup_next: key: %pFX", &key);
node = route_table_get_next(lsdb->table, &key);
static void route_table_assert(struct ospf6_route_table *table)
{
struct ospf6_route *prev, *r, *next;
- char buf[PREFIX2STR_BUFFER];
unsigned int link_error = 0, num = 0;
r = ospf6_route_head(table);
"Something has gone wrong with ospf6_route_table[%p]", table);
zlog_debug("table count = %d, real number = %d", table->count, num);
zlog_debug("DUMP START");
- for (r = ospf6_route_head(table); r; r = ospf6_route_next(r)) {
- prefix2str(&r->prefix, buf, sizeof(buf));
- zlog_info("%p<-[%p]->%p : %s", r->prev, r, r->next, buf);
- }
+ for (r = ospf6_route_head(table); r; r = ospf6_route_next(r))
+ zlog_info("%p<-[%p]->%p : %pFX", r->prev, r, r->next,
+ &r->prefix);
zlog_debug("DUMP END");
assert(link_error == 0 && num == table->count);
{
struct ospf6_route *route, *parent_route;
struct ospf6_vertex *prev;
- char pbuf[PREFIX2STR_BUFFER];
if (IS_OSPF6_DEBUG_SPF(PROCESS))
zlog_debug("SPF install %s (lsa %s) hops %d cost %d", v->name,
ospf6_vertex_delete(v);
return -1;
} else if (route && route->path.cost == v->cost) {
- if (IS_OSPF6_DEBUG_SPF(PROCESS)) {
- prefix2str(&route->prefix, pbuf, sizeof(pbuf));
+ if (IS_OSPF6_DEBUG_SPF(PROCESS))
zlog_debug(
- " another path found to route %s lsa %s, merge",
- pbuf, v->lsa->name);
- }
+ " another path found to route %pFX lsa %s, merge",
+ &route->prefix, v->lsa->name);
ospf6_spf_merge_nexthops_to_route(route, v);
prev = (struct ospf6_vertex *)route->route_option;
}
for (rn = route_top(ospf6->distance_table); rn; rn = route_next(rn))
- if ((odistance = rn->info) != NULL) {
- char buf[PREFIX_STRLEN];
-
- vty_out(vty, " distance %u %s %s\n",
- odistance->distance,
- prefix2str(&rn->p, buf, sizeof(buf)),
+ if ((odistance = rn->info) != NULL)
+ vty_out(vty, " distance %u %pFX %s\n",
+ odistance->distance, &rn->p,
odistance->access_list ? odistance->access_list
: "");
- }
return 0;
}
ifindex = api.nexthops[0].ifindex;
nexthop = &api.nexthops[0].gate.ipv6;
- if (IS_OSPF6_DEBUG_ZEBRA(RECV)) {
- char prefixstr[PREFIX2STR_BUFFER], nexthopstr[128];
-
- prefix2str(&api.prefix, prefixstr, sizeof(prefixstr));
- inet_ntop(AF_INET6, nexthop, nexthopstr, sizeof(nexthopstr));
-
+ if (IS_OSPF6_DEBUG_ZEBRA(RECV))
zlog_debug(
- "Zebra Receive route %s: %s %s nexthop %s ifindex %ld tag %" ROUTE_TAG_PRI,
+ "Zebra Receive route %s: %s %pFX nexthop %pI6 ifindex %ld tag %" ROUTE_TAG_PRI,
(cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD ? "add"
: "delete"),
- zebra_route_string(api.type), prefixstr, nexthopstr,
+ zebra_route_string(api.type), &api.prefix, nexthop,
ifindex, api.tag);
- }
if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD)
ospf6_asbr_redistribute_add(api.type, ifindex, &api.prefix,
static void ospf6_zebra_route_update(int type, struct ospf6_route *request)
{
struct zapi_route api;
- char buf[PREFIX2STR_BUFFER];
int nhcount;
int ret = 0;
struct prefix *dest;
- if (IS_OSPF6_DEBUG_ZEBRA(SEND)) {
- prefix2str(&request->prefix, buf, sizeof(buf));
- zlog_debug("Send %s route: %s",
- (type == REM ? "remove" : "add"), buf);
- }
+ if (IS_OSPF6_DEBUG_ZEBRA(SEND))
+ zlog_debug("Send %s route: %pFX",
+ (type == REM ? "remove" : "add"), &request->prefix);
if (zclient->sock < 0) {
if (IS_OSPF6_DEBUG_ZEBRA(SEND))
lsa = ospf_lsa_refresh(area->ospf, old);
if (!lsa) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str((struct prefix *)p, buf,
- sizeof(buf));
flog_warn(EC_OSPF_LSA_MISSING,
- "%s: Could not refresh %s to %s",
- __func__, buf,
+ "%s: Could not refresh %pFX to %s",
+ __func__, (struct prefix *)p,
inet_ntoa(area->area_id));
return;
}
/* This will flood through area. */
if (!lsa) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str((struct prefix *)p, buf, sizeof(buf));
flog_warn(EC_OSPF_LSA_MISSING,
- "%s: Could not originate %s to %s", __func__,
- buf, inet_ntoa(area->area_id));
+ "%s: Could not originate %pFX to %s",
+ __func__, (struct prefix *)p,
+ inet_ntoa(area->area_id));
return;
}
} else
lsa = ospf_summary_asbr_lsa_originate(p, cost, area);
if (!lsa) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str((struct prefix *)p, buf, sizeof(buf));
flog_warn(EC_OSPF_LSA_MISSING,
- "%s: Could not refresh/originate %s to %s",
- __func__, buf, inet_ntoa(area->area_id));
+ "%s: Could not refresh/originate %pFX to %s",
+ __func__, (struct prefix *)p,
+ inet_ntoa(area->area_id));
return;
}
if ((ifp == NULL) || (p.family != AF_INET))
return 0;
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&p, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s bfd destination %s %s",
- ifp->name, buf, bfd_get_status_str(status));
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: interface %s bfd destination %pFX %s",
+ ifp->name, &p, bfd_get_status_str(status));
params = IF_DEF_PARAMS(ifp);
if (!params->bfd_info)
struct prefix router_id;
zebra_router_id_update_read(zclient->ibuf, &router_id);
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&router_id, buf, sizeof(buf));
- zlog_debug("Zebra rcvd: router id update %s vrf %s id %u", buf,
- ospf_vrf_id_to_name(vrf_id), vrf_id);
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra rcvd: router id update %pFX vrf %s id %u",
+ &router_id, ospf_vrf_id_to_name(vrf_id), vrf_id);
ospf = ospf_lookup_by_vrf_id(vrf_id);
ospf->router_id_zebra = router_id.u.prefix4;
ospf_router_id_update(ospf);
} else {
- if (IS_DEBUG_OSPF_EVENT) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&router_id, buf, sizeof(buf));
+ if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "%s: ospf instance not found for vrf %s id %u router_id %s",
+ "%s: ospf instance not found for vrf %s id %u router_id %pFX",
__func__, ospf_vrf_id_to_name(vrf_id), vrf_id,
- buf);
- }
+ &router_id);
}
return 0;
}
if (c == NULL)
return 0;
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(c->address, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s address add %s vrf %s id %u",
- c->ifp->name, buf, ospf_vrf_id_to_name(vrf_id),
- vrf_id);
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: interface %s address add %pFX vrf %s id %u",
+ c->ifp->name, c->address,
+ ospf_vrf_id_to_name(vrf_id), vrf_id);
ospf = ospf_lookup_by_vrf_id(vrf_id);
if (!ospf)
if (c == NULL)
return 0;
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(c->address, buf, sizeof(buf));
- zlog_debug("Zebra: interface %s address delete %s",
- c->ifp->name, buf);
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: interface %s address delete %pFX",
+ c->ifp->name, c->address);
ifp = c->ifp;
p = *c->address;
count++;
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[2][PREFIX2STR_BUFFER];
struct interface *ifp;
ifp = if_lookup_by_index(path->ifindex, ospf->vrf_id);
zlog_debug(
- "Zebra: Route add %s nexthop %s, ifindex=%d %s",
- prefix2str(p, buf[0], sizeof(buf[0])),
- inet_ntop(AF_INET, &path->nexthop,
- buf[1], sizeof(buf[1])),
- path->ifindex, ifp ? ifp->name : " ");
+ "Zebra: Route add %pFX nexthop %pI4, ifindex=%d %s",
+ p, &path->nexthop, path->ifindex,
+ ifp ? ifp->name : " ");
}
}
api.nexthop_num = count;
api.safi = SAFI_UNICAST;
memcpy(&api.prefix, p, sizeof(*p));
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX2STR_BUFFER];
- zlog_debug("Zebra: Route delete %s",
- prefix2str(p, buf, sizeof(buf)));
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
+ zlog_debug("Zebra: Route delete %pFX", p);
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
}
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX2STR_BUFFER];
- zlog_debug("Zebra: Route add discard %s",
- prefix2str(p, buf, sizeof(buf)));
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
+ zlog_debug("Zebra: Route add discard %pFX", p);
}
void ospf_zebra_delete_discard(struct ospf *ospf, struct prefix_ipv4 *p)
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX2STR_BUFFER];
- zlog_debug("Zebra: Route delete discard %s",
- prefix2str(p, buf, sizeof(buf)));
- }
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
+ zlog_debug("Zebra: Route delete discard %pFX", p);
}
struct ospf_external *ospf_external_lookup(struct ospf *ospf, uint8_t type,
if (DISTRIBUTE_LIST(ospf, type))
if (access_list_apply(DISTRIBUTE_LIST(ospf, type), p)
== FILTER_DENY) {
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX2STR_BUFFER];
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
zlog_debug(
- "Redistribute[%s]: %s filtered by distribute-list.",
- ospf_redist_string(type),
- prefix2str(p, buf, sizeof(buf)));
- }
+ "Redistribute[%s]: %pFX filtered by distribute-list.",
+ ospf_redist_string(type), p);
return 0;
}
if (ret == RMAP_DENYMATCH) {
ei->route_map_set = save_values;
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf[PREFIX2STR_BUFFER];
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
zlog_debug(
- "Redistribute[%s]: %s filtered by route-map.",
- ospf_redist_string(type),
- prefix2str(p, buf, sizeof(buf)));
- }
+ "Redistribute[%s]: %pFX filtered by route-map.",
+ ospf_redist_string(type), p);
return 0;
}
if (is_prefix_default(&p))
rt_type = DEFAULT_ROUTE;
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
- char buf_prefix[PREFIX_STRLEN];
- prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
-
- zlog_debug("%s: cmd %s from client %s: vrf_id %d, p %s",
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
+ zlog_debug("%s: cmd %s from client %s: vrf_id %d, p %pFX",
__func__, zserv_command_string(cmd),
- zebra_route_string(api.type), vrf_id, buf_prefix);
- }
+ zebra_route_string(api.type), vrf_id, &api.prefix);
if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) {
/* XXX|HACK|TODO|FIXME:
{
struct pbr_nexthop_cache *pnhc = b->data;
struct pbr_nht_individual *pnhi = data;
- char buf[PREFIX_STRLEN];
bool old_valid;
old_valid = pnhc->valid;
pbr_nht_individual_nexthop_update(pnhc, pnhi);
- DEBUGD(&pbr_dbg_nht, "\tFound %s: old: %d new: %d",
- prefix2str(&pnhi->nhr->prefix, buf, sizeof(buf)), old_valid,
- pnhc->valid);
+ DEBUGD(&pbr_dbg_nht, "\tFound %pFX: old: %d new: %d",
+ &pnhi->nhr->prefix, old_valid, pnhc->valid);
if (pnhc->valid)
pnhi->valid = true;
static void vty_show_pbrms(struct vty *vty,
const struct pbr_map_sequence *pbrms, bool detail)
{
- char buf[PREFIX_STRLEN];
char rbuf[64];
if (pbrms->reason)
pbrms->reason ? rbuf : "Valid");
if (pbrms->src)
- vty_out(vty, " SRC Match: %s\n",
- prefix2str(pbrms->src, buf, sizeof(buf)));
+ vty_out(vty, " SRC Match: %pFX\n", pbrms->src);
if (pbrms->dst)
- vty_out(vty, " DST Match: %s\n",
- prefix2str(pbrms->dst, buf, sizeof(buf)));
+ vty_out(vty, " DST Match: %pFX\n", pbrms->dst);
if (pbrms->dsfield & PBR_DSFIELD_DSCP)
vty_out(vty, " DSCP Match: %u\n",
(pbrms->dsfield & PBR_DSFIELD_DSCP) >> 2);
struct pbr_map *pbrm,
struct pbr_map_sequence *pbrms)
{
- char buff[PREFIX_STRLEN];
-
vty_out(vty, "pbr-map %s seq %u\n", pbrm->name, pbrms->seqno);
if (pbrms->src)
- vty_out(vty, " match src-ip %s\n",
- prefix2str(pbrms->src, buff, sizeof(buff)));
+ vty_out(vty, " match src-ip %pFX\n", pbrms->src);
if (pbrms->dst)
- vty_out(vty, " match dst-ip %s\n",
- prefix2str(pbrms->dst, buff, sizeof(buff)));
+ vty_out(vty, " match dst-ip %pFX\n", pbrms->dst);
if (pbrms->dsfield & PBR_DSFIELD_DSCP)
vty_out(vty, " match dscp %u\n",
static int interface_address_delete(ZAPI_CALLBACK_ARGS)
{
struct connected *c;
- char buf[PREFIX_STRLEN];
c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (!c)
return 0;
- DEBUGD(&pbr_dbg_zebra, "%s: %s deleted %s", __func__, c->ifp->name,
- prefix2str(c->address, buf, sizeof(buf)));
+ DEBUGD(&pbr_dbg_zebra, "%s: %s deleted %pFX", __func__, c->ifp->name,
+ c->address);
connected_free(&c);
return 0;
struct prefix p;
enum zapi_route_notify_owner note;
uint32_t table_id;
- char buf[PREFIX_STRLEN];
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e))
return -1;
- prefix2str(&p, buf, sizeof(buf));
-
switch (note) {
case ZAPI_ROUTE_FAIL_INSTALL:
DEBUGD(&pbr_dbg_zebra,
- "%s: [%s] Route install failure for table: %u", __func__,
- buf, table_id);
+ "%s: [%pFX] Route install failure for table: %u",
+ __func__, &p, table_id);
break;
case ZAPI_ROUTE_BETTER_ADMIN_WON:
DEBUGD(&pbr_dbg_zebra,
- "%s: [%s] Route better admin distance won for table: %u",
- __func__, buf, table_id);
+ "%s: [%pFX] Route better admin distance won for table: %u",
+ __func__, &p, table_id);
break;
case ZAPI_ROUTE_INSTALLED:
DEBUGD(&pbr_dbg_zebra,
- "%s: [%s] Route installed succeeded for table: %u",
- __func__, buf, table_id);
+ "%s: [%pFX] Route installed succeeded for table: %u",
+ __func__, &p, table_id);
pbr_nht_route_installed_for_table(table_id);
break;
case ZAPI_ROUTE_REMOVED:
DEBUGD(&pbr_dbg_zebra,
- "%s: [%s] Route Removed succeeded for table: %u",
- __func__, buf, table_id);
+ "%s: [%pFX] Route Removed succeeded for table: %u",
+ __func__, &p, table_id);
pbr_nht_route_removed_for_table(table_id);
break;
case ZAPI_ROUTE_REMOVE_FAIL:
DEBUGD(&pbr_dbg_zebra,
- "%s: [%s] Route remove fail for table: %u", __func__,
- buf, table_id);
+ "%s: [%pFX] Route remove fail for table: %u", __func__,
+ &p, table_id);
break;
}
uint8_t install_afi)
{
struct zapi_nexthop *api_nh;
- char buf[PREFIX_STRLEN];
struct nexthop *nhop;
int i;
api->prefix.family = install_afi;
- DEBUGD(&pbr_dbg_zebra, "\tEncoding %s",
- prefix2str(&api->prefix, buf, sizeof(buf)));
+ DEBUGD(&pbr_dbg_zebra, "\tEncoding %pFX", &api->prefix);
i = 0;
for (ALL_NEXTHOPS(nhg, nhop)) {
static int pbr_zebra_nexthop_update(ZAPI_CALLBACK_ARGS)
{
struct zapi_route nhr;
- char buf[PREFIX2STR_BUFFER];
uint32_t i;
if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) {
if (DEBUG_MODE_CHECK(&pbr_dbg_zebra, DEBUG_MODE_ALL)) {
- DEBUGD(&pbr_dbg_zebra, "%s: Received Nexthop update: %s",
- __func__, prefix2str(&nhr.prefix, buf, sizeof(buf)));
+ DEBUGD(&pbr_dbg_zebra, "%s: Received Nexthop update: %pFX",
+ __func__, &nhr.prefix);
DEBUGD(&pbr_dbg_zebra, "%s: (\tNexthops(%u)", __func__,
nhr.nexthop_num);
return 0;
}
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&p, buf, sizeof(buf));
- zlog_debug("%s: interface %s bfd destination %s %s", __func__,
- ifp->name, buf, bfd_get_status_str(status));
- }
+ if (PIM_DEBUG_PIM_TRACE)
+ zlog_debug("%s: interface %s bfd destination %pFX %s", __func__,
+ ifp->name, &p, bfd_get_status_str(status));
for (ALL_LIST_ELEMENTS(pim_ifp->pim_neighbor_list, neigh_node,
neigh_nextnode, neigh)) {
struct bsgrp_node *bsgrp_node;
struct bsm_rpinfo *bsrp;
struct prefix nht_p;
- char buf[PREFIX2STR_BUFFER];
bool is_bsr_tracking = true;
scope = THREAD_ARG(t);
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = scope->current_bsr;
- if (PIM_DEBUG_BSM) {
- prefix2str(&nht_p, buf, sizeof(buf));
- zlog_debug("%s: Deregister BSR addr %s with Zebra NHT",
- __func__, buf);
- }
+ if (PIM_DEBUG_BSM)
+ zlog_debug("%s: Deregister BSR addr %pFX with Zebra NHT",
+ __func__, &nht_p);
pim_delete_tracked_nexthop(scope->pim, &nht_p, NULL, NULL,
is_bsr_tracking);
return;
}
THREAD_OFF(bsrp->g2rp_timer);
- if (PIM_DEBUG_BSM) {
- char buf[48];
-
+ if (PIM_DEBUG_BSM)
zlog_debug(
- "%s : starting g2rp timer for grp: %s - rp: %s with timeout %d secs(Actual Hold time : %d secs)",
- __func__, prefix2str(&bsrp->bsgrp_node->group, buf, 48),
+ "%s : starting g2rp timer for grp: %pFX - rp: %s with timeout %d secs(Actual Hold time : %d secs)",
+ __func__, &bsrp->bsgrp_node->group,
inet_ntoa(bsrp->rp_address), hold_time,
bsrp->rp_holdtime);
- }
thread_add_timer(router->master, pim_on_g2rp_timer, bsrp, hold_time,
&bsrp->g2rp_timer);
if (!bsrp)
return;
- if (PIM_DEBUG_BSM) {
- char buf[48];
-
- zlog_debug("%s : stopping g2rp timer for grp: %s - rp: %s",
- __func__,
- prefix2str(&bsrp->bsgrp_node->group, buf, 48),
+ if (PIM_DEBUG_BSM)
+ zlog_debug("%s : stopping g2rp timer for grp: %pFX - rp: %s",
+ __func__, &bsrp->bsgrp_node->group,
inet_ntoa(bsrp->rp_address));
- }
THREAD_OFF(bsrp->g2rp_timer);
}
if (bsr.s_addr != pim->global_scope.current_bsr.s_addr) {
struct prefix nht_p;
- char buf[PREFIX2STR_BUFFER];
bool is_bsr_tracking = true;
/* De-register old BSR and register new BSR with Zebra NHT */
if (pim->global_scope.current_bsr.s_addr != INADDR_ANY) {
nht_p.u.prefix4 = pim->global_scope.current_bsr;
- if (PIM_DEBUG_BSM) {
- prefix2str(&nht_p, buf, sizeof(buf));
+ if (PIM_DEBUG_BSM)
zlog_debug(
- "%s: Deregister BSR addr %s with Zebra NHT",
- __func__, buf);
- }
+ "%s: Deregister BSR addr %pFX with Zebra NHT",
+ __func__, &nht_p);
pim_delete_tracked_nexthop(pim, &nht_p, NULL, NULL,
is_bsr_tracking);
}
nht_p.u.prefix4 = bsr;
- if (PIM_DEBUG_BSM) {
- prefix2str(&nht_p, buf, sizeof(buf));
+ if (PIM_DEBUG_BSM)
zlog_debug(
- "%s: NHT Register BSR addr %s with Zebra NHT",
- __func__, buf);
- }
+ "%s: NHT Register BSR addr %pFX with Zebra NHT",
+ __func__, &nht_p);
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
pim_find_or_track_nexthop(pim, &nht_p, NULL, NULL,
inet_ntoa(pim_ifp->update_source));
}
if (pim_ifp->sec_addr_list) {
- char pbuf[PREFIX2STR_BUFFER];
vty_out(vty, "Address : %s (primary)\n",
inet_ntoa(ifaddr));
for (ALL_LIST_ELEMENTS_RO(
pim_ifp->sec_addr_list, sec_node,
- sec_addr)) {
- vty_out(vty, " %s\n",
- prefix2str(&sec_addr->addr,
- pbuf, sizeof(pbuf)));
- }
+ sec_addr))
+ vty_out(vty, " %pFX\n",
+ &sec_addr->addr);
} else {
vty_out(vty, "Address : %s\n",
inet_ntoa(ifaddr));
neigh_src_str, sizeof(neigh_src_str));
for (ALL_LIST_ELEMENTS_RO(neigh->prefix_list,
- prefix_node, p)) {
- char neigh_sec_str[PREFIX2STR_BUFFER];
-
- prefix2str(p, neigh_sec_str,
- sizeof(neigh_sec_str));
-
- vty_out(vty, "%-16s %-15s %-15s %-15s\n",
+ prefix_node, p))
+ vty_out(vty, "%-16s %-15s %-15s %-15pFX\n",
ifp->name, inet_ntoa(ifaddr),
- neigh_src_str, neigh_sec_str);
- }
+ neigh_src_str, p);
}
}
}
json_group);
}
} else {
- vty_out(vty, "Group Address %s\n", grp_str);
+ vty_out(vty, "Group Address %pFX\n", &bsgrp->group);
vty_out(vty, "--------------------------\n");
vty_out(vty, "%-15s %-15s %-15s %-15s\n", "Rp Address",
"priority", "Holdtime", "Hash");
if (!if_is_operative(ifp))
return;
- if (PIM_DEBUG_ZEBRA) {
- char buf[BUFSIZ];
- prefix2str(ifc->address, buf, BUFSIZ);
- zlog_debug("%s: %s ifindex=%d connected IP address %s %s",
- __func__, ifp->name, ifp->ifindex, buf,
+ if (PIM_DEBUG_ZEBRA)
+ zlog_debug("%s: %s ifindex=%d connected IP address %pFX %s",
+ __func__, ifp->name, ifp->ifindex, ifc->address,
CHECK_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY)
? "secondary"
: "primary");
- }
ifaddr = ifc->address->u.prefix4;
ifp = ifc->ifp;
zassert(ifp);
- if (PIM_DEBUG_ZEBRA) {
- char buf[BUFSIZ];
- prefix2str(ifc->address, buf, BUFSIZ);
- zlog_debug("%s: %s ifindex=%d disconnected IP address %s %s",
- __func__, ifp->name, ifp->ifindex, buf,
+ if (PIM_DEBUG_ZEBRA)
+ zlog_debug("%s: %s ifindex=%d disconnected IP address %pFX %s",
+ __func__, ifp->name, ifp->ifindex, ifc->address,
CHECK_FLAG(ifc->flags, ZEBRA_IFA_SECONDARY)
? "secondary"
: "primary");
- }
detect_address_change(ifp, force_prim_as_any, __func__);
#include "hash.h"
#include "jhash.h"
+#include "lib/printfrr.h"
+
#include "pimd.h"
#include "pimd/pim_nht.h"
#include "log.h"
if (ret < 0)
zlog_warn("sendmsg_nexthop: zclient_send_message() failed");
- if (PIM_DEBUG_PIM_NHT) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(p, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: NHT %sregistered addr %s(%s) with Zebra ret:%d ",
+ "%s: NHT %sregistered addr %pFX(%s) with Zebra ret:%d ",
__func__,
- (command == ZEBRA_NEXTHOP_REGISTER) ? " " : "de", buf,
+ (command == ZEBRA_NEXTHOP_REGISTER) ? " " : "de", p,
pim->vrf->name, ret);
- }
return;
}
{
struct pim_nexthop_cache *pnc;
char hash_name[64];
- char buf1[64];
pnc = XCALLOC(MTYPE_PIM_NEXTHOP_CACHE,
sizeof(struct pim_nexthop_cache));
pnc->rp_list = list_new();
pnc->rp_list->cmp = pim_rp_list_cmp;
- snprintf(hash_name, sizeof(hash_name), "PNC %s(%s) Upstream Hash",
- prefix2str(&pnc->rpf.rpf_addr, buf1, 64), pim->vrf->name);
+ snprintfrr(hash_name, sizeof(hash_name), "PNC %pFX(%s) Upstream Hash",
+ &pnc->rpf.rpf_addr, pim->vrf->name);
pnc->upstream_hash = hash_create_size(8192, pim_upstream_hash_key,
pim_upstream_equal, hash_name);
pnc = pim_nexthop_cache_add(pim, &rpf);
pim_sendmsg_zebra_rnh(pim, zclient, pnc,
ZEBRA_NEXTHOP_REGISTER);
- if (PIM_DEBUG_PIM_NHT) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(addr, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: NHT cache and zebra notification added for %s(%s)",
- __func__, buf, pim->vrf->name);
- }
+ "%s: NHT cache and zebra notification added for %pFX(%s)",
+ __func__, addr, pim->vrf->name);
}
if (rp != NULL) {
if (del_bsr_tracking)
pnc->bsr_tracking = false;
- if (PIM_DEBUG_PIM_NHT) {
- char buf[PREFIX_STRLEN];
- prefix2str(addr, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: NHT %s(%s) rp_list count:%d upstream count:%ld",
- __func__, buf, pim->vrf->name,
+ "%s: NHT %pFX(%s) rp_list count:%d upstream count:%ld",
+ __func__, addr, pim->vrf->name,
pnc->rp_list->count, pnc->upstream_hash->count);
- }
if (pnc->rp_list->count == 0
&& pnc->upstream_hash->count == 0
prefix_copy(&rpf.rpf_addr, &nhr.prefix);
pnc = pim_nexthop_cache_find(pim, &rpf);
if (!pnc) {
- if (PIM_DEBUG_PIM_NHT) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&rpf.rpf_addr, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: Skipping NHT update, addr %s is not in local cached DB.",
- __func__, buf);
- }
+ "%s: Skipping NHT update, addr %pFX is not in local cached DB.",
+ __func__, &rpf.rpf_addr);
return 0;
}
} else {
continue;
}
- if (PIM_DEBUG_PIM_NHT) {
- char p_str[PREFIX2STR_BUFFER];
-
- prefix2str(&nhr.prefix, p_str, sizeof(p_str));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: NHT addr %s(%s) %d-nhop via %s(%s) type %d distance:%u metric:%u ",
- __func__, p_str, pim->vrf->name, i + 1,
- inet_ntoa(nexthop->gate.ipv4),
+ "%s: NHT addr %pFX(%s) %d-nhop via %s(%s) type %d distance:%u metric:%u ",
+ __func__, &nhr.prefix, pim->vrf->name,
+ i + 1, inet_ntoa(nexthop->gate.ipv4),
ifp->name, nexthop->type, nhr.distance,
nhr.metric);
- }
if (!ifp->info) {
/*
}
SET_FLAG(pnc->flags, PIM_NEXTHOP_ANSWER_RECEIVED);
- if (PIM_DEBUG_PIM_NHT) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&nhr.prefix, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_NHT)
zlog_debug(
- "%s: NHT Update for %s(%s) num_nh %d num_pim_nh %d vrf:%u up %ld rp %d",
- __func__, buf, pim->vrf->name, nhr.nexthop_num,
+ "%s: NHT Update for %pFX(%s) num_nh %d num_pim_nh %d vrf:%u up %ld rp %d",
+ __func__, &nhr.prefix, pim->vrf->name, nhr.nexthop_num,
pnc->nexthop_num, vrf_id, pnc->upstream_hash->count,
listcount(pnc->rp_list));
- }
pim_rpf_set_refresh_time(pim);
}
rp_info = rn->info;
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX_STRLEN];
-
- zlog_debug("Lookedup: %p for rp_info: %p(%s) Lock: %d", rn,
- rp_info,
- prefix2str(&rp_info->group, buf, sizeof(buf)),
+ if (PIM_DEBUG_PIM_TRACE)
+ zlog_debug("Lookedup: %p for rp_info: %p(%pFX) Lock: %d", rn,
+ rp_info, &rp_info->group,
route_node_get_lock_count(rn));
- }
route_unlock_node(rn);
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = old_upstream_addr;
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&nht_p, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
- "%s: Deregister upstream %s addr %s with Zebra NHT",
- __func__, up->sg_str, buf);
- }
+ "%s: Deregister upstream %s addr %pFX with Zebra NHT",
+ __func__, up->sg_str, &nht_p);
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL, false);
}
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 =
rp_all->rp.rpf_addr.u.prefix4; // RP address
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
- char buf1[PREFIX2STR_BUFFER];
- prefix2str(&nht_p, buf, sizeof(buf));
- prefix2str(&rp_all->group, buf1, sizeof(buf1));
+ if (PIM_DEBUG_PIM_NHT_RP)
zlog_debug(
- "%s: NHT Register rp_all addr %s grp %s ",
- __func__, buf, buf1);
- }
+ "%s: NHT Register rp_all addr %pFX grp %pFX ",
+ __func__, &nht_p, &rp_all->group);
frr_each (rb_pim_upstream, &pim->upstream_head, up) {
/* Find (*, G) upstream whose RP is not
rn = route_node_get(pim->rp_table, &rp_info->group);
rn->info = rp_info;
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX_STRLEN];
-
- zlog_debug("Allocated: %p for rp_info: %p(%s) Lock: %d", rn,
- rp_info,
- prefix2str(&rp_info->group, buf, sizeof(buf)),
+ if (PIM_DEBUG_PIM_TRACE)
+ zlog_debug("Allocated: %p for rp_info: %p(%pFX) Lock: %d", rn,
+ rp_info, &rp_info->group,
route_node_get_lock_count(rn));
- }
frr_each (rb_pim_upstream, &pim->upstream_head, up) {
if (up->sg.src.s_addr == INADDR_ANY) {
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
- char buf1[PREFIX2STR_BUFFER];
- prefix2str(&nht_p, buf, sizeof(buf));
- prefix2str(&rp_info->group, buf1, sizeof(buf1));
- zlog_debug("%s: NHT Register RP addr %s grp %s with Zebra ",
- __func__, buf, buf1);
- }
+ if (PIM_DEBUG_PIM_NHT_RP)
+ zlog_debug("%s: NHT Register RP addr %pFX grp %pFX with Zebra ",
+ __func__, &nht_p, &rp_info->group);
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false, NULL);
if (!pim_ecmp_nexthop_lookup(pim, &rp_info->rp.source_nexthop, &nht_p,
&rp_info->group, 1))
struct pim_upstream *up;
struct bsgrp_node *bsgrp = NULL;
struct bsm_rpinfo *bsrp = NULL;
- char grp_str[PREFIX2STR_BUFFER];
char rp_str[INET_ADDRSTRLEN];
if (!inet_ntop(AF_INET, &rp_addr, rp_str, sizeof(rp_str)))
snprintf(rp_str, sizeof(rp_str), "<rp?>");
- prefix2str(&group, grp_str, sizeof(grp_str));
if (plist)
rp_info = pim_rp_find_prefix_list(pim, rp_addr, plist);
}
if (PIM_DEBUG_PIM_TRACE)
- zlog_debug("%s: Delete RP %s for the group %s", __func__,
- rp_str, grp_str);
+ zlog_debug("%s: Delete RP %s for the group %pFX", __func__,
+ rp_str, &group);
/* While static RP is getting deleted, we need to check if dynamic RP
* present for the same group in BSM RP table, then install the dynamic
"<bsrp?>");
zlog_debug(
- "%s: BSM RP %s found for the group %s",
- __func__, bsrp_str, grp_str);
+ "%s: BSM RP %s found for the group %pFX",
+ __func__, bsrp_str, &group);
}
return pim_rp_change(pim, bsrp->rp_address,
group, RP_SRC_BSR);
} else {
if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
- "%s: BSM RP not found for the group %s",
- __func__, grp_str);
+ "%s: BSM RP not found for the group %pFX",
+ __func__, &group);
}
}
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&nht_p, buf, sizeof(buf));
- zlog_debug("%s: Deregister RP addr %s with Zebra ", __func__,
- buf);
- }
+ if (PIM_DEBUG_PIM_NHT_RP)
+ zlog_debug("%s: Deregister RP addr %pFX with Zebra ", __func__,
+ &nht_p);
pim_delete_tracked_nexthop(pim, &nht_p, NULL, rp_info, false);
if (!str2prefix("224.0.0.0/4", &g_all))
EC_LIB_DEVELOPMENT,
"Expected rn->info to be equal to rp_info");
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX_STRLEN];
-
+ if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
- "%s:Found for Freeing: %p for rp_info: %p(%s) Lock: %d",
- __func__, rn, rp_info,
- prefix2str(&rp_info->group, buf,
- sizeof(buf)),
+ "%s:Found for Freeing: %p for rp_info: %p(%pFX) Lock: %d",
+ __func__, rn, rp_info, &rp_info->group,
route_node_get_lock_count(rn));
- }
+
rn->info = NULL;
route_unlock_node(rn);
route_unlock_node(rn);
/* Deregister old RP addr with Zebra NHT */
if (rp_info->rp.rpf_addr.u.prefix4.s_addr != INADDR_ANY) {
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(&nht_p, buf, sizeof(buf));
- zlog_debug("%s: Deregister RP addr %s with Zebra ",
- __func__, buf);
- }
+ if (PIM_DEBUG_PIM_NHT_RP)
+ zlog_debug("%s: Deregister RP addr %pFX with Zebra ",
+ __func__, &nht_p);
pim_delete_tracked_nexthop(pim, &nht_p, NULL, rp_info, false);
}
/* Register new RP addr with Zebra NHT */
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
- char buf1[PREFIX2STR_BUFFER];
-
- prefix2str(&nht_p, buf, sizeof(buf));
- prefix2str(&rp_info->group, buf1, sizeof(buf1));
- zlog_debug("%s: NHT Register RP addr %s grp %s with Zebra ",
- __func__, buf, buf1);
- }
+ if (PIM_DEBUG_PIM_NHT_RP)
+ zlog_debug("%s: NHT Register RP addr %pFX grp %pFX with Zebra ",
+ __func__, &nht_p, &rp_info->group);
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false, NULL);
if (!pim_ecmp_nexthop_lookup(pim, &rp_info->rp.source_nexthop, &nht_p,
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
- if (PIM_DEBUG_PIM_NHT_RP) {
- char buf[PREFIX2STR_BUFFER];
- char buf1[PREFIX2STR_BUFFER];
- prefix2str(&nht_p, buf, sizeof(buf));
- prefix2str(&rp_info->group, buf1, sizeof(buf1));
+ if (PIM_DEBUG_PIM_NHT_RP)
zlog_debug(
- "%s: NHT Register RP addr %s grp %s with Zebra",
- __func__, buf, buf1);
- }
+ "%s: NHT Register RP addr %pFX grp %pFX with Zebra",
+ __func__, &nht_p, &rp_info->group);
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false,
NULL);
pim_rpf_set_refresh_time(pim);
struct listnode *node;
struct rp_info *rp_info;
char rp_buffer[32];
- char group_buffer[32];
int count = 0;
for (ALL_LIST_ELEMENTS_RO(pim->rp_list, node, rp_info)) {
rp_buffer, 32),
rp_info->plist);
else
- vty_out(vty, "%sip pim rp %s %s\n", spaces,
+ vty_out(vty, "%sip pim rp %s %pFX\n", spaces,
inet_ntop(AF_INET,
&rp_info->rp.rpf_addr.u.prefix4,
rp_buffer, 32),
- prefix2str(&rp_info->group, group_buffer, 32));
+ &rp_info->group);
count++;
}
if (rp_info->plist)
vty_out(vty, "%-18s ", rp_info->plist);
else
- vty_out(vty, "%-18s ",
- prefix2str(&rp_info->group, buf,
- 48));
+ vty_out(vty, "%-18pFX ",
+ &rp_info->group);
if (rp_info->rp.source_nexthop.interface)
vty_out(vty, "%-16s ",
nht_p.family = AF_INET;
nht_p.prefixlen = IPV4_MAX_BITLEN;
nht_p.u.prefix4 = up->upstream_addr;
- if (PIM_DEBUG_PIM_TRACE) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&nht_p, buf, sizeof(buf));
+ if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
- "%s: Deregister upstream %s addr %s with Zebra NHT",
- __func__, up->sg_str, buf);
- }
+ "%s: Deregister upstream %s addr %pFX with Zebra NHT",
+ __func__, up->sg_str, &nht_p);
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL, false);
}
}
if (PIM_DEBUG_PIM_TRACE) {
- if (up) {
- char buf[PREFIX2STR_BUFFER];
- prefix2str(&up->rpf.rpf_addr, buf, sizeof(buf));
- zlog_debug("%s(%s): %s, iif %s (%s) found: %d: ref_count: %d",
+ if (up)
+ zlog_debug("%s(%s): %s, iif %pFX (%s) found: %d: ref_count: %d",
__func__, name,
- up->sg_str, buf, up->rpf.source_nexthop.interface ?
+ up->sg_str, &up->rpf.rpf_addr, up->rpf.source_nexthop.interface ?
up->rpf.source_nexthop.interface->name : "Unknown" ,
found, up->ref_count);
- } else
+ else
zlog_debug("%s(%s): (%s) failure to create", __func__,
name, pim_str_sg_dump(sg));
}
p = c->address;
if (PIM_DEBUG_ZEBRA) {
- char buf[BUFSIZ];
- prefix2str(p, buf, BUFSIZ);
- zlog_debug("%s: %s(%u) connected IP address %s flags %u %s",
- __func__, c->ifp->name, vrf_id, buf, c->flags,
+ zlog_debug("%s: %s(%u) connected IP address %pFX flags %u %s",
+ __func__, c->ifp->name, vrf_id, p, c->flags,
CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
? "secondary"
: "primary");
struct in_addr primary_addr = pim_find_primary_addr(c->ifp);
if (p->family != AF_INET
|| primary_addr.s_addr != p->u.prefix4.s_addr) {
- if (PIM_DEBUG_ZEBRA) {
- /* but we had a primary address already */
-
- char buf[BUFSIZ];
-
- prefix2str(p, buf, BUFSIZ);
-
+ if (PIM_DEBUG_ZEBRA)
zlog_warn(
- "%s: %s : forcing secondary flag on %s",
- __func__, c->ifp->name, buf);
- }
+ "%s: %s : forcing secondary flag on %pFX",
+ __func__, c->ifp->name, p);
SET_FLAG(c->flags, ZEBRA_IFA_SECONDARY);
}
}
p = c->address;
if (p->family == AF_INET) {
if (PIM_DEBUG_ZEBRA) {
- char buf[BUFSIZ];
- prefix2str(p, buf, BUFSIZ);
zlog_debug(
- "%s: %s(%u) disconnected IP address %s flags %u %s",
- __func__, c->ifp->name, vrf_id, buf, c->flags,
+ "%s: %s(%u) disconnected IP address %pFX flags %u %s",
+ __func__, c->ifp->name, vrf_id, p, c->flags,
CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
? "secondary"
: "primary");
struct listnode *node;
struct sharp_nh_tracker *nht;
- for (ALL_LIST_ELEMENTS_RO(sg.nhs, node, nht)) {
- char buf[PREFIX_STRLEN];
-
- vty_out(vty, "%s: Nexthops: %u Updates: %u\n",
- prefix2str(&nht->p, buf, sizeof(buf)),
- nht->nhop_num,
- nht->updates);
- }
+ for (ALL_LIST_ELEMENTS_RO(sg.nhs, node, nht))
+ vty_out(vty, "%pFX: Nexthops: %u Updates: %u\n", &nht->p,
+ nht->nhop_num, nht->updates);
}
PREDECL_RBTREE_UNIQ(sharp_nhg_rb);
"Data about what is going on\n"
"Route Install/Removal Information\n")
{
- char buf[PREFIX_STRLEN];
struct timeval r;
timersub(&sg.r.t_end, &sg.r.t_start, &r);
- vty_out(vty, "Prefix: %s Total: %u %u %u Time: %jd.%ld\n",
- prefix2str(&sg.r.orig_prefix, buf, sizeof(buf)),
- sg.r.total_routes,
- sg.r.installed_routes,
- sg.r.removed_routes,
- (intmax_t)r.tv_sec, (long)r.tv_usec);
+ vty_out(vty, "Prefix: %pFX Total: %u %u %u Time: %jd.%ld\n",
+ &sg.r.orig_prefix, sg.r.total_routes, sg.r.installed_routes,
+ sg.r.removed_routes, (intmax_t)r.tv_sec, (long)r.tv_usec);
return CMD_SUCCESS;
}
struct prefix p;
enum zapi_route_notify_owner note;
uint32_t table_id;
- char buf[PREFIX_STRLEN];
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e))
return -1;
- prefix2str(&p, buf, sizeof(buf));
-
switch (note) {
case ZAPI_ROUTE_FAIL_INSTALL:
static_nht_mark_state(&p, vrf_id, STATIC_NOT_INSTALLED);
- zlog_warn("%s: Route %s failed to install for table: %u",
- __func__, buf, table_id);
+ zlog_warn("%s: Route %pFX failed to install for table: %u",
+ __func__, &p, table_id);
break;
case ZAPI_ROUTE_BETTER_ADMIN_WON:
static_nht_mark_state(&p, vrf_id, STATIC_NOT_INSTALLED);
zlog_warn(
- "%s: Route %s over-ridden by better route for table: %u",
- __func__, buf, table_id);
+ "%s: Route %pFX over-ridden by better route for table: %u",
+ __func__, &p, table_id);
break;
case ZAPI_ROUTE_INSTALLED:
static_nht_mark_state(&p, vrf_id, STATIC_INSTALLED);
break;
case ZAPI_ROUTE_REMOVE_FAIL:
static_nht_mark_state(&p, vrf_id, STATIC_INSTALLED);
- zlog_warn("%s: Route %s failure to remove for table: %u",
- __func__, buf, table_id);
+ zlog_warn("%s: Route %pFX failure to remove for table: %u",
+ __func__, &p, table_id);
break;
}
if (bgp_dest_has_bgp_path_info_data(dest)
&& !prefix_in_array(dest_p, prefixes, prefix_count)) {
- char buf[PREFIX2STR_BUFFER];
-
- prefix2str(dest_p, buf, PREFIX2STR_BUFFER);
- printf("prefix %s was not expected!\n", buf);
+ printf("prefix %pFX was not expected!\n", dest_p);
assert(0);
}
}
"magic (0-100) {ipv4net A.B.C.D/M|X:X::X:X$ipv6}",
"1\n2\n3\n4\n5\n")
{
- char buf[256];
vty_out(vty, "def: %s\n", self->string);
vty_out(vty, "num: %ld\n", magic);
- vty_out(vty, "ipv4: %s\n", prefix2str(ipv4net, buf, sizeof(buf)));
- vty_out(vty, "ipv6: %s\n",
- inet_ntop(AF_INET6, &ipv6, buf, sizeof(buf)));
+ vty_out(vty, "ipv4: %pFX\n", ipv4net);
+ vty_out(vty, "ipv6: %pI6\n", &ipv6);
return CMD_SUCCESS;
}
static void print_subtree(struct route_node *rn, const char *legend,
int indent_level)
{
- char buf[PREFIX2STR_BUFFER];
int i;
/*
printf(" ");
}
- prefix2str(&rn->p, buf, sizeof(buf));
- printf("%s: %s", legend, buf);
+ printf("%s: %pFX", legend, &rn->p);
if (!rn->info) {
printf(" (internal)");
}
/* Schedule LSP forwarding entries for processing, if appropriate. */
if (zvrf->vrf->vrf_id == VRF_DEFAULT) {
- if (IS_ZEBRA_DEBUG_MPLS) {
- char buf[PREFIX_STRLEN];
-
+ if (IS_ZEBRA_DEBUG_MPLS)
zlog_debug(
- "%u: IF %s IP %s address add/up, scheduling MPLS processing",
- zvrf->vrf->vrf_id, ifp->name,
- prefix2str(&p, buf, sizeof(buf)));
- }
+ "%u: IF %s IP %pFX address add/up, scheduling MPLS processing",
+ zvrf->vrf->vrf_id, ifp->name, &p);
mpls_mark_lsps_for_processing(zvrf, &p);
}
}
/* Schedule LSP forwarding entries for processing, if appropriate. */
if (zvrf->vrf->vrf_id == VRF_DEFAULT) {
- if (IS_ZEBRA_DEBUG_MPLS) {
- char buf[PREFIX_STRLEN];
-
+ if (IS_ZEBRA_DEBUG_MPLS)
zlog_debug(
- "%u: IF %s IP %s address down, scheduling MPLS processing",
- zvrf->vrf->vrf_id, ifp->name,
- prefix2str(&p, buf, sizeof(buf)));
- }
+ "%u: IF %s IP %pFX address down, scheduling MPLS processing",
+ zvrf->vrf->vrf_id, ifp->name, &p);
mpls_mark_lsps_for_processing(zvrf, &p);
}
}
/* Schedule LSP forwarding entries for processing, if appropriate. */
if (ifp->vrf_id == VRF_DEFAULT) {
- if (IS_ZEBRA_DEBUG_MPLS) {
- char buf[PREFIX_STRLEN];
-
+ if (IS_ZEBRA_DEBUG_MPLS)
zlog_debug(
- "%u: IF %s IP %s address delete, scheduling MPLS processing",
- ifp->vrf_id, ifp->name,
- prefix2str(p, buf, sizeof(buf)));
- }
+ "%u: IF %s IP %pFX address delete, scheduling MPLS processing",
+ ifp->vrf_id, ifp->name, p);
mpls_mark_lsps_for_processing(vrf_info_lookup(ifp->vrf_id), p);
}
}
bool print_header = true;
FOR_ALL_INTERFACES (vrf, ifp) {
- char global_pfx[PREFIX_STRLEN] = {0};
- char buf[PREFIX_STRLEN] = {0};
bool first_pfx_printed = false;
if (print_header) {
if (!CHECK_FLAG(connected->flags,
ZEBRA_IFA_SECONDARY)) {
p = connected->address;
- prefix2str(p, buf, sizeof(buf));
if (first_pfx_printed) {
- /* padding to prepare row only for ip addr */
+ /* padding to prepare row only
+ * for ip addr */
vty_out(vty, "%-40s", "");
if (list_size > 1)
vty_out(vty, "+ ");
- vty_out(vty, "%s\n", buf);
+ vty_out(vty, "%pFX\n", p);
} else {
if (list_size > 1)
vty_out(vty, "+ ");
- vty_out(vty, "%s\n", buf);
+ vty_out(vty, "%pFX\n", p);
}
first_pfx_printed = true;
break;
p = connected->address;
/* Don't print link local pfx */
if (!IN6_IS_ADDR_LINKLOCAL(&p->u.prefix6)) {
- prefix2str(p, global_pfx, PREFIX_STRLEN);
if (first_pfx_printed) {
- /* padding to prepare row only for ip addr */
+ /* padding to prepare row only
+ * for ip addr */
vty_out(vty, "%-40s", "");
if (v6_list_size > 1)
vty_out(vty, "+ ");
- vty_out(vty, "%s\n", global_pfx);
+ vty_out(vty, "%pFX\n", p);
} else {
if (v6_list_size > 1)
vty_out(vty, "+ ");
- vty_out(vty, "%s\n", global_pfx);
+ vty_out(vty, "%pFX\n", p);
}
first_pfx_printed = true;
break;
{
struct zebra_if *zi = ifp->info;
struct irdp_interface *irdp = zi->irdp;
- char buf[PREFIX_STRLEN];
uint32_t dst;
uint32_t ttl = 1;
dst = htonl(INADDR_ALLHOSTS_GROUP);
if (irdp->flags & IF_DEBUG_MESSAGES)
- zlog_debug("IRDP: TX Advert on %s %s Holdtime=%d Preference=%d",
- ifp->name, prefix2str(p, buf, sizeof(buf)),
- irdp->flags & IF_SHUTDOWN ? 0 : irdp->Lifetime,
- get_pref(irdp, p));
+ zlog_debug(
+ "IRDP: TX Advert on %s %pFX Holdtime=%d Preference=%d",
+ ifp->name, p,
+ irdp->flags & IF_SHUTDOWN ? 0 : irdp->Lifetime,
+ get_pref(irdp, p));
send_packet(ifp, s, dst, p, ttl);
}
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
RNODE_FOREACH_RE (rn, newre) {
const struct prefix *dst_p, *src_p;
- char buf[PREFIX_STRLEN];
srcdest_rnode_prefixes(rn, &dst_p, &src_p);
if (IS_ZEBRA_DEBUG_RIB)
zlog_debug(
- "%s: client %s %s(%u) checking: selected=%d, type=%d, distance=%d, metric=%d zebra_check_addr=%d",
+ "%s: client %s %pFX(%u) checking: selected=%d, type=%d, distance=%d, metric=%d zebra_check_addr=%d",
__func__,
zebra_route_string(client->proto),
- prefix2str(dst_p, buf, sizeof(buf)),
- vrf_id, CHECK_FLAG(newre->flags,
- ZEBRA_FLAG_SELECTED),
+ dst_p, vrf_id,
+ CHECK_FLAG(newre->flags,
+ ZEBRA_FLAG_SELECTED),
newre->type, newre->distance,
newre->metric, zebra_check_addr(dst_p));
struct listnode *node, *nnode;
struct zserv *client;
int afi;
- char buf[PREFIX_STRLEN];
- if (IS_ZEBRA_DEBUG_RIB) {
+ if (IS_ZEBRA_DEBUG_RIB)
zlog_debug(
- "(%u:%u):%s: Redist update re %p (%s), old %p (%s)",
- re->vrf_id, re->table, prefix2str(p, buf, sizeof(buf)),
- re, zebra_route_string(re->type), prev_re,
+ "(%u:%u):%pFX: Redist update re %p (%s), old %p (%s)",
+ re->vrf_id, re->table, p, re,
+ zebra_route_string(re->type), prev_re,
prev_re ? zebra_route_string(prev_re->type) : "None");
- }
afi = family2afi(p->family);
if (!afi) {
}
if (!zebra_check_addr(p)) {
if (IS_ZEBRA_DEBUG_RIB)
- zlog_debug("Redist update filter prefix %s",
- prefix2str(p, buf, sizeof(buf)));
+ zlog_debug("Redist update filter prefix %pFX", p);
return;
}
if (zebra_redistribute_check(re, client, p, afi)) {
if (IS_ZEBRA_DEBUG_RIB) {
zlog_debug(
- "%s: client %s %s(%u:%u), type=%d, distance=%d, metric=%d",
+ "%s: client %s %pFX(%u:%u), type=%d, distance=%d, metric=%d",
__func__,
- zebra_route_string(client->proto),
- prefix2str(p, buf, sizeof(buf)),
+ zebra_route_string(client->proto), p,
re->vrf_id, re->table, re->type,
re->distance, re->metric);
}
struct listnode *node, *nnode;
struct zserv *client;
int afi;
- char buf[PREFIX_STRLEN];
vrf_id_t vrfid;
if (old_re)
return;
if (IS_ZEBRA_DEBUG_RIB) {
- zlog_debug(
- "%u:%s: Redist del: re %p (%s), new re %p (%s)",
- vrfid, prefix2str(p, buf, sizeof(buf)),
- old_re,
- old_re ? zebra_route_string(old_re->type) : "None",
- new_re,
- new_re ? zebra_route_string(new_re->type) : "None");
+ zlog_debug("%u:%pFX: Redist del: re %p (%s), new re %p (%s)",
+ vrfid, p, old_re,
+ old_re ? zebra_route_string(old_re->type) : "None",
+ new_re,
+ new_re ? zebra_route_string(new_re->type) : "None");
}
/* Add DISTANCE_INFINITY check. */
if (!zebra_check_addr(p)) {
if (IS_ZEBRA_DEBUG_RIB) {
zlog_debug(
- "%u:%s: Redist del old: skipping invalid prefix",
- vrfid, prefix2str(p, buf, sizeof(buf)));
+ "%u:%pFX: Redist del old: skipping invalid prefix",
+ vrfid, p);
}
return;
}
struct prefix *p;
if (IS_ZEBRA_DEBUG_EVENT) {
- char buf[PREFIX_STRLEN];
-
p = ifc->address;
- zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %s on %s(%u)",
- prefix2str(p, buf, sizeof(buf)), ifp->name,
- ifp->vrf_id);
+ zlog_debug(
+ "MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %pFX on %s(%u)",
+ p, ifp->name, ifp->vrf_id);
}
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
struct prefix *p;
if (IS_ZEBRA_DEBUG_EVENT) {
- char buf[PREFIX_STRLEN];
-
p = ifc->address;
- zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %s on %s(%u)",
- prefix2str(p, buf, sizeof(buf)),
- ifp->name, ifp->vrf_id);
+ zlog_debug(
+ "MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %pFX on %s(%u)",
+ p, ifp->name, ifp->vrf_id);
}
zebra_vxlan_add_del_gw_macip(ifp, ifc->address, 0);
p.prefixlen = rtm->rtm_dst_len;
if (rtm->rtm_src_len != 0) {
- char buf[PREFIX_STRLEN];
flog_warn(
EC_ZEBRA_UNSUPPORTED_V4_SRCDEST,
- "unsupported IPv4 sourcedest route (dest %s vrf %u)",
- prefix2str(&p, buf, sizeof(buf)), vrf_id);
+ "unsupported IPv4 sourcedest route (dest %pFX vrf %u)",
+ &p, vrf_id);
return 0;
}
}
if (IS_ZEBRA_DEBUG_KERNEL) {
- char buf[PREFIX_STRLEN];
char buf2[PREFIX_STRLEN];
+
zlog_debug(
- "%s %s%s%s vrf %s(%u) table_id: %u metric: %d Admin Distance: %d",
- nl_msg_type_to_str(h->nlmsg_type),
- prefix2str(&p, buf, sizeof(buf)),
+ "%s %pFX%s%s vrf %s(%u) table_id: %u metric: %d Admin Distance: %d",
+ nl_msg_type_to_str(h->nlmsg_type), &p,
src_p.prefixlen ? " from " : "",
src_p.prefixlen ? prefix2str(&src_p, buf2, sizeof(buf2))
: "",
bool gate = false;
int error;
char gate_buf[INET6_BUFSIZ];
- char prefix_buf[PREFIX_STRLEN];
enum blackhole_type bh_type = BLACKHOLE_UNSPEC;
- prefix2str(p, prefix_buf, sizeof(prefix_buf));
-
/*
* We only have the ability to ADD or DELETE at this point
* in time.
*/
if (cmd != RTM_ADD && cmd != RTM_DELETE) {
if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug("%s: %s odd command %s",
- __func__, prefix_buf,
+ zlog_debug("%s: %pFX odd command %s", __func__, p,
lookup_msg(rtm_type_str, cmd, NULL));
return 0;
}
if (IS_ZEBRA_DEBUG_KERNEL) {
if (!gate) {
zlog_debug(
- "%s: %s: attention! gate not found for re",
- __func__, prefix_buf);
+ "%s: %pFX: attention! gate not found for re",
+ __func__, p);
} else {
switch (p->family) {
case AF_INET:
case ZEBRA_ERR_NOERROR:
nexthop_num++;
if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug("%s: %s: successfully did NH %s",
- __func__, prefix_buf, gate_buf);
+ zlog_debug("%s: %pFX: successfully did NH %s",
+ __func__, p, gate_buf);
if (cmd == RTM_ADD)
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
break;
default:
flog_err(
EC_LIB_SYSTEM_CALL,
- "%s: %s: rtm_write() unexpectedly returned %d for command %s",
- __func__, prefix_buf, error,
+ "%s: %pFX: rtm_write() unexpectedly returned %d for command %s",
+ __func__, p, error,
lookup_msg(rtm_type_str, cmd, NULL));
break;
}
if (nexthop_num == 0) {
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "%s: No useful nexthops were found in RIB prefix %s",
- __func__, prefix_buf);
+ "%s: No useful nexthops were found in RIB prefix %pFX",
+ __func__, p);
return 1;
}
struct rtadv_prefix *rprefix;
struct rtadv_rdnss *rdnss;
struct rtadv_dnssl *dnssl;
- char buf[PREFIX_STRLEN];
int interval;
zif = ifp->info;
for (ALL_LIST_ELEMENTS_RO(zif->rtadv.AdvPrefixList, node, rprefix)) {
if ((rprefix->AdvPrefixCreate == PREFIX_SRC_MANUAL)
|| (rprefix->AdvPrefixCreate == PREFIX_SRC_BOTH)) {
- vty_out(vty, " ipv6 nd prefix %s",
- prefix2str(&rprefix->prefix, buf, sizeof(buf)));
+ vty_out(vty, " ipv6 nd prefix %pFX", &rprefix->prefix);
if ((rprefix->AdvValidLifetime != RTADV_VALID_LIFETIME)
|| (rprefix->AdvPreferredLifetime
!= RTADV_PREFERRED_LIFETIME)) {
} *req = buf;
const char *ifname = dplane_ctx_rule_get_ifname(ctx);
- char buf1[PREFIX_STRLEN];
- char buf2[PREFIX_STRLEN];
if (buflen < sizeof(*req))
return 0;
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "Tx %s family %s IF %s Pref %u Fwmark %u Src %s Dst %s Table %u",
+ "Tx %s family %s IF %s Pref %u Fwmark %u Src %pFX Dst %pFX Table %u",
nl_msg_type_to_str(cmd), nl_family_to_str(family),
- ifname, priority, fwmark,
- prefix2str(src_ip, buf1, sizeof(buf1)),
- prefix2str(dst_ip, buf2, sizeof(buf2)), table);
+ ifname, priority, fwmark, src_ip, dst_ip, table);
return NLMSG_ALIGN(req->n.nlmsg_len);
}
int len;
char *ifname;
struct zebra_pbr_rule rule = {};
- char buf1[PREFIX_STRLEN];
- char buf2[PREFIX_STRLEN];
uint8_t proto = 0;
/* Basic validation followed by extracting attributes. */
ret = dplane_pbr_rule_delete(&rule);
zlog_debug(
- "%s: %s leftover rule: family %s IF %s Pref %u Src %s Dst %s Table %u",
+ "%s: %s leftover rule: family %s IF %s Pref %u Src %pFX Dst %pFX Table %u",
__func__,
((ret == ZEBRA_DPLANE_REQUEST_FAILURE)
? "Failed to remove"
: "Removed"),
nl_family_to_str(frh->family), rule.ifname,
- rule.rule.priority,
- prefix2str(&rule.rule.filter.src_ip, buf1,
- sizeof(buf1)),
- prefix2str(&rule.rule.filter.dst_ip, buf2,
- sizeof(buf2)),
+ rule.rule.priority, &rule.rule.filter.src_ip,
+ &rule.rule.filter.dst_ip,
rule.rule.action.table);
}
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "Rx %s family %s IF %s Pref %u Src %s Dst %s Table %u",
+ "Rx %s family %s IF %s Pref %u Src %pFX Dst %pFX Table %u",
nl_msg_type_to_str(h->nlmsg_type),
nl_family_to_str(frh->family), rule.ifname,
- rule.rule.priority,
- prefix2str(&rule.rule.filter.src_ip, buf1,
- sizeof(buf1)),
- prefix2str(&rule.rule.filter.dst_ip, buf2,
- sizeof(buf2)),
- rule.rule.action.table);
+ rule.rule.priority, &rule.rule.filter.src_ip,
+ &rule.rule.filter.dst_ip, rule.rule.action.table);
return kernel_pbr_rule_del(&rule);
}
return -1;
}
- if (IS_ZEBRA_DEBUG_SEND) {
- char buf_prefix[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
-
- zlog_debug("%s: %s to client %s: type %s, vrf_id %d, p %s",
+ if (IS_ZEBRA_DEBUG_SEND)
+ zlog_debug("%s: %s to client %s: type %s, vrf_id %d, p %pFX",
__func__, zserv_command_string(cmd),
zebra_route_string(client->proto),
zebra_route_string(api.type), api.vrf_id,
- buf_prefix);
- }
+ &api.prefix);
return zserv_send_message(client, s);
}
client = zserv_find_client(type, instance);
if (!client || !client->notify_owner) {
- if (IS_ZEBRA_DEBUG_PACKET) {
- char buff[PREFIX_STRLEN];
-
+ if (IS_ZEBRA_DEBUG_PACKET)
zlog_debug(
- "Not Notifying Owner: %s about prefix %s(%u) %d vrf: %u",
- zebra_route_string(type),
- prefix2str(p, buff, sizeof(buff)), table_id,
- note, vrf_id);
- }
+ "Not Notifying Owner: %s about prefix %pFX(%u) %d vrf: %u",
+ zebra_route_string(type), p, table_id, note,
+ vrf_id);
return 0;
}
- if (IS_ZEBRA_DEBUG_PACKET) {
- char buff[PREFIX_STRLEN];
-
- zlog_debug("Notifying Owner: %s about prefix %s(%u) %d vrf: %u",
- zebra_route_string(type),
- prefix2str(p, buff, sizeof(buff)), table_id, note,
- vrf_id);
- }
+ if (IS_ZEBRA_DEBUG_PACKET)
+ zlog_debug(
+ "Notifying Owner: %s about prefix %pFX(%u) %d vrf: %u",
+ zebra_route_string(type), p, table_id, note, vrf_id);
s = stream_new(ZEBRA_MAX_PACKET_SIZ);
stream_reset(s);
vrf_id = zvrf_id(zvrf);
- if (IS_ZEBRA_DEBUG_RECV) {
- char buf_prefix[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
- zlog_debug("%s: p=(%u:%u)%s, msg flags=0x%x, flags=0x%x",
- __func__, vrf_id, api.tableid, buf_prefix,
+ if (IS_ZEBRA_DEBUG_RECV)
+ zlog_debug("%s: p=(%u:%u)%pFX, msg flags=0x%x, flags=0x%x",
+ __func__, vrf_id, api.tableid, &api.prefix,
(int)api.message, api.flags);
- }
/* Allocate new route. */
re = XCALLOC(MTYPE_RE, sizeof(struct route_entry));
else
table_id = zvrf->table_id;
- if (IS_ZEBRA_DEBUG_RECV) {
- char buf_prefix[PREFIX_STRLEN];
-
- prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
- zlog_debug("%s: p=(%u:%u)%s, msg flags=0x%x, flags=0x%x",
- __func__, zvrf_id(zvrf), table_id, buf_prefix,
+ if (IS_ZEBRA_DEBUG_RECV)
+ zlog_debug("%s: p=(%u:%u)%pFX, msg flags=0x%x, flags=0x%x",
+ __func__, zvrf_id(zvrf), table_id, &api.prefix,
(int)api.message, api.flags);
- }
rib_delete(afi, api.safi, zvrf_id(zvrf), api.type, api.instance,
api.flags, &api.prefix, src_p, NULL, 0, table_id, api.metric,
struct zebra_pbr_rule *new_rule,
struct zebra_pbr_rule *old_rule)
{
- if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) {
- char buf1[PREFIX_STRLEN];
- char buf2[PREFIX_STRLEN];
-
+ if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
zlog_debug(
- "init dplane ctx %s: IF %s Prio %u Fwmark %u Src %s Dst %s Table %u",
+ "init dplane ctx %s: IF %s Prio %u Fwmark %u Src %pFX Dst %pFX Table %u",
dplane_op2str(op), new_rule->ifname,
new_rule->rule.priority, new_rule->rule.filter.fwmark,
- prefix2str(&new_rule->rule.filter.src_ip, buf1,
- sizeof(buf1)),
- prefix2str(&new_rule->rule.filter.dst_ip, buf2,
- sizeof(buf2)),
+ &new_rule->rule.filter.src_ip,
+ &new_rule->rule.filter.dst_ip,
new_rule->rule.action.table);
- }
ctx->zd_op = op;
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
struct zebra_dplane_ctx *ctx = NULL;
struct zebra_ns *zns;
- if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) {
- char addr_str[PREFIX_STRLEN];
-
- prefix2str(ifc->address, addr_str, sizeof(addr_str));
-
- zlog_debug("init intf ctx %s: idx %d, addr %u:%s",
+ if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
+ zlog_debug("init intf ctx %s: idx %d, addr %u:%pFX",
dplane_op2str(op), ifp->ifindex, ifp->vrf_id,
- addr_str);
- }
+ ifc->address);
ctx = dplane_ctx_alloc();
case DPLANE_OP_ROUTE_INSTALL:
case DPLANE_OP_ROUTE_UPDATE:
case DPLANE_OP_ROUTE_DELETE:
- prefix2str(dplane_ctx_get_dest(ctx), buf, sizeof(buf));
-
- zlog_debug("%u:%s Dplane route update ctx %p op %s",
- dplane_ctx_get_vrf(ctx), buf, ctx,
- dplane_op2str(dplane_ctx_get_op(ctx)));
+ zlog_debug("%u:%pFX Dplane route update ctx %p op %s",
+ dplane_ctx_get_vrf(ctx), dplane_ctx_get_dest(ctx),
+ ctx, dplane_op2str(dplane_ctx_get_op(ctx)));
break;
case DPLANE_OP_NH_INSTALL:
case DPLANE_OP_ADDR_INSTALL:
case DPLANE_OP_ADDR_UNINSTALL:
- prefix2str(dplane_ctx_get_intf_addr(ctx), buf, sizeof(buf));
-
- zlog_debug("Dplane intf %s, idx %u, addr %s",
+ zlog_debug("Dplane intf %s, idx %u, addr %pFX",
dplane_op2str(dplane_ctx_get_op(ctx)),
- dplane_ctx_get_ifindex(ctx), buf);
+ dplane_ctx_get_ifindex(ctx),
+ dplane_ctx_get_intf_addr(ctx));
break;
case DPLANE_OP_MAC_INSTALL:
{
struct zserv *client = NULL;
struct stream *s = NULL;
- char buf[PREFIX_STRLEN];
client = zserv_find_client(ZEBRA_ROUTE_BGP, 0);
/* BGP may not be running. */
stream_putw_at(s, 0, stream_get_endp(s));
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Send ip prefix %s %s on vrf %s",
- prefix2str(p, buf, sizeof(buf)),
+ zlog_debug("Send ip prefix %pFX %s on vrf %s", p,
(cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) ? "ADD" : "DEL",
vrf_id_to_name(vrf_id));
static int zfpm_trigger_update(struct route_node *rn, const char *reason)
{
rib_dest_t *dest;
- char buf[PREFIX_STRLEN];
/*
* Ignore if the connection is down. We will update the FPM about
}
if (reason) {
- zfpm_debug("%s triggering update to FPM - Reason: %s",
- prefix2str(&rn->p, buf, sizeof(buf)), reason);
+ zfpm_debug("%pFX triggering update to FPM - Reason: %s", &rn->p,
+ reason);
}
SET_FLAG(dest->flags, RIB_DEST_UPDATE_FPM);
struct route_node *rn,
struct route_entry *re)
{
- char buf[PREFIX2STR_BUFFER];
-
if ((client == NULL) || (rn == NULL) || (re == NULL))
return;
/* If the route is not refreshed after restart, delete the entry */
if (re->uptime < client->restart_time) {
- if (IS_ZEBRA_DEBUG_RIB) {
- prefix2str(&rn->p, buf, sizeof(buf));
- zlog_debug("%s: Client %s stale route %s is deleted",
+ if (IS_ZEBRA_DEBUG_RIB)
+ zlog_debug("%s: Client %s stale route %pFX is deleted",
__func__, zebra_route_string(client->proto),
- buf);
- }
+ &rn->p);
rib_delnode(rn, re);
}
}
fec = fec_find(table, p);
if (!fec) {
- prefix2str(p, buf, BUFSIZ);
flog_err(EC_ZEBRA_FEC_RM_FAILED,
- "Failed to find FEC %s upon unregister, client %s",
- buf, zebra_route_string(client->proto));
+ "Failed to find FEC %pFX upon unregister, client %s",
+ p, zebra_route_string(client->proto));
return -1;
}
fec = fec_add(table, p, in_label, FEC_FLAG_CONFIGURED,
MPLS_INVALID_LABEL_INDEX);
if (!fec) {
- prefix2str(p, buf, BUFSIZ);
flog_err(EC_ZEBRA_FEC_ADD_FAILED,
- "Failed to add FEC %s upon config", buf);
+ "Failed to add FEC %pFX upon config", p);
return -1;
}
}
if (IS_ZEBRA_DEBUG_MPLS) {
- prefix2str(p, buf, BUFSIZ);
- zlog_debug("Delete fec %s label %u label index %u", buf,
+ zlog_debug("Delete fec %pFX label %u label index %u", p,
fec->label, fec->label_index);
}
struct route_node *rn;
int af;
zebra_fec_t *fec;
- char buf[BUFSIZ];
int write = 0;
for (af = AFI_IP; af < AFI_MAX; af++) {
continue;
write = 1;
- prefix2str(&rn->p, buf, BUFSIZ);
- vty_out(vty, "mpls label bind %s %s\n", buf,
+ vty_out(vty, "mpls label bind %pFX %s\n", &rn->p,
label2str(fec->label, lstr, BUFSIZ));
}
}
const struct zapi_labels *zl)
{
int i, counter, ret = 0;
- char buf[NEXTHOP_STRLEN], prefix_buf[PREFIX_STRLEN];
+ char buf[NEXTHOP_STRLEN];
const struct zapi_nexthop *znh;
struct route_table *table;
struct route_node *rn = NULL;
* attempted to manage LSPs before trying to
* find a route/FEC, so we'll continue that way.
*/
- if (IS_ZEBRA_DEBUG_RECV || IS_ZEBRA_DEBUG_MPLS) {
- prefix2str(prefix, prefix_buf,
- sizeof(prefix_buf));
- zlog_debug("%s: FTN update requested: no route for prefix %s",
- __func__, prefix_buf);
- }
+ if (IS_ZEBRA_DEBUG_RECV || IS_ZEBRA_DEBUG_MPLS)
+ zlog_debug(
+ "%s: FTN update requested: no route for prefix %pFX",
+ __func__, prefix);
}
}
counter++;
} else if (IS_ZEBRA_DEBUG_RECV | IS_ZEBRA_DEBUG_MPLS) {
zapi_nexthop2str(znh, buf, sizeof(buf));
- prefix2str(prefix, prefix_buf, sizeof(prefix_buf));
- zlog_debug("%s: Unable to update FEC: prefix %s, label %u, znh %s",
- __func__, prefix_buf, zl->local_label, buf);
+ zlog_debug(
+ "%s: Unable to update FEC: prefix %pFX, label %u, znh %s",
+ __func__, prefix, zl->local_label, buf);
}
}
counter++;
} else if (IS_ZEBRA_DEBUG_RECV | IS_ZEBRA_DEBUG_MPLS) {
zapi_nexthop2str(znh, buf, sizeof(buf));
- prefix2str(prefix, prefix_buf, sizeof(prefix_buf));
- zlog_debug("%s: Unable to update backup FEC: prefix %s, label %u, znh %s",
- __func__, prefix_buf, zl->local_label, buf);
+ zlog_debug(
+ "%s: Unable to update backup FEC: prefix %pFX, label %u, znh %s",
+ __func__, prefix, zl->local_label, buf);
}
}
#include "lib/log.h"
#include "lib/northbound.h"
+#include "lib/printfrr.h"
#include "libfrr.h"
#include "lib/command.h"
#include "lib/routemap.h"
{
struct interface *ifp;
struct prefix prefix;
- char buf[PREFIX_STRLEN] = {0};
ifp = nb_running_get_entry(args->dnode, NULL, true);
// addr_family = yang_dnode_get_enum(dnode, "./address-family");
case NB_EV_VALIDATE:
if (prefix.family == AF_INET
&& ipv4_martian(&prefix.u.prefix4)) {
- snprintf(args->errmsg, args->errmsg_len,
- "invalid address %s",
- prefix2str(&prefix, buf, sizeof(buf)));
+ snprintfrr(args->errmsg, args->errmsg_len,
+ "invalid address %pFX", &prefix);
return NB_ERR_VALIDATION;
} else if (prefix.family == AF_INET6
&& ipv6_martian(&prefix.u.prefix6)) {
- snprintf(args->errmsg, args->errmsg_len,
- "invalid address %s",
- prefix2str(&prefix, buf, sizeof(buf)));
+ snprintfrr(args->errmsg, args->errmsg_len,
+ "invalid address %pFX", &prefix);
return NB_ERR_VALIDATION;
}
break;
if (IS_ZEBRA_DEBUG_NHT_DETAILED) {
char buf1[PREFIX_STRLEN];
- char buf2[PREFIX_STRLEN];
zlog_debug(
- "%s(%u):%s has Nexthop(%s) Type: %s depending on it, evaluating %u:%u",
+ "%s(%u):%s has Nexthop(%pFX) Type: %s depending on it, evaluating %u:%u",
zvrf_name(zvrf), zvrf_id(zvrf),
srcdest_rnode2str(rn, buf1,
sizeof(buf1)),
- prefix2str(p, buf2, sizeof(buf2)),
- rnh_type2str(rnh->type), seq,
+ p, rnh_type2str(rnh->type), seq,
rnh->seqno);
}
zsend_route_notify_owner(re, dest_pfx,
ZAPI_ROUTE_FAIL_INSTALL);
- zlog_warn("%s(%u:%u):%s: Route install failed",
+ zlog_warn("%s(%u:%u):%pFX: Route install failed",
VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx),
- dplane_ctx_get_table(ctx),
- prefix2str(dest_pfx, dest_str,
- sizeof(dest_str)));
+ dplane_ctx_get_table(ctx), dest_pfx);
}
break;
case DPLANE_OP_ROUTE_DELETE:
zsend_route_notify_owner_ctx(ctx,
ZAPI_ROUTE_REMOVE_FAIL);
- zlog_warn("%s(%u:%u):%s: Route Deletion failure",
+ zlog_warn("%s(%u:%u):%pFX: Route Deletion failure",
VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx),
- dplane_ctx_get_table(ctx),
- prefix2str(dest_pfx, dest_str,
- sizeof(dest_str)));
+ dplane_ctx_get_table(ctx), dest_pfx);
}
/*
struct route_node *rn;
struct route_entry *re;
struct vrf *vrf;
- char prefix_buf[INET_ADDRSTRLEN];
vrf = vrf_lookup_by_id(vrf_id);
/* No route for this prefix. */
if (!rn) {
- zlog_debug("%s:%s(%u) lookup failed for %s", __func__,
- VRF_LOGNAME(vrf), vrf_id,
- prefix2str((struct prefix *)p, prefix_buf,
- sizeof(prefix_buf)));
+ zlog_debug("%s:%s(%u) lookup failed for %pFX", __func__,
+ VRF_LOGNAME(vrf), vrf_id, (struct prefix *)p);
return;
}
*/
if (dest->selected_fib) {
if (IS_ZEBRA_DEBUG_RIB) {
- char buf[PREFIX_STRLEN];
struct vrf *vrf =
vrf_lookup_by_id(dest->selected_fib->vrf_id);
zlog_debug(
- "%s(%u):%s: freeing way for connected prefix",
+ "%s(%u):%pFX: freeing way for connected prefix",
VRF_LOGNAME(vrf), dest->selected_fib->vrf_id,
- prefix2str(&rn->p, buf, sizeof(buf)));
+ &rn->p);
route_entry_dump(&rn->p, NULL, dest->selected_fib);
}
rib_uninstall(rn, dest->selected_fib);
/* Lookup nhe from route information */
nhe = zebra_nhg_rib_find_nhe(re_nhe, afi);
if (!nhe) {
- char buf[PREFIX_STRLEN] = "";
char buf2[PREFIX_STRLEN] = "";
flog_err(
EC_ZEBRA_TABLE_LOOKUP_FAILED,
- "Zebra failed to find or create a nexthop hash entry for %s%s%s",
- prefix2str(p, buf, sizeof(buf)),
- src_p ? " from " : "",
+ "Zebra failed to find or create a nexthop hash entry for %pFX%s%s",
+ p, src_p ? " from " : "",
src_p ? prefix2str(src_p, buf2, sizeof(buf2))
: "");
/* Lookup route node. */
rn = srcdest_rnode_lookup(table, p, src_p);
if (!rn) {
- char dst_buf[PREFIX_STRLEN], src_buf[PREFIX_STRLEN];
+ char src_buf[PREFIX_STRLEN];
- prefix2str(p, dst_buf, sizeof(dst_buf));
if (src_p && src_p->prefixlen)
prefix2str(src_p, src_buf, sizeof(src_buf));
else
if (IS_ZEBRA_DEBUG_RIB) {
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
- zlog_debug("%s[%d]:%s%s%s doesn't exist in rib",
- vrf->name, table_id, dst_buf,
+ zlog_debug("%s[%d]:%pFX%s%s doesn't exist in rib",
+ vrf->name, table_id, p,
(src_buf[0] != '\0') ? " from " : "",
src_buf);
}
{
int state_changed = 0;
struct zserv *client;
- char bufn[INET6_ADDRSTRLEN];
struct listnode *node;
zebra_rnh_remove_from_routing_table(rnh);
}
if (state_changed || force) {
- if (IS_ZEBRA_DEBUG_NHT) {
- prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
+ if (IS_ZEBRA_DEBUG_NHT)
zlog_debug("%s(%u):%pRN: Route import check %s %s",
VRF_LOGNAME(zvrf->vrf), zvrf->vrf->vrf_id,
nrn, rnh->state ? "passed" : "failed",
state_changed ? "(state changed)" : "");
- }
/* state changed, notify clients */
for (ALL_LIST_ELEMENTS_RO(rnh->client_list, node, client)) {
zebra_send_rnh_update(rnh, client,
rb_host_count(&n->host_rb));
vty_out(vty, " Prefixes:\n");
RB_FOREACH (hle, host_rb_tree_entry, &n->host_rb)
- vty_out(vty, " %s\n",
- prefix2str(&hle->p, buf2, sizeof(buf2)));
+ vty_out(vty, " %pFX\n", &hle->p);
} else {
json_hosts = json_object_new_array();
json_object_string_add(
vty_out(vty, " Refcount: %d\n", rb_host_count(&zrmac->host_rb));
vty_out(vty, " Prefixes:\n");
RB_FOREACH (hle, host_rb_tree_entry, &zrmac->host_rb)
- vty_out(vty, " %s\n",
- prefix2str(&hle->p, buf2, sizeof(buf2)));
+ vty_out(vty, " %pFX\n", &hle->p);
} else {
json_hosts = json_object_new_array();
json_object_string_add(
{
char buf[ETHER_ADDR_STRLEN];
char buf1[INET6_ADDRSTRLEN];
- char buf2[PREFIX_STRLEN];
zebra_mac_t *zrmac = NULL;
zrmac = zl3vni_rmac_lookup(zl3vni, rmac);
zrmac = zl3vni_rmac_add(zl3vni, rmac);
if (!zrmac) {
zlog_debug(
- "Failed to add RMAC %s L3VNI %u Remote VTEP %s, prefix %s",
+ "Failed to add RMAC %s L3VNI %u Remote VTEP %s, prefix %pFX",
prefix_mac2str(rmac, buf, sizeof(buf)),
zl3vni->vni,
ipaddr2str(vtep_ip, buf1, sizeof(buf1)),
- prefix2str(host_prefix, buf2, sizeof(buf2)));
+ host_prefix);
return -1;
}
memset(&zrmac->fwd_info, 0, sizeof(zrmac->fwd_info));
&vtep_ip->ipaddr_v4)) {
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
- "L3VNI %u Remote VTEP change(%s -> %s) for RMAC %s, prefix %s",
+ "L3VNI %u Remote VTEP change(%s -> %s) for RMAC %s, prefix %pFX",
zl3vni->vni,
inet_ntoa(zrmac->fwd_info.r_vtep_ip),
ipaddr2str(vtep_ip, buf1, sizeof(buf1)),
prefix_mac2str(rmac, buf, sizeof(buf)),
- prefix2str(host_prefix, buf2, sizeof(buf2)));
+ host_prefix);
zrmac->fwd_info.r_vtep_ip = vtep_ip->ipaddr_v4;
char buf[ETHER_ADDR_STRLEN];
char buf1[ETHER_ADDR_STRLEN];
char buf2[INET6_ADDRSTRLEN];
- char buf3[PREFIX_STRLEN];
zebra_neigh_t *nh = NULL;
/* Create the next hop entry, or update its mac, if necessary. */
nh = zl3vni_nh_add(zl3vni, vtep_ip, rmac);
if (!nh) {
zlog_debug(
- "Failed to add NH %s as Neigh (RMAC %s L3-VNI %u prefix %s)",
+ "Failed to add NH %s as Neigh (RMAC %s L3-VNI %u prefix %pFX)",
ipaddr2str(vtep_ip, buf1, sizeof(buf2)),
prefix_mac2str(rmac, buf, sizeof(buf)),
- zl3vni->vni,
- prefix2str(host_prefix, buf2, sizeof(buf2)));
+ zl3vni->vni, host_prefix);
return -1;
}
zl3vni_nh_install(zl3vni, nh);
} else if (memcmp(&nh->emac, rmac, ETH_ALEN) != 0) {
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("L3VNI %u RMAC change(%s --> %s) for nexthop %s, prefix %s",
- zl3vni->vni,
- prefix_mac2str(&nh->emac, buf, sizeof(buf)),
- prefix_mac2str(rmac, buf1, sizeof(buf1)),
- ipaddr2str(vtep_ip, buf2, sizeof(buf2)),
- prefix2str(host_prefix, buf3, sizeof(buf3)));
+ zlog_debug(
+ "L3VNI %u RMAC change(%s --> %s) for nexthop %s, prefix %pFX",
+ zl3vni->vni,
+ prefix_mac2str(&nh->emac, buf, sizeof(buf)),
+ prefix_mac2str(rmac, buf1, sizeof(buf1)),
+ ipaddr2str(vtep_ip, buf2, sizeof(buf2)),
+ host_prefix);
memcpy(&nh->emac, rmac, ETH_ALEN);
/* install (update) the nh neigh in kernel */
}
}
vty_out(vty, "Current AFI : %d\n", info->current_afi);
- if (info->current_prefix) {
- prefix2str(info->current_prefix, buf,
- sizeof(buf));
- vty_out(vty, "Current prefix : %s\n", buf);
- }
+ if (info->current_prefix)
+ vty_out(vty, "Current prefix : %pFX\n",
+ info->current_prefix);
}
}
vty_out(vty, "\n");