bgpd: Fixup buffer sizes for prefix_rd2str

The prefix_rd2str uses a buffer size of RD_ADDRSTRLEN.
Modify the code to consistently use this for all of BGP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-12-11 12:38:26 -05:00
parent 02d3243970
commit 06b9f471ab
7 changed files with 83 additions and 114 deletions

View File

@ -226,7 +226,7 @@ static void bgp_evpn_show_route_header(struct vty *vty, struct bgp *bgp,
static void display_vni(struct vty *vty, struct bgpevpn *vpn, json_object *json) static void display_vni(struct vty *vty, struct bgpevpn *vpn, json_object *json)
{ {
char buf1[INET6_ADDRSTRLEN]; char buf1[RD_ADDRSTRLEN];
char *ecom_str; char *ecom_str;
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct ecommunity *ecom; struct ecommunity *ecom;
@ -241,7 +241,7 @@ static void display_vni(struct vty *vty, struct bgpevpn *vpn, json_object *json)
is_vni_live(vpn) ? "Yes" : "No"); is_vni_live(vpn) ? "Yes" : "No");
json_object_string_add( json_object_string_add(
json, "rd", json, "rd",
prefix_rd2str(&vpn->prd, buf1, RD_ADDRSTRLEN)); prefix_rd2str(&vpn->prd, buf1, sizeof(buf1)));
json_object_string_add(json, "originatorIp", json_object_string_add(json, "originatorIp",
inet_ntoa(vpn->originator_ip)); inet_ntoa(vpn->originator_ip));
json_object_string_add(json, "advertiseGatewayMacip", json_object_string_add(json, "advertiseGatewayMacip",
@ -253,7 +253,7 @@ static void display_vni(struct vty *vty, struct bgpevpn *vpn, json_object *json)
vty_out(vty, "\n"); vty_out(vty, "\n");
vty_out(vty, " RD: %s\n", vty_out(vty, " RD: %s\n",
prefix_rd2str(&vpn->prd, buf1, RD_ADDRSTRLEN)); prefix_rd2str(&vpn->prd, buf1, sizeof(buf1)));
vty_out(vty, " Originator IP: %s\n", vty_out(vty, " Originator IP: %s\n",
inet_ntoa(vpn->originator_ip)); inet_ntoa(vpn->originator_ip));
vty_out(vty, " Advertise-gw-macip : %s\n", vty_out(vty, " Advertise-gw-macip : %s\n",
@ -419,7 +419,7 @@ static void show_vni_entry(struct hash_backet *backet, void *args[])
json_object *json_export_rtl; json_object *json_export_rtl;
struct bgpevpn *vpn = (struct bgpevpn *)backet->data; struct bgpevpn *vpn = (struct bgpevpn *)backet->data;
char buf1[10]; char buf1[10];
char buf2[INET6_ADDRSTRLEN]; char buf2[RD_ADDRSTRLEN];
char rt_buf[25]; char rt_buf[25];
char *ecom_str; char *ecom_str;
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -446,11 +446,11 @@ static void show_vni_entry(struct hash_backet *backet, void *args[])
inet_ntoa(vpn->originator_ip)); inet_ntoa(vpn->originator_ip));
json_object_string_add( json_object_string_add(
json_vni, "rd", json_vni, "rd",
prefix_rd2str(&vpn->prd, buf2, RD_ADDRSTRLEN)); prefix_rd2str(&vpn->prd, buf2, sizeof(buf2)));
} else { } else {
vty_out(vty, "%-1s %-10u %-15s %-21s", buf1, vpn->vni, vty_out(vty, "%-1s %-10u %-15s %-21s", buf1, vpn->vni,
inet_ntoa(vpn->originator_ip), inet_ntoa(vpn->originator_ip),
prefix_rd2str(&vpn->prd, buf2, RD_ADDRSTRLEN)); prefix_rd2str(&vpn->prd, buf2, sizeof(buf2)));
} }
for (ALL_LIST_ELEMENTS(vpn->import_rtl, node, nnode, ecom)) { for (ALL_LIST_ELEMENTS(vpn->import_rtl, node, nnode, ecom)) {
@ -2093,7 +2093,7 @@ static void evpn_unset_advertise_all_vni(struct bgp *bgp)
static void write_vni_config(struct vty *vty, struct bgpevpn *vpn) static void write_vni_config(struct vty *vty, struct bgpevpn *vpn)
{ {
char buf1[INET6_ADDRSTRLEN]; char buf1[RD_ADDRSTRLEN];
char *ecom_str; char *ecom_str;
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct ecommunity *ecom; struct ecommunity *ecom;
@ -2102,7 +2102,7 @@ static void write_vni_config(struct vty *vty, struct bgpevpn *vpn)
vty_out(vty, " vni %d\n", vpn->vni); vty_out(vty, " vni %d\n", vpn->vni);
if (is_rd_configured(vpn)) if (is_rd_configured(vpn))
vty_out(vty, " rd %s\n", vty_out(vty, " rd %s\n",
prefix_rd2str(&vpn->prd, buf1, RD_ADDRSTRLEN)); prefix_rd2str(&vpn->prd, buf1, sizeof(buf1)));
if (is_import_rt_configured(vpn)) { if (is_import_rt_configured(vpn)) {
for (ALL_LIST_ELEMENTS(vpn->import_rtl, node, nnode, for (ALL_LIST_ELEMENTS(vpn->import_rtl, node, nnode,

View File

@ -7388,7 +7388,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
vty_out(vty, " Imported from %s:%s\n", vty_out(vty, " Imported from %s:%s\n",
prefix_rd2str( prefix_rd2str(
(struct prefix_rd *)&prn->p, (struct prefix_rd *)&prn->p,
buf1, RD_ADDRSTRLEN), buf1, sizeof(buf1)),
buf2); buf2);
} }
} }
@ -7601,7 +7601,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
json_peer, "routerId", json_peer, "routerId",
inet_ntop(AF_INET, inet_ntop(AF_INET,
&binfo->peer->remote_id, buf1, &binfo->peer->remote_id, buf1,
BUFSIZ)); sizeof(buf1)));
if (binfo->peer->hostname) if (binfo->peer->hostname)
json_object_string_add( json_object_string_add(
@ -7655,7 +7655,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
inet_ntop( inet_ntop(
AF_INET, AF_INET,
&binfo->peer->remote_id, &binfo->peer->remote_id,
buf1, BUFSIZ)); buf1, sizeof(buf1)));
} }
} }
@ -8447,13 +8447,10 @@ int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,
continue; continue;
if (rn->info != NULL) { if (rn->info != NULL) {
struct prefix_rd prd; struct prefix_rd prd;
char rd[BUFSIZ]; char rd[RD_ADDRSTRLEN];
memcpy(&prd, &(rn->p), sizeof(struct prefix_rd)); memcpy(&prd, &(rn->p), sizeof(struct prefix_rd));
if (prefix_rd2str(&prd, rd, BUFSIZ) == NULL) prefix_rd2str(&prd, rd, sizeof(rd));
sprintf(rd,
"Unknown Type: %u",
decode_rd_type(prd.val));
bgp_show_table(vty, bgp, safi, rn->info, type, bgp_show_table(vty, bgp, safi, rn->info, type,
output_arg, use_json, output_arg, use_json,
rd, next == NULL, rd, next == NULL,
@ -8539,7 +8536,7 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
struct prefix *p; struct prefix *p;
struct peer *peer; struct peer *peer;
struct listnode *node, *nnode; struct listnode *node, *nnode;
char buf1[INET6_ADDRSTRLEN]; char buf1[RD_ADDRSTRLEN];
char buf2[INET6_ADDRSTRLEN]; char buf2[INET6_ADDRSTRLEN];
#if defined(HAVE_CUMULUS) #if defined(HAVE_CUMULUS)
char buf3[EVPN_ROUTE_STRLEN]; char buf3[EVPN_ROUTE_STRLEN];
@ -8573,7 +8570,7 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
#if defined(HAVE_CUMULUS) #if defined(HAVE_CUMULUS)
if (safi == SAFI_EVPN) if (safi == SAFI_EVPN)
vty_out(vty, "BGP routing table entry for %s%s%s\n", vty_out(vty, "BGP routing table entry for %s%s%s\n",
prd ? prefix_rd2str(prd, buf1, RD_ADDRSTRLEN) prd ? prefix_rd2str(prd, buf1, sizeof(buf1))
: "", : "",
prd ? ":" : "", prd ? ":" : "",
bgp_evpn_route2str((struct prefix_evpn *)p, bgp_evpn_route2str((struct prefix_evpn *)p,
@ -8582,7 +8579,7 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
vty_out(vty, "BGP routing table entry for %s%s%s/%d\n", vty_out(vty, "BGP routing table entry for %s%s%s/%d\n",
((safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP) ((safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP)
? prefix_rd2str(prd, buf1, ? prefix_rd2str(prd, buf1,
RD_ADDRSTRLEN) sizeof(buf1))
: ""), : ""),
safi == SAFI_MPLS_VPN ? ":" : "", safi == SAFI_MPLS_VPN ? ":" : "",
inet_ntop(p->family, &p->u.prefix, buf2, inet_ntop(p->family, &p->u.prefix, buf2,
@ -8597,8 +8594,8 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
vty_out(vty, "BGP routing table entry for %s%s%s/%d\n", vty_out(vty, "BGP routing table entry for %s%s%s/%d\n",
((safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP ((safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP
|| safi == SAFI_EVPN) || safi == SAFI_EVPN)
? prefix_rd2str(prd, buf1, RD_ADDRSTRLEN) ? prefix_rd2str(prd, buf1, sizeof(buf1))
: ""), : ""),
((safi == SAFI_MPLS_VPN) || (safi == SAFI_EVPN)) ? ":" ((safi == SAFI_MPLS_VPN) || (safi == SAFI_EVPN)) ? ":"
: "", : "",
buf2, p->prefixlen); buf2, p->prefixlen);
@ -11144,7 +11141,7 @@ static void bgp_config_write_network_vpn(struct vty *vty, struct bgp *bgp,
prd = (struct prefix_rd *)&prn->p; prd = (struct prefix_rd *)&prn->p;
/* "network" configuration display. */ /* "network" configuration display. */
prefix_rd2str(prd, rdbuf, RD_ADDRSTRLEN); prefix_rd2str(prd, rdbuf, sizeof(rdbuf));
label = decode_label(&bgp_static->label); label = decode_label(&bgp_static->label);
vty_out(vty, " network %s/%d rd %s", vty_out(vty, " network %s/%d rd %s",
@ -11201,7 +11198,7 @@ static void bgp_config_write_network_evpn(struct vty *vty, struct bgp *bgp,
prd = (struct prefix_rd *)&prn->p; prd = (struct prefix_rd *)&prn->p;
/* "network" configuration display. */ /* "network" configuration display. */
prefix_rd2str(prd, rdbuf, RD_ADDRSTRLEN); prefix_rd2str(prd, rdbuf, sizeof(rdbuf));
if (p->u.prefix_evpn.route_type == 5) { if (p->u.prefix_evpn.route_type == 5) {
char local_buf[PREFIX_STRLEN]; char local_buf[PREFIX_STRLEN];
uint8_t family = IS_EVPN_PREFIX_IPADDR_V4((struct prefix_evpn *)p) uint8_t family = IS_EVPN_PREFIX_IPADDR_V4((struct prefix_evpn *)p)

View File

@ -3884,8 +3884,7 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
} }
if (rfg->rd.prefixlen) { if (rfg->rd.prefixlen) {
char buf[BUFSIZ]; char buf[RD_ADDRSTRLEN];
buf[0] = buf[BUFSIZ - 1] = 0;
if (AF_UNIX == rfg->rd.family) { if (AF_UNIX == rfg->rd.family) {
@ -3898,18 +3897,10 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
vty_out(vty, " rd auto:nh:%d\n", vty_out(vty, " rd auto:nh:%d\n",
value); value);
} else { } else
vty_out(vty, " rd %s\n",
if (!prefix_rd2str(&rfg->rd, buf, prefix_rd2str(&rfg->rd, buf,
BUFSIZ) sizeof(buf)));
|| !buf[0] || buf[BUFSIZ - 1]) {
vty_out(vty,
"!Error: Can't convert rd\n");
} else {
vty_out(vty, " rd %s\n", buf);
}
}
} }
if (rfg->rt_import_list && rfg->rt_export_list if (rfg->rt_import_list && rfg->rt_export_list
@ -4107,8 +4098,7 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
vty_out(vty, " vnc defaults\n"); vty_out(vty, " vnc defaults\n");
if (hc->default_rd.prefixlen) { if (hc->default_rd.prefixlen) {
char buf[BUFSIZ]; char buf[RD_ADDRSTRLEN];
buf[0] = buf[BUFSIZ - 1] = 0;
if (AF_UNIX == hc->default_rd.family) { if (AF_UNIX == hc->default_rd.family) {
uint16_t value = 0; uint16_t value = 0;
@ -4121,18 +4111,11 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
vty_out(vty, " rd auto:vn:%d\n", vty_out(vty, " rd auto:vn:%d\n",
value); value);
} else { } else
vty_out(vty, " rd %s\n",
if (!prefix_rd2str(&hc->default_rd, buf, prefix_rd2str(&hc->default_rd,
BUFSIZ) buf,
|| !buf[0] || buf[BUFSIZ - 1]) { sizeof(buf)));
vty_out(vty,
"!Error: Can't convert rd\n");
} else {
vty_out(vty, " rd %s\n", buf);
}
}
} }
if (hc->default_response_lifetime) { if (hc->default_response_lifetime) {
vty_out(vty, " response-lifetime "); vty_out(vty, " response-lifetime ");
@ -4206,8 +4189,7 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
if (rfg->rd.prefixlen) { if (rfg->rd.prefixlen) {
char buf[BUFSIZ]; char buf[RD_ADDRSTRLEN];
buf[0] = buf[BUFSIZ - 1] = 0;
if (AF_UNIX == rfg->rd.family) { if (AF_UNIX == rfg->rd.family) {
@ -4222,21 +4204,12 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
" rd auto:vn:%d\n", " rd auto:vn:%d\n",
value); value);
} else { } else
vty_out(vty,
if (!prefix_rd2str(&rfg->rd, " rd %s\n",
buf, BUFSIZ) prefix_rd2str(&rfg->rd,
|| !buf[0] buf,
|| buf[BUFSIZ - 1]) { sizeof(buf)));
vty_out(vty,
"!Error: Can't convert rd\n");
} else {
vty_out(vty,
" rd %s\n",
buf);
}
}
} }
if (rfg->flags & RFAPI_RFG_RESPONSE_LIFETIME) { if (rfg->flags & RFAPI_RFG_RESPONSE_LIFETIME) {
vty_out(vty, " response-lifetime "); vty_out(vty, " response-lifetime ");

View File

@ -364,11 +364,10 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
struct bgp_node *bn; struct bgp_node *bn;
struct bgp_info *bi; struct bgp_info *bi;
char buf[PREFIX_STRLEN]; char buf[PREFIX_STRLEN];
char buf2[BUFSIZ]; char buf2[RD_ADDRSTRLEN];
struct prefix_rd prd0; struct prefix_rd prd0;
prefix2str(p, buf, sizeof(buf)); prefix2str(p, buf, sizeof(buf));
prefix_rd2str(prd, buf2, sizeof(buf2));
afi = family2afi(p->family); afi = family2afi(p->family);
assert(afi == AFI_IP || afi == AFI_IP6); assert(afi == AFI_IP || afi == AFI_IP6);
@ -383,7 +382,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: peer=%p, prefix=%s, prd=%s afi=%d, safi=%d bn=%p, bn->info=%p", "%s: peer=%p, prefix=%s, prd=%s afi=%d, safi=%d bn=%p, bn->info=%p",
__func__, peer, buf, buf2, afi, safi, bn, __func__, peer, buf,
prefix_rd2str(prd, buf2, sizeof(buf2)), afi, safi, bn,
(bn ? bn->info : NULL)); (bn ? bn->info : NULL));
for (bi = (bn ? bn->info : NULL); bi; bi = bi->next) { for (bi = (bn ? bn->info : NULL); bi; bi = bi->next) {
@ -589,7 +589,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
struct bgp_attr_encap_subtlv *encaptlv; struct bgp_attr_encap_subtlv *encaptlv;
char buf[PREFIX_STRLEN]; char buf[PREFIX_STRLEN];
char buf2[BUFSIZ]; char buf2[RD_ADDRSTRLEN];
#if 0 /* unused? */ #if 0 /* unused? */
struct prefix pfx_buf; struct prefix pfx_buf;
#endif #endif
@ -3831,12 +3831,10 @@ int rfapi_set_autord_from_vn(struct prefix_rd *rd, struct rfapi_ip_addr *vn)
4); /* low order 4 bytes */ 4); /* low order 4 bytes */
} }
{ {
char buf[BUFSIZ]; char buf[RD_ADDRSTRLEN];
buf[0] = 0;
prefix_rd2str(rd, buf, BUFSIZ);
buf[BUFSIZ - 1] = 0;
vnc_zlog_debug_verbose("%s: auto-RD is set to %s", __func__, vnc_zlog_debug_verbose("%s: auto-RD is set to %s", __func__,
buf); prefix_rd2str(rd, buf, sizeof(buf)));
} }
return 0; return 0;
} }

View File

@ -41,6 +41,7 @@
#include "bgpd/bgp_route.h" #include "bgpd/bgp_route.h"
#include "bgpd/bgp_mplsvpn.h" /* prefix_rd2str() */ #include "bgpd/bgp_mplsvpn.h" /* prefix_rd2str() */
#include "bgpd/bgp_vnc_types.h" #include "bgpd/bgp_vnc_types.h"
#include "bgpd/bgp_rd.h"
#include "bgpd/rfapi/rfapi.h" #include "bgpd/rfapi/rfapi.h"
#include "bgpd/rfapi/bgp_rfapi_cfg.h" #include "bgpd/rfapi/bgp_rfapi_cfg.h"
@ -2132,10 +2133,12 @@ static void rfapiItBiIndexAdd(struct route_node *rn, /* Import table VPN node */
assert(bi->extra); assert(bi->extra);
{ {
char buf[BUFSIZ]; char buf[RD_ADDRSTRLEN];
prefix_rd2str(&bi->extra->vnc.import.rd, buf, BUFSIZ);
vnc_zlog_debug_verbose("%s: bi %p, peer %p, rd %s", __func__, vnc_zlog_debug_verbose("%s: bi %p, peer %p, rd %s", __func__,
bi, bi->peer, buf); bi, bi->peer,
prefix_rd2str(&bi->extra->vnc.import.rd,
buf, sizeof(buf)));
} }
sl = RFAPI_RDINDEX_W_ALLOC(rn); sl = RFAPI_RDINDEX_W_ALLOC(rn);
@ -2169,18 +2172,15 @@ static void rfapiItBiIndexDump(struct route_node *rn)
for (rc = skiplist_next(sl, (void **)&k, (void **)&v, &cursor); !rc; for (rc = skiplist_next(sl, (void **)&k, (void **)&v, &cursor); !rc;
rc = skiplist_next(sl, (void **)&k, (void **)&v, &cursor)) { rc = skiplist_next(sl, (void **)&k, (void **)&v, &cursor)) {
char buf[BUFSIZ]; char buf[RD_ADDRSTRLEN];
char buf_aux_pfx[PREFIX_STRLEN]; char buf_aux_pfx[PREFIX_STRLEN];
prefix_rd2str(&k->extra->vnc.import.rd, buf, BUFSIZ); prefix_rd2str(&k->extra->vnc.import.rd, buf, sizeof(buf));
buf_aux_pfx[0] = 0;
if (k->extra->vnc.import.aux_prefix.family) { if (k->extra->vnc.import.aux_prefix.family) {
prefix2str(&k->extra->vnc.import.aux_prefix, prefix2str(&k->extra->vnc.import.aux_prefix,
buf_aux_pfx, sizeof(buf)); buf_aux_pfx, sizeof(buf_aux_pfx));
} else { } else
strncpy(buf_aux_pfx, "(none)", PREFIX_STRLEN); strncpy(buf_aux_pfx, "(none)", PREFIX_STRLEN);
buf_aux_pfx[PREFIX_STRLEN - 1] = 0;
}
vnc_zlog_debug_verbose("bi %p, peer %p, rd %s, aux_prefix %s", vnc_zlog_debug_verbose("bi %p, peer %p, rd %s, aux_prefix %s",
k, k->peer, buf, buf_aux_pfx); k, k->peer, buf, buf_aux_pfx);
@ -2204,20 +2204,19 @@ static struct bgp_info *rfapiItBiIndexSearch(
#if DEBUG_BI_SEARCH #if DEBUG_BI_SEARCH
{ {
char buf[BUFSIZ]; char buf[RD_ADDRSTRLEN];
char buf_aux_pfx[PREFIX_STRLEN]; char buf_aux_pfx[PREFIX_STRLEN];
prefix_rd2str(prd, buf, BUFSIZ);
if (aux_prefix) { if (aux_prefix) {
prefix2str(aux_prefix, buf_aux_pfx, prefix2str(aux_prefix, buf_aux_pfx,
sizeof(buf_aux_pfx)); sizeof(buf_aux_pfx));
} else { } else
strncpy(buf_aux_pfx, "(nil)", BUFSIZ - 1); strncpy(buf_aux_pfx, "(nil)", sizeof(buf_aux_pfx));
buf_aux_pfx[BUFSIZ - 1] = 0;
}
vnc_zlog_debug_verbose("%s want prd=%s, peer=%p, aux_prefix=%s", vnc_zlog_debug_verbose("%s want prd=%s, peer=%p, aux_prefix=%s",
__func__, buf, peer, buf_aux_pfx); __func__,
prefix_rd2str(prd, buf, sizeof(buf)),
peer, buf_aux_pfx);
rfapiItBiIndexDump(rn); rfapiItBiIndexDump(rn);
} }
#endif #endif
@ -2232,12 +2231,14 @@ static struct bgp_info *rfapiItBiIndexSearch(
bi_result = bi_result->next) { bi_result = bi_result->next) {
#if DEBUG_BI_SEARCH #if DEBUG_BI_SEARCH
{ {
char buf[BUFSIZ]; char buf[RD_ADDRSTRLEN];
prefix_rd2str(&bi_result->extra->vnc.import.rd,
buf, BUFSIZ);
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: bi has prd=%s, peer=%p", __func__, "%s: bi has prd=%s, peer=%p", __func__,
buf, bi_result->peer); prefix_rd2str(&bi_result->extra->vnc.import.rd,
buf,
sizeof(buf)),
bi_result->peer);
} }
#endif #endif
if (peer == bi_result->peer if (peer == bi_result->peer
@ -2300,10 +2301,12 @@ static void rfapiItBiIndexDel(struct route_node *rn, /* Import table VPN node */
int rc; int rc;
{ {
char buf[BUFSIZ]; char buf[RD_ADDRSTRLEN];
prefix_rd2str(&bi->extra->vnc.import.rd, buf, BUFSIZ);
vnc_zlog_debug_verbose("%s: bi %p, peer %p, rd %s", __func__, vnc_zlog_debug_verbose("%s: bi %p, peer %p, rd %s", __func__,
bi, bi->peer, buf); bi, bi->peer,
prefix_rd2str(&bi->extra->vnc.import.rd,
buf, sizeof(buf)));
} }
sl = RFAPI_RDINDEX(rn); sl = RFAPI_RDINDEX(rn);

View File

@ -1123,7 +1123,7 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
} else { } else {
char buf_rd[BUFSIZ]; char buf_rd[RD_ADDRSTRLEN];
/* not found: add new route to RIB */ /* not found: add new route to RIB */
ori = rfapi_info_new(); ori = rfapi_info_new();
@ -1402,13 +1402,14 @@ callback:
ri->last_sent_time = rfapi_time(NULL); ri->last_sent_time = rfapi_time(NULL);
#if DEBUG_RIB_SL_RD #if DEBUG_RIB_SL_RD
{ {
char buf_rd[BUFSIZ]; char buf_rd[RD_ADDRSTRLEN];
prefix_rd2str(&ri->rk.rd,
buf_rd,
sizeof(buf_rd));
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: move route to recently deleted list, rd=%s", "%s: move route to recently deleted list, rd=%s",
__func__, buf_rd); __func__,
prefix_rd2str(&ri->rk.rd,
buf_rd,
sizeof(buf_rd)));
} }
#endif #endif
@ -2293,7 +2294,7 @@ static int print_rib_sl(int (*fp)(void *, const char *, ...), struct vty *vty,
char str_lifetime[BUFSIZ]; char str_lifetime[BUFSIZ];
char str_age[BUFSIZ]; char str_age[BUFSIZ];
char *p; char *p;
char str_rd[BUFSIZ]; char str_rd[RD_ADDRSTRLEN];
++routes_displayed; ++routes_displayed;
@ -2323,11 +2324,10 @@ static int print_rib_sl(int (*fp)(void *, const char *, ...), struct vty *vty,
str_rd[0] = 0; /* start empty */ str_rd[0] = 0; /* start empty */
#if DEBUG_RIB_SL_RD #if DEBUG_RIB_SL_RD
str_rd[0] = ' '; prefix_rd2str(&ri->rk.rd, str_rd, sizeof(str_rd));
prefix_rd2str(&ri->rk.rd, str_rd + 1, BUFSIZ - 1);
#endif #endif
fp(out, " %c %-20s %-15s %-15s %-4u %-8s %-8s%s\n", fp(out, " %c %-20s %-15s %-15s %-4u %-8s %-8s %s\n",
deleted ? 'r' : ' ', *printedprefix ? "" : str_pfx, str_vn, deleted ? 'r' : ' ', *printedprefix ? "" : str_pfx, str_vn,
str_un, ri->cost, str_lifetime, str_age, str_rd); str_un, ri->cost, str_lifetime, str_age, str_rd);

View File

@ -1527,11 +1527,9 @@ void rfapiPrintRfapiIpPrefix(void *stream, struct rfapi_ip_prefix *p)
void rfapiPrintRd(struct vty *vty, struct prefix_rd *prd) void rfapiPrintRd(struct vty *vty, struct prefix_rd *prd)
{ {
char buf[BUFSIZ]; char buf[RD_ADDRSTRLEN];
buf[0] = 0;
prefix_rd2str(prd, buf, BUFSIZ); prefix_rd2str(prd, buf, BUFSIZ);
buf[BUFSIZ - 1] = 0;
vty_out(vty, "%s", buf); vty_out(vty, "%s", buf);
} }