#include "bgpd/bgp_route.h"
#include "bgpd/bgp_mplsvpn.h" /* prefix_rd2str() */
#include "bgpd/bgp_vnc_types.h"
+#include "bgpd/bgp_rd.h"
#include "bgpd/rfapi/rfapi.h"
#include "bgpd/rfapi/bgp_rfapi_cfg.h"
rfapi_time(&new->extra->vnc.import.create_time);
}
if (label)
- encode_label(*label, &new->extra->label);
+ encode_label(*label, &new->extra->label[0]);
new->type = type;
new->sub_type = sub_type;
new->peer = peer;
#if DEBUG_MONITOR_MOVE_SHORTER
{
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- prefix2str(&original_vpn_node->p, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0;
+ prefix2str(&original_vpn_node->p, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: called with node pfx=%s", __func__,
buf);
}
#if DEBUG_MONITOR_MOVE_SHORTER
{
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- prefix2str(&par->p, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0;
+ prefix2str(&par->p, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: moved to node pfx=%s", __func__,
buf);
}
} else if (encode == ECOMMUNITY_ENCODE_AS) {
as = (*p++ << 8);
as |= (*p++);
- p +=
- 2; /* skip next two, tag/vid
- always in lowest bytes */
+ p += 2; /* skip next two, tag/vid
+ always in lowest bytes */
}
if (as == bgp->as) {
*tag_id = *p++ << 8;
switch (pfx_un1.family) {
case AF_INET:
- if (!IPV4_ADDR_SAME(&pfx_un1.u.prefix4,
- &pfx_un2.u.prefix4))
+ if (!IPV4_ADDR_SAME(&pfx_un1.u.prefix4, &pfx_un2.u.prefix4))
return 0;
break;
case AF_INET6:
vo->v.l2addr.local_nve_id = bi->extra->vnc.import.rd.val[1];
/* label comes from MP_REACH_NLRI label */
- vo->v.l2addr.label = decode_label(&bi->extra->label);
+ vo->v.l2addr.label = decode_label(&bi->extra->label[0]);
new->vn_options = vo;
}
if (!skiplist_search(seen_nexthops, &pfx_vn, NULL)) {
#if DEBUG_RETURNED_NHL
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- prefix2str(&pfx_vn, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
+ prefix2str(&pfx_vn, buf, sizeof(buf));
vnc_zlog_debug_verbose(
"%s: already put VN/nexthop %s, skip", __func__,
buf);
#if DEBUG_RETURNED_NHL
{
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- prefix2str(&rn->p, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0;
+ prefix2str(&rn->p, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: called with node pfx=%s", __func__,
buf);
}
assert(bi->extra);
{
- char buf[BUFSIZ];
- prefix_rd2str(&bi->extra->vnc.import.rd, buf, BUFSIZ);
+ char buf[RD_ADDRSTRLEN];
+
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);
for (rc = skiplist_next(sl, (void **)&k, (void **)&v, &cursor); !rc;
rc = skiplist_next(sl, (void **)&k, (void **)&v, &cursor)) {
- char buf[BUFSIZ];
- char buf_aux_pfx[BUFSIZ];
+ char buf[RD_ADDRSTRLEN];
+ char buf_aux_pfx[PREFIX_STRLEN];
- prefix_rd2str(&k->extra->vnc.import.rd, buf, BUFSIZ);
- buf_aux_pfx[0] = 0;
+ prefix_rd2str(&k->extra->vnc.import.rd, buf, sizeof(buf));
if (k->extra->vnc.import.aux_prefix.family) {
prefix2str(&k->extra->vnc.import.aux_prefix,
- buf_aux_pfx, BUFSIZ);
- } else {
- strncpy(buf_aux_pfx, "(none)", BUFSIZ);
- buf_aux_pfx[BUFSIZ - 1] = 0;
- }
+ buf_aux_pfx, sizeof(buf_aux_pfx));
+ } else
+ strncpy(buf_aux_pfx, "(none)", PREFIX_STRLEN);
vnc_zlog_debug_verbose("bi %p, peer %p, rd %s, aux_prefix %s",
k, k->peer, buf, buf_aux_pfx);
#if DEBUG_BI_SEARCH
{
- char buf[BUFSIZ];
- char buf_aux_pfx[BUFSIZ];
+ char buf[RD_ADDRSTRLEN];
+ char buf_aux_pfx[PREFIX_STRLEN];
- prefix_rd2str(prd, buf, BUFSIZ);
if (aux_prefix) {
- prefix2str(aux_prefix, buf_aux_pfx, BUFSIZ);
- } else {
- strncpy(buf_aux_pfx, "(nil)", BUFSIZ - 1);
- buf_aux_pfx[BUFSIZ - 1] = 0;
- }
+ prefix2str(aux_prefix, buf_aux_pfx,
+ sizeof(buf_aux_pfx));
+ } else
+ strncpy(buf_aux_pfx, "(nil)", sizeof(buf_aux_pfx));
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);
}
#endif
bi_result = bi_result->next) {
#if DEBUG_BI_SEARCH
{
- char buf[BUFSIZ];
- prefix_rd2str(&bi_result->extra->vnc.import.rd,
- buf, BUFSIZ);
+ char buf[RD_ADDRSTRLEN];
+
vnc_zlog_debug_verbose(
"%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
if (peer == bi_result->peer
int rc;
{
- char buf[BUFSIZ];
- prefix_rd2str(&bi->extra->vnc.import.rd, buf, BUFSIZ);
+ char buf[RD_ADDRSTRLEN];
+
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);
rfapiCopyUnEncap2VPN(ern->info, info_new);
route_unlock_node(ern); /* undo lock in route_note_match */
} else {
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
+
prefix2str(&vn_prefix, buf, sizeof(buf));
- buf[BUFSIZ - 1] = 0;
/* Not a big deal, just means VPN route got here first */
vnc_zlog_debug_verbose("%s: no encap route for vn addr %s",
__func__, buf);
if (bi->extra)
label = decode_label(
- &bi->extra->label);
+ &bi->extra->label[0]);
(*rfapiBgpInfoFilteredImportFunction(
safi))(
it, /* which import table */
#if DEBUG_L2_EXTRA
{
- char buf_pfx[BUFSIZ];
+ char buf_pfx[PREFIX_STRLEN];
if (p) {
- prefix2str(p, buf_pfx, BUFSIZ);
+ prefix2str(p, buf_pfx, sizeof(buf_pfx));
} else {
buf_pfx[0] = '*';
buf_pfx[1] = 0;
struct bgp_info *next;
if (VNC_DEBUG(IMPORT_DEL_REMOTE)) {
- char p1line[BUFSIZ];
- char p2line[BUFSIZ];
+ char p1line[PREFIX_STRLEN];
+ char p2line[PREFIX_STRLEN];
- prefix2str(p, p1line, BUFSIZ);
- prefix2str(&rn->p, p2line, BUFSIZ);
+ prefix2str(p, p1line, sizeof(p1line));
+ prefix2str(&rn->p, p2line, sizeof(p2line));
vnc_zlog_debug_any("%s: want %s, have %s",
__func__, p1line, p2line);
}
continue;
{
- char buf_pfx[BUFSIZ];
- prefix2str(&rn->p, buf_pfx, BUFSIZ);
+ char buf_pfx[PREFIX_STRLEN];
+
+ prefix2str(&rn->p, buf_pfx, sizeof(buf_pfx));
vnc_zlog_debug_verbose("%s: rn pfx=%s",
__func__, buf_pfx);
}