struct peer *onlypeer;
struct bgp *bgp;
struct attr *piattr;
- char buf[PREFIX_STRLEN];
route_map_result_t ret;
int transparent;
int reflect;
* though they can have peer pointers that reference other
* systems
*/
- prefix2str(p, buf, PREFIX_STRLEN);
- zlog_debug("%s: pfx %s bgp_direct->vpn route peer safe",
- __func__, buf);
+ zlog_debug("%s: pfx %pFX bgp_direct->vpn route peer safe",
+ __func__, p);
samepeer_safe = 1;
}
#endif
mpls_label_t label = bgp_adv_label(dest, pi, peer, afi, safi);
if (!bgp_is_valid_label(&label)) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
- zlog_debug("u%" PRIu64 ":s%" PRIu64" %s/%d is filtered - no label (%p)",
+ zlog_debug("u%" PRIu64 ":s%" PRIu64
+ " %pFX is filtered - no label (%p)",
subgrp->update_group->id, subgrp->id,
- inet_ntop(p->family, &p->u.prefix,
- buf, SU_ADDRSTRLEN),
- p->prefixlen, &label);
+ p, &label);
return false;
}
}
&& (IPV4_ADDR_SAME(&onlypeer->remote_id, &piattr->originator_id))) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug(
- "%s [Update:SEND] %s originator-id is same as remote router-id",
- onlypeer->host,
- prefix2str(p, buf, sizeof(buf)));
+ "%s [Update:SEND] %pFX originator-id is same as remote router-id",
+ onlypeer->host, p);
return false;
}
if (bgp_debug_update(NULL, p,
subgrp->update_group, 0))
zlog_debug(
- "%s [Update:SEND] %s is filtered via ORF",
- peer->host,
- prefix2str(p, buf,
- sizeof(buf)));
+ "%s [Update:SEND] %pFX is filtered via ORF",
+ peer->host, p);
return false;
}
}
/* Output filter check. */
if (bgp_output_filter(peer, p, piattr, afi, safi) == FILTER_DENY) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
- zlog_debug("%s [Update:SEND] %s is filtered",
- peer->host, prefix2str(p, buf, sizeof(buf)));
+ zlog_debug("%s [Update:SEND] %pFX is filtered",
+ peer->host, p);
return false;
}
if (ret == RMAP_DENYMATCH) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
- zlog_debug("%s [Update:SEND] %s is filtered by route-map",
- peer->host, prefix2str(p, buf, sizeof(buf)));
+ zlog_debug(
+ "%s [Update:SEND] %pFX is filtered by route-map",
+ peer->host, p);
bgp_attr_flush(attr);
return false;
if (debug) {
bgp_path_info_path_with_addpath_rx_str(
new_select, path_buf);
- zlog_debug("%s: %s is the bestpath from AS %u",
- pfx_buf, path_buf,
- aspath_get_first_as(
- new_select->attr->aspath));
+ zlog_debug(
+ "%pBD: %s is the bestpath from AS %u",
+ dest, path_buf,
+ aspath_get_first_as(
+ new_select->attr->aspath));
}
}
}
else
snprintf(path_buf, sizeof(path_buf), "NONE");
zlog_debug(
- "%s: After path selection, newbest is %s oldbest was %s",
- pfx_buf, path_buf,
+ "%pBD: After path selection, newbest is %s oldbest was %s",
+ dest, path_buf,
old_select ? old_select->peer->host : "NONE");
}
if (pi == new_select) {
if (debug)
zlog_debug(
- "%s: %s is the bestpath, add to the multipath list",
- pfx_buf, path_buf);
+ "%pBD: %s is the bestpath, add to the multipath list",
+ dest, path_buf);
bgp_mp_list_add(&mp_list, pi);
continue;
}
if (!bgp_path_info_nexthop_cmp(pi, new_select)) {
if (debug)
zlog_debug(
- "%s: %s has the same nexthop as the bestpath, skip it",
- pfx_buf, path_buf);
+ "%pBD: %s has the same nexthop as the bestpath, skip it",
+ dest, path_buf);
continue;
}
if (paths_eq) {
if (debug)
zlog_debug(
- "%s: %s is equivalent to the bestpath, add to the multipath list",
- pfx_buf, path_buf);
+ "%pBD: %s is equivalent to the bestpath, add to the multipath list",
+ dest, path_buf);
bgp_mp_list_add(&mp_list, pi);
}
}
if (p->family == AF_INET) {
if (!json) {
- len = vty_out(
- vty, "%s/%d",
- inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ),
- p->prefixlen);
+ len = vty_out(vty, "%pFX", p);
} else {
json_object_string_add(json, "prefix",
inet_ntop(p->family,
}
} else if (p->family == AF_ETHERNET) {
prefix2str(p, buf, PREFIX_STRLEN);
- len = vty_out(vty, "%s", buf);
+ len = vty_out(vty, "%pFX", p);
} else if (p->family == AF_EVPN) {
if (!json)
len = vty_out(
NLRI_STRING_FORMAT_MIN, json);
} else {
if (!json)
- len = vty_out(
- vty, "%s/%d",
- inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ),
- p->prefixlen);
+ len = vty_out(vty, "%pFX", p);
else {
json_object_string_add(json, "prefix",
inet_ntop(p->family,
struct peer *peer;
struct listnode *node, *nnode;
char buf1[RD_ADDRSTRLEN];
- char buf2[INET6_ADDRSTRLEN];
char buf3[EVPN_ROUTE_STRLEN];
char prefix_str[BUFSIZ];
int count = 0;
}
} else {
if (!json) {
- vty_out(vty, "BGP routing table entry for %s%s%s/%d\n",
+ vty_out(vty, "BGP routing table entry for %s%s%pFX\n",
((safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP)
- ? prefix_rd2str(prd, buf1,
- sizeof(buf1))
- : ""),
- safi == SAFI_MPLS_VPN ? ":" : "",
- inet_ntop(p->family, &p->u.prefix, buf2,
- INET6_ADDRSTRLEN),
- p->prefixlen);
+ ? prefix_rd2str(prd, buf1,
+ sizeof(buf1))
+ : ""),
+ safi == SAFI_MPLS_VPN ? ":" : "", p);
} else
json_object_string_add(json, "prefix",
const struct prefix_rd *prd;
struct bgp_static *bgp_static;
mpls_label_t label;
- char buf[SU_ADDRSTRLEN];
char rdbuf[RD_ADDRSTRLEN];
/* Network configuration. */
prefix_rd2str(prd, rdbuf, sizeof(rdbuf));
label = decode_label(&bgp_static->label);
- vty_out(vty, " network %s/%d rd %s",
- inet_ntop(p->family, &p->u.prefix, buf,
- SU_ADDRSTRLEN),
- p->prefixlen, rdbuf);
+ vty_out(vty, " network %pFX rd %s", p, rdbuf);
if (safi == SAFI_MPLS_VPN)
vty_out(vty, " label %u", label);
const struct prefix *p;
struct bgp_static *bgp_static;
struct bgp_aggregate *bgp_aggregate;
- char buf[SU_ADDRSTRLEN];
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)) {
bgp_config_write_network_vpn(vty, bgp, afi, safi);
p = bgp_dest_get_prefix(dest);
- vty_out(vty, " network %s/%d",
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ vty_out(vty, " network %pFX", p);
if (bgp_static->label_index != BGP_INVALID_LABEL_INDEX)
vty_out(vty, " label-index %u",
p = bgp_dest_get_prefix(dest);
- vty_out(vty, " aggregate-address %s/%d",
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ vty_out(vty, " aggregate-address %pFX", p);
if (bgp_aggregate->as_set)
vty_out(vty, " as-set");