static void display_vni(struct vty *vty, struct bgpevpn *vpn, json_object *json)
{
- char buf1[INET6_ADDRSTRLEN];
+ char buf1[RD_ADDRSTRLEN];
char *ecom_str;
struct listnode *node, *nnode;
struct ecommunity *ecom;
is_vni_live(vpn) ? "Yes" : "No");
json_object_string_add(
json, "rd",
- prefix_rd2str(&vpn->prd, buf1, RD_ADDRSTRLEN));
+ prefix_rd2str(&vpn->prd, buf1, sizeof(buf1)));
json_object_string_add(json, "originatorIp",
inet_ntoa(vpn->originator_ip));
json_object_string_add(json, "advertiseGatewayMacip",
vty_out(vty, "\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",
inet_ntoa(vpn->originator_ip));
vty_out(vty, " Advertise-gw-macip : %s\n",
json_object *json_export_rtl;
struct bgpevpn *vpn = (struct bgpevpn *)backet->data;
char buf1[10];
- char buf2[INET6_ADDRSTRLEN];
+ char buf2[RD_ADDRSTRLEN];
char rt_buf[25];
char *ecom_str;
struct listnode *node, *nnode;
inet_ntoa(vpn->originator_ip));
json_object_string_add(
json_vni, "rd",
- prefix_rd2str(&vpn->prd, buf2, RD_ADDRSTRLEN));
+ prefix_rd2str(&vpn->prd, buf2, sizeof(buf2)));
} else {
vty_out(vty, "%-1s %-10u %-15s %-21s", buf1, vpn->vni,
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)) {
static void write_vni_config(struct vty *vty, struct bgpevpn *vpn)
{
- char buf1[INET6_ADDRSTRLEN];
+ char buf1[RD_ADDRSTRLEN];
char *ecom_str;
struct listnode *node, *nnode;
struct ecommunity *ecom;
vty_out(vty, " vni %d\n", vpn->vni);
if (is_rd_configured(vpn))
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)) {
for (ALL_LIST_ELEMENTS(vpn->import_rtl, node, nnode,
struct rd_as rd_as;
struct rd_ip rd_ip;
- if (size < RD_ADDRSTRLEN)
- return NULL;
+ assert(size >= RD_ADDRSTRLEN);
pnt = prd->val;
return buf;
}
#endif
- return NULL;
+
+ snprintf(buf, size, "Unknown Type: %d", type);
+ return buf;
}
vty_out(vty, " Imported from %s:%s\n",
prefix_rd2str(
(struct prefix_rd *)&prn->p,
- buf1, RD_ADDRSTRLEN),
+ buf1, sizeof(buf1)),
buf2);
}
}
json_peer, "routerId",
inet_ntop(AF_INET,
&binfo->peer->remote_id, buf1,
- BUFSIZ));
+ sizeof(buf1)));
if (binfo->peer->hostname)
json_object_string_add(
inet_ntop(
AF_INET,
&binfo->peer->remote_id,
- buf1, BUFSIZ));
+ buf1, sizeof(buf1)));
}
}
continue;
if (rn->info != NULL) {
struct prefix_rd prd;
- char rd[BUFSIZ];
+ char rd[RD_ADDRSTRLEN];
memcpy(&prd, &(rn->p), sizeof(struct prefix_rd));
- if (prefix_rd2str(&prd, rd, BUFSIZ) == NULL)
- sprintf(rd,
- "Unknown Type: %u",
- decode_rd_type(prd.val));
+ prefix_rd2str(&prd, rd, sizeof(rd));
bgp_show_table(vty, bgp, safi, rn->info, type,
output_arg, use_json,
rd, next == NULL,
struct prefix *p;
struct peer *peer;
struct listnode *node, *nnode;
- char buf1[INET6_ADDRSTRLEN];
+ char buf1[RD_ADDRSTRLEN];
char buf2[INET6_ADDRSTRLEN];
#if defined(HAVE_CUMULUS)
char buf3[EVPN_ROUTE_STRLEN];
#if defined(HAVE_CUMULUS)
if (safi == SAFI_EVPN)
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 ? ":" : "",
bgp_evpn_route2str((struct prefix_evpn *)p,
vty_out(vty, "BGP routing table entry for %s%s%s/%d\n",
((safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP)
? prefix_rd2str(prd, buf1,
- RD_ADDRSTRLEN)
+ sizeof(buf1))
: ""),
safi == SAFI_MPLS_VPN ? ":" : "",
inet_ntop(p->family, &p->u.prefix, buf2,
vty_out(vty, "BGP routing table entry for %s%s%s/%d\n",
((safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP
|| safi == SAFI_EVPN)
- ? prefix_rd2str(prd, buf1, RD_ADDRSTRLEN)
- : ""),
+ ? prefix_rd2str(prd, buf1, sizeof(buf1))
+ : ""),
((safi == SAFI_MPLS_VPN) || (safi == SAFI_EVPN)) ? ":"
: "",
buf2, p->prefixlen);
afi_t afi = AFI_MAX;
int idx = 0;
- (void)argv_find_and_parse_afi(argv, argc, &idx, &afi);
+ if (!argv_find_and_parse_afi(argv, argc, &idx, &afi)) {
+ vty_out(vty, "%% Malformed Address Family\n");
+ return CMD_WARNING;
+ }
+
ret = str2prefix_rd(argv[5]->arg, &prd);
if (!ret) {
vty_out(vty, "%% Malformed Route Distinguisher\n");
return CMD_WARNING;
}
+
return bgp_show_route(vty, NULL, argv[6]->arg, afi, SAFI_MPLS_VPN, &prd,
0, BGP_PATH_ALL, use_json(argc, argv));
}
prd = (struct prefix_rd *)&prn->p;
/* "network" configuration display. */
- prefix_rd2str(prd, rdbuf, RD_ADDRSTRLEN);
+ prefix_rd2str(prd, rdbuf, sizeof(rdbuf));
label = decode_label(&bgp_static->label);
vty_out(vty, " network %s/%d rd %s",
prd = (struct prefix_rd *)&prn->p;
/* "network" configuration display. */
- prefix_rd2str(prd, rdbuf, RD_ADDRSTRLEN);
+ prefix_rd2str(prd, rdbuf, sizeof(rdbuf));
if (p->u.prefix_evpn.route_type == 5) {
char local_buf[PREFIX_STRLEN];
uint8_t family = IS_EVPN_PREFIX_IPADDR_V4((struct prefix_evpn *)p)
#if BGP_VNC_DEBUG_MATCH_GROUP
{
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- prefix2str(vn, buf, BUFSIZ);
+ prefix2str(vn, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: vn prefix: %s", __func__, buf);
- prefix2str(un, buf, BUFSIZ);
+ prefix2str(un, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: un prefix: %s", __func__, buf);
vnc_zlog_debug_verbose(
}
if (rfg->rd.prefixlen) {
- char buf[BUFSIZ];
- buf[0] = buf[BUFSIZ - 1] = 0;
+ char buf[RD_ADDRSTRLEN];
if (AF_UNIX == rfg->rd.family) {
vty_out(vty, " rd auto:nh:%d\n",
value);
- } else {
-
- if (!prefix_rd2str(&rfg->rd, buf,
- BUFSIZ)
- || !buf[0] || buf[BUFSIZ - 1]) {
-
- vty_out(vty,
- "!Error: Can't convert rd\n");
- } else {
- vty_out(vty, " rd %s\n", buf);
- }
- }
+ } else
+ vty_out(vty, " rd %s\n",
+ prefix_rd2str(&rfg->rd, buf,
+ sizeof(buf)));
}
if (rfg->rt_import_list && rfg->rt_export_list
vty_out(vty, " vnc defaults\n");
if (hc->default_rd.prefixlen) {
- char buf[BUFSIZ];
- buf[0] = buf[BUFSIZ - 1] = 0;
+ char buf[RD_ADDRSTRLEN];
if (AF_UNIX == hc->default_rd.family) {
uint16_t value = 0;
vty_out(vty, " rd auto:vn:%d\n",
value);
- } else {
-
- if (!prefix_rd2str(&hc->default_rd, buf,
- BUFSIZ)
- || !buf[0] || buf[BUFSIZ - 1]) {
-
- vty_out(vty,
- "!Error: Can't convert rd\n");
- } else {
- vty_out(vty, " rd %s\n", buf);
- }
- }
+ } else
+ vty_out(vty, " rd %s\n",
+ prefix_rd2str(&hc->default_rd,
+ buf,
+ sizeof(buf)));
}
if (hc->default_response_lifetime) {
vty_out(vty, " response-lifetime ");
vty_out(vty, " vnc nve-group %s\n", rfg->name);
if (rfg->vn_prefix.family && rfg->vn_node) {
- char buf[BUFSIZ];
- buf[0] = buf[BUFSIZ - 1] = 0;
+ char buf[PREFIX_STRLEN];
prefix2str(&rfg->vn_prefix, buf,
- BUFSIZ);
- if (!buf[0] || buf[BUFSIZ - 1]) {
- vty_out(vty,
- "!Error: Can't convert prefix\n");
- } else {
- vty_out(vty, " prefix %s %s\n",
- "vn", buf);
- }
+ sizeof(buf));
+ vty_out(vty, " prefix %s %s\n",
+ "vn", buf);
}
if (rfg->un_prefix.family && rfg->un_node) {
- char buf[BUFSIZ];
- buf[0] = buf[BUFSIZ - 1] = 0;
+ char buf[PREFIX_STRLEN];
+
prefix2str(&rfg->un_prefix, buf,
- BUFSIZ);
- if (!buf[0] || buf[BUFSIZ - 1]) {
- vty_out(vty,
- "!Error: Can't convert prefix\n");
- } else {
- vty_out(vty, " prefix %s %s\n",
- "un", buf);
- }
+ sizeof(buf));
+ vty_out(vty, " prefix %s %s\n",
+ "un", buf);
}
if (rfg->rd.prefixlen) {
- char buf[BUFSIZ];
- buf[0] = buf[BUFSIZ - 1] = 0;
+ char buf[RD_ADDRSTRLEN];
if (AF_UNIX == rfg->rd.family) {
" rd auto:vn:%d\n",
value);
- } else {
-
- if (!prefix_rd2str(&rfg->rd,
- buf, BUFSIZ)
- || !buf[0]
- || buf[BUFSIZ - 1]) {
-
- vty_out(vty,
- "!Error: Can't convert rd\n");
- } else {
- vty_out(vty,
- " rd %s\n",
- buf);
- }
- }
+ } else
+ vty_out(vty,
+ " rd %s\n",
+ prefix_rd2str(&rfg->rd,
+ buf,
+ sizeof(buf)));
}
if (rfg->flags & RFAPI_RFG_RESPONSE_LIFETIME) {
vty_out(vty, " response-lifetime ");
afi_t afi; /* of the VN address */
struct bgp_node *bn;
struct bgp_info *bi;
- char buf[BUFSIZ];
- char buf2[BUFSIZ];
+ char buf[PREFIX_STRLEN];
+ char buf2[RD_ADDRSTRLEN];
struct prefix_rd prd0;
- prefix2str(p, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
-
- prefix_rd2str(prd, buf2, BUFSIZ);
- buf2[BUFSIZ - 1] = 0;
+ prefix2str(p, buf, sizeof(buf));
afi = family2afi(p->family);
assert(afi == AFI_IP || afi == AFI_IP6);
vnc_zlog_debug_verbose(
"%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));
for (bi = (bn ? bn->info : NULL); bi; bi = bi->next) {
rfapiProcessWithdraw(peer, rfd, p, prd, NULL, afi, safi, type, kill);
if (bi) {
- char buf[BUFSIZ];
-
- prefix2str(p, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
+ char buf[PREFIX_STRLEN];
+ prefix2str(p, buf, sizeof(buf));
vnc_zlog_debug_verbose(
"%s: Found route (safi=%d) to delete at prefix %s",
__func__, safi, buf);
uint32_t label_val;
struct bgp_attr_encap_subtlv *encaptlv;
- char buf[BUFSIZ];
- char buf2[BUFSIZ];
+ char buf[PREFIX_STRLEN];
+ char buf2[RD_ADDRSTRLEN];
#if 0 /* unused? */
struct prefix pfx_buf;
#endif
else
label_val = MPLS_LABEL_IMPLICIT_NULL;
- prefix_rd2str(prd, buf2, BUFSIZ);
- buf2[BUFSIZ - 1] = 0;
-
+ prefix_rd2str(prd, buf2, sizeof(buf2));
afi = family2afi(p->family);
assert(afi == AFI_IP || afi == AFI_IP6);
}
- prefix2str(p, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
+ prefix2str(p, buf, sizeof(buf));
/*
* At this point:
}
{
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
char *s;
- prefix2str(&p, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
+ prefix2str(&p, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s(rfd=%p, target=%s, ppNextHop=%p)",
__func__, rfd, buf, ppNextHopEntry);
{
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- prefix2str(&p, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
+ 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,
4); /* low order 4 bytes */
}
{
- char buf[BUFSIZ];
- buf[0] = 0;
- prefix_rd2str(rd, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0;
+ char buf[RD_ADDRSTRLEN];
+
vnc_zlog_debug_verbose("%s: auto-RD is set to %s", __func__,
- buf);
+ prefix_rd2str(rd, buf, sizeof(buf)));
}
return 0;
}
#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"
#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);
}
}
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 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);
}
struct bgp *bgp = bgp_get_default();
afi_t afi = family2afi(rn->p.family);
#if DEBUG_L2_EXTRA
- char buf_prefix[BUFSIZ];
+ char buf_prefix[PREFIX_STRLEN];
#endif
assert(bgp);
nves_seen = skiplist_new(0, NULL, NULL);
#if DEBUG_L2_EXTRA
- prefix2str(&it_node->p, buf_prefix, BUFSIZ);
+ 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);
#endif
assert(!skiplist_insert(nves_seen,
m->rfd, NULL));
- {
- char buf_attach_pfx[BUFSIZ];
- char buf_target_pfx[BUFSIZ];
-
- prefix2str(&m->node->p,
- buf_attach_pfx,
- BUFSIZ);
- prefix2str(&m->p,
- buf_target_pfx,
- BUFSIZ);
- vnc_zlog_debug_verbose(
- "%s: update rfd %p attached to pfx %s (targ=%s)",
- __func__, m->rfd,
- buf_attach_pfx,
- buf_target_pfx);
- }
+ char buf_attach_pfx[PREFIX_STRLEN];
+ char buf_target_pfx[PREFIX_STRLEN];
+
+ prefix2str(&m->node->p,
+ buf_attach_pfx,
+ sizeof(buf_attach_pfx));
+ prefix2str(&m->p,
+ buf_target_pfx,
+ sizeof(buf_target_pfx));
+ vnc_zlog_debug_verbose(
+ "%s: update rfd %p attached to pfx %s (targ=%s)",
+ __func__, m->rfd,
+ buf_attach_pfx,
+ buf_target_pfx);
/*
* update its RIB
assert(rn);
#if DEBUG_L2_EXTRA
- char buf_prefix[BUFSIZ];
- prefix2str(&rn->p, buf_prefix, BUFSIZ);
+ char buf_prefix[PREFIX_STRLEN];
+
+ prefix2str(&rn->p, buf_prefix, sizeof(buf_prefix));
#endif
/*
{
struct thread *t = ri->timer;
struct rfapi_rib_tcb *tcb = NULL;
- char buf_prefix[BUFSIZ];
+ char buf_prefix[PREFIX_STRLEN];
if (t) {
tcb = t->arg;
UNSET_FLAG(tcb->flags, RFAPI_RIB_TCB_FLAG_DELETED);
}
- prefix2str(&rn->p, buf_prefix, BUFSIZ);
+ prefix2str(&rn->p, buf_prefix, sizeof(buf_prefix));
vnc_zlog_debug_verbose("%s: rfd %p pfx %s life %u", __func__, rfd,
buf_prefix, ri->lifetime);
ri->timer = NULL;
struct list *lPendCost = NULL;
struct list *delete_list = NULL;
int printedprefix = 0;
- char buf_prefix[BUFSIZ];
+ char buf_prefix[PREFIX_STRLEN];
int rib_node_started_nonempty = 0;
int sendingsomeroutes = 0;
#endif
assert(pn);
- prefix2str(&pn->p, buf_prefix, BUFSIZ);
+ prefix2str(&pn->p, buf_prefix, sizeof(buf_prefix));
vnc_zlog_debug_verbose("%s: afi=%d, %s pn->info=%p", __func__, afi,
buf_prefix, pn->info);
while (0
== skiplist_first(slRibPt, NULL, (void **)&ri)) {
- char buf[BUFSIZ];
- char buf2[BUFSIZ];
+ char buf[PREFIX_STRLEN];
+ char buf2[PREFIX_STRLEN];
listnode_add(delete_list, ri);
vnc_zlog_debug_verbose(
ri->timer = NULL;
}
- prefix2str(&ri->rk.vn, buf, BUFSIZ);
- prefix2str(&ri->un, buf2, BUFSIZ);
+ prefix2str(&ri->rk.vn, buf, sizeof(buf));
+ prefix2str(&ri->un, buf2, sizeof(buf2));
vnc_zlog_debug_verbose(
"%s: put dl pfx=%s vn=%s un=%s cost=%d life=%d vn_options=%p",
__func__, buf_prefix, buf, buf2,
} else {
- char buf_rd[BUFSIZ];
+ char buf_rd[RD_ADDRSTRLEN];
/* not found: add new route to RIB */
ori = rfapi_info_new();
ri->last_sent_time = rfapi_time(NULL);
#if DEBUG_RIB_SL_RD
{
- char buf_rd[BUFSIZ];
- prefix_rd2str(&ri->rk.rd,
- buf_rd,
- sizeof(buf_rd));
+ char buf_rd[RD_ADDRSTRLEN];
+
vnc_zlog_debug_verbose(
"%s: move route to recently deleted list, rd=%s",
- __func__, buf_rd);
+ __func__,
+ prefix_rd2str(&ri->rk.rd,
+ buf_rd,
+ sizeof(buf_rd)));
}
#endif
afi_t afi;
uint32_t queued_flag;
int count = 0;
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
vnc_zlog_debug_verbose("%s: entry", __func__);
prefix = &it_node->p;
afi = family2afi(prefix->family);
- prefix2str(prefix, buf, BUFSIZ);
+ prefix2str(prefix, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: prefix=%s", __func__, buf);
pn = route_node_get(rfd->rib_pending[afi], prefix);
#if DEBUG_FTD_FILTER_RECENT
{
- char buf_pfx[BUFSIZ];
+ char buf_pfx[PREFIX_STRLEN];
- prefix2str(&it_rn->p, buf_pfx, BUFSIZ);
+ prefix2str(&it_rn->p, buf_pfx, sizeof(buf_pfx));
vnc_zlog_debug_verbose("%s: prefix %s", __func__, buf_pfx);
}
#endif
#if DEBUG_NHL
{
- char str_vn[BUFSIZ];
- char str_aux_prefix[BUFSIZ];
+ 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, BUFSIZ);
- prefix2str(&rk.aux_prefix, str_aux_prefix, BUFSIZ);
+ prefix2str(&rk.vn, str_vn, sizeof(str_vn));
+ prefix2str(&rk.aux_prefix, str_aux_prefix,
+ sizeof(str_aux_prefix));
if (!rk.aux_prefix.family) {
}
route_unlock_node(trn);
{
- char str_pfx[BUFSIZ];
- char str_pfx_vn[BUFSIZ];
+ char str_pfx[PREFIX_STRLEN];
+ char str_pfx_vn[PREFIX_STRLEN];
- prefix2str(&pfx, str_pfx, BUFSIZ);
- prefix2str(&rk.vn, str_pfx_vn, BUFSIZ);
+ 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,
{
struct rfapi_descriptor *rfd;
struct listnode *node;
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- prefix2str(&it_node->p, buf, BUFSIZ);
+ prefix2str(&it_node->p, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: entry, it=%p, afi=%d, it_node=%p, pfx=%s",
__func__, it, afi, it_node, buf);
for (rc = skiplist_next(sl, NULL, (void **)&ri, &cursor); !rc;
rc = skiplist_next(sl, NULL, (void **)&ri, &cursor)) {
- char str_vn[BUFSIZ];
- char str_un[BUFSIZ];
+ char str_vn[PREFIX_STRLEN];
+ char str_un[PREFIX_STRLEN];
char str_lifetime[BUFSIZ];
char str_age[BUFSIZ];
char *p;
- char str_rd[BUFSIZ];
+ char str_rd[RD_ADDRSTRLEN];
++routes_displayed;
- prefix2str(&ri->rk.vn, str_vn, BUFSIZ);
+ prefix2str(&ri->rk.vn, str_vn, sizeof(str_vn));
p = index(str_vn, '/');
if (p)
*p = 0;
- prefix2str(&ri->un, str_un, BUFSIZ);
+ prefix2str(&ri->un, str_un, sizeof(str_un));
p = index(str_un, '/');
if (p)
*p = 0;
str_rd[0] = 0; /* start empty */
#if DEBUG_RIB_SL_RD
- str_rd[0] = ' ';
- prefix_rd2str(&ri->rk.rd, str_rd + 1, BUFSIZ - 1);
+ prefix_rd2str(&ri->rk.rd, str_rd, sizeof(str_rd));
#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,
str_un, ri->cost, str_lifetime, str_age, str_rd);
const char *vty_newline;
int nhs_displayed = 0;
- char str_pfx[BUFSIZ];
+ char str_pfx[PREFIX_STRLEN];
int printedprefix = 0;
if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0)
return;
- prefix2str(pfx, str_pfx, BUFSIZ);
+ prefix2str(pfx, str_pfx, sizeof(str_pfx));
nhs_displayed +=
print_rib_sl(fp, vty, out, sl, 0, str_pfx, &printedprefix);
rn = route_next(rn)) {
struct skiplist *sl;
- char str_pfx[BUFSIZ];
+ char str_pfx[PREFIX_STRLEN];
int printedprefix = 0;
if (!show_removed)
str_un,
BUFSIZ));
}
- prefix2str(&rn->p, str_pfx, BUFSIZ);
+ prefix2str(&rn->p, str_pfx, sizeof(str_pfx));
// fp(out, " %s\n", buf); /* prefix */
routes_displayed++;
void rfapiPrintRd(struct vty *vty, struct prefix_rd *prd)
{
- char buf[BUFSIZ];
+ char buf[RD_ADDRSTRLEN];
- buf[0] = 0;
prefix_rd2str(prd, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0;
vty_out(vty, "%s", buf);
}
int rc;
afi_t afi;
struct rfapi_adb *adb;
- char buf[BUFSIZ];
+ 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, BUFSIZ);
- buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
+ prefix2str(&adb->u.s.prefix_ip, buf, sizeof(buf));
vty_out(vty, " Adv Pfx: %s%s", buf, HVTYNL);
rfapiPrintAdvertisedInfo(vty, rfd, SAFI_MPLS_VPN,
rc == 0; rc = skiplist_next(rfd->advertised.ip0_by_ether, NULL,
(void **)&adb, &cursor)) {
- prefix2str(&adb->u.s.prefix_eth, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
+ prefix2str(&adb->u.s.prefix_eth, buf, sizeof(buf));
vty_out(vty, " Adv Pfx: %s%s", buf, HVTYNL);
continue;
{
- char prefixstr[BUFSIZ];
-
- prefixstr[0] = 0;
- inet_ntop(rn->p.family, &rn->p.u.prefix, prefixstr,
- BUFSIZ);
- vnc_zlog_debug_verbose("%s: checking prefix %s/%d",
- __func__, prefixstr,
- rn->p.prefixlen);
+ char prefixstr[PREFIX_STRLEN];
+
+ prefix2str(&rn->p, prefixstr, sizeof(prefixstr));
+ vnc_zlog_debug_verbose("%s: checking prefix %s",
+ __func__, prefixstr);
}
for (ri = rn->info; ri; ri = ri->next) {
continue;
{
- char prefixstr[BUFSIZ];
+ char prefixstr[PREFIX_STRLEN];
- prefixstr[0] = 0;
- inet_ntop(rn->p.family, &rn->p.u.prefix,
- prefixstr, BUFSIZ);
+ prefix2str(&rn->p, prefixstr,
+ sizeof(prefixstr));
vnc_zlog_debug_verbose(
- "%s: checking prefix %s/%d", __func__,
- prefixstr, rn->p.prefixlen);
+ "%s: checking prefix %s", __func__,
+ prefixstr);
}
/*
/* XXX uses secret knowledge of skiplist structure */
for (p = sl->header->forward[0]; p; p = p->forward[0]) {
- char kbuf[BUFSIZ];
- char hbuf[BUFSIZ];
- char ubuf[BUFSIZ];
+ char kbuf[PREFIX_STRLEN];
+ char hbuf[PREFIX_STRLEN];
+ char ubuf[PREFIX_STRLEN];
pb = p->value;
- prefix2str(p->key, kbuf, BUFSIZ);
- prefix2str(&pb->hpfx, hbuf, BUFSIZ);
- prefix2str(&pb->upfx, ubuf, BUFSIZ);
+ 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, ubi=%p",
* pfx */
assert(!vnc_prefix_cmp(&pb->hpfx, pkey));
if (vnc_prefix_cmp(&pb->hpfx, &pfx_orig_nexthop)) {
- char str_onh[BUFSIZ];
- char str_nve_pfx[BUFSIZ];
+ char str_onh[PREFIX_STRLEN];
+ char str_nve_pfx[PREFIX_STRLEN];
- prefix2str(&pfx_orig_nexthop, str_onh, BUFSIZ);
- str_onh[BUFSIZ - 1] = 0;
-
- prefix2str(&pb->hpfx, str_nve_pfx, BUFSIZ);
- str_nve_pfx[BUFSIZ - 1] = 0;
+ 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 bi nexthop %s != nve pfx %s",
return;
{
- char str_nh[BUFSIZ];
+ char str_nh[PREFIX_STRLEN];
- prefix2str(ubi_nexthop, str_nh, BUFSIZ);
- str_nh[BUFSIZ - 1] = 0;
+ prefix2str(ubi_nexthop, str_nh, sizeof(str_nh));
vnc_zlog_debug_verbose("%s: ubi_nexthop=%s", __func__, str_nh);
}
/*debugging */
if (VNC_DEBUG(VERBOSE)) {
- char str_pfx[BUFSIZ];
- char str_nh[BUFSIZ];
+ char str_pfx[PREFIX_STRLEN];
+ char str_nh[PREFIX_STRLEN];
struct prefix nh;
- prefix2str(prefix, str_pfx, BUFSIZ);
- str_pfx[BUFSIZ - 1] = 0;
+ prefix2str(prefix, str_pfx, sizeof(str_pfx));
nh.prefixlen = 0;
rfapiUnicastNexthop2Prefix(afi, info->attr, &nh);
if (nh.prefixlen) {
- prefix2str(&nh, str_nh, BUFSIZ);
- str_nh[BUFSIZ - 1] = 0;
+ prefix2str(&nh, str_nh, sizeof(str_nh));
} else {
str_nh[0] = '?';
str_nh[1] = 0;
uint32_t *med = NULL;
{
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- buf[0] = 0;
- prefix2str(prefix, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0;
+ prefix2str(prefix, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s(prefix=%s) entry", __func__, buf);
}
}
if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) {
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- buf[0] = 0;
- prefix2str(vn_pfx, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0;
+ prefix2str(vn_pfx, buf, sizeof(buf));
vnc_zlog_debug_any("%s vn_pfx=%s", __func__, buf);
}
}
if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) {
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- buf[0] = 0;
- rfapiRfapiIpAddr2Str(&vnaddr, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0;
+ rfapiRfapiIpAddr2Str(&vnaddr, buf, sizeof(buf));
vnc_zlog_debug_any("%s: setting vnaddr to %s", __func__, buf);
}
uint32_t local_pref;
{
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- buf[0] = 0;
- prefix2str(prefix, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0;
+ prefix2str(prefix, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s(prefix=%s) entry", __func__, buf);
}
}
if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) {
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
- buf[0] = 0;
- prefix2str(vn_pfx, buf, BUFSIZ);
- buf[BUFSIZ - 1] = 0;
+ prefix2str(vn_pfx, buf, sizeof(buf));
vnc_zlog_debug_any("%s vn_pfx=%s", __func__, buf);
}
return;
{
- char str_nh[BUFSIZ];
-
- prefix2str(ubi_nexthop, str_nh, BUFSIZ);
- str_nh[BUFSIZ - 1] = 0;
+ char str_nh[PREFIX_STRLEN];
+ prefix2str(ubi_nexthop, str_nh, sizeof(str_nh));
vnc_zlog_debug_verbose("%s: ubi_nexthop=%s", __func__, str_nh);
}
sizeof(struct prefix)); /* keep valgrind happy */
if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE)) {
- char hbuf[BUFSIZ];
- char ubuf[BUFSIZ];
+ char hbuf[PREFIX_STRLEN];
+ char ubuf[PREFIX_STRLEN];
- prefix2str(&pb->hpfx, hbuf, BUFSIZ);
- prefix2str(&pb->upfx, ubuf, BUFSIZ);
+ prefix2str(&pb->hpfx, hbuf, sizeof(hbuf));
+ prefix2str(&pb->upfx, ubuf, sizeof(ubuf));
vnc_zlog_debug_any(
"%s: examining RHN Entry (q=%p): upfx=%s, hpfx=%s, ubi=%p",
* Sanity check
*/
if (vnc_prefix_cmp(&pfx_unicast_nexthop, prefix)) {
- char str_unh[BUFSIZ];
- char str_nve_pfx[BUFSIZ];
+ char str_unh[PREFIX_STRLEN];
+ char str_nve_pfx[PREFIX_STRLEN];
- prefix2str(&pfx_unicast_nexthop, str_unh, BUFSIZ);
- str_unh[BUFSIZ - 1] = 0;
-
- prefix2str(prefix, str_nve_pfx, BUFSIZ);
- str_nve_pfx[BUFSIZ - 1] = 0;
+ 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 bi nexthop %s != nve pfx %s",
#if DEBUG_RHN_LIST
/* debug */
{
- char pbuf[BUFSIZ];
+ char pbuf[PREFIX_STRLEN];
- prefix2str(prefix, pbuf, BUFSIZ);
+ prefix2str(prefix, pbuf, sizeof(pbuf));
vnc_zlog_debug_verbose(
"%s: advancing past RHN Entry (q=%p): with prefix %s",
int rc;
{
- char str_pfx[BUFSIZ];
+ char str_pfx[PREFIX_STRLEN];
- prefix2str(prefix, str_pfx, BUFSIZ);
- str_pfx[BUFSIZ - 1] = 0;
+ prefix2str(prefix, str_pfx, sizeof(str_pfx));
vnc_zlog_debug_verbose("%s(bgp=%p, nve prefix=%s)", __func__,
bgp, str_pfx);
* Sanity check
*/
if (vnc_prefix_cmp(&pfx_unicast_nexthop, prefix)) {
- char str_unh[BUFSIZ];
- char str_nve_pfx[BUFSIZ];
-
- prefix2str(&pfx_unicast_nexthop, str_unh, BUFSIZ);
- str_unh[BUFSIZ - 1] = 0;
+ char str_unh[PREFIX_STRLEN];
+ char str_nve_pfx[PREFIX_STRLEN];
- prefix2str(prefix, str_nve_pfx, BUFSIZ);
- str_nve_pfx[BUFSIZ - 1] = 0;
+ 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 bi nexthop %s != nve pfx %s",
/*debugging */
{
- char str_pfx[BUFSIZ];
-
- prefix2str(&rn_interior->p, str_pfx, BUFSIZ);
- str_pfx[BUFSIZ - 1] = 0;
+ char str_pfx[PREFIX_STRLEN];
+ prefix2str(&rn_interior->p, str_pfx, sizeof(str_pfx));
vnc_zlog_debug_verbose("%s: interior prefix=%s, bi type=%d",
__func__, str_pfx, bi_interior->type);
}
(void **)&pfx_exterior, &cursor)) {
struct prefix pfx_nexthop;
- char buf[BUFSIZ];
+ char buf[PREFIX_STRLEN];
afi_t afi_exterior = family2afi(pfx_exterior->family);
prefix2str(pfx_exterior, buf, sizeof(buf));
- buf[sizeof(buf) - 1] = 0;
vnc_zlog_debug_verbose(
"%s: checking exterior orphan at prefix %s", __func__,
buf);
/*debugging */
{
- char str_pfx[BUFSIZ];
+ char str_pfx[PREFIX_STRLEN];
- prefix2str(&rn_interior->p, str_pfx, BUFSIZ);
- str_pfx[BUFSIZ - 1] = 0;
+ prefix2str(&rn_interior->p, str_pfx, sizeof(str_pfx));
vnc_zlog_debug_verbose("%s: interior prefix=%s, bi type=%d",
__func__, str_pfx, bi_interior->type);
if (VNC_DEBUG(VERBOSE)) {
struct prefix pfx_nexthop;
- char buf[BUFSIZ];
- char buf_nh[BUFSIZ];
+ char buf[PREFIX_STRLEN];
+ char buf_nh[PREFIX_STRLEN];
- prefix2str(prefix, buf, BUFSIZ);
+ prefix2str(prefix, buf, sizeof(buf));
rfapiUnicastNexthop2Prefix(afi, info->attr, &pfx_nexthop);
- prefix2str(&pfx_nexthop, buf_nh, BUFSIZ);
+ prefix2str(&pfx_nexthop, buf_nh, sizeof(buf_nh));
vnc_zlog_debug_verbose("%s: pfx %s, nh %s", __func__, buf,
buf_nh);
{
struct prefix pfx_nexthop;
- char buf[BUFSIZ];
- char buf_nh[BUFSIZ];
+ char buf[PREFIX_STRLEN];
+ char buf_nh[PREFIX_STRLEN];
- prefix2str(prefix, buf, BUFSIZ);
+ prefix2str(prefix, buf, sizeof(buf));
rfapiUnicastNexthop2Prefix(afi, info->attr, &pfx_nexthop);
- prefix2str(&pfx_nexthop, buf_nh, BUFSIZ);
+ prefix2str(&pfx_nexthop, buf_nh, sizeof(buf_nh));
vnc_zlog_debug_verbose("%s: pfx %s, nh %s", __func__, buf,
buf_nh);
*/
if (!dest) {
char buf[PREFIX_STRLEN];
+
zlog_err("%s: Received prefix %s which we do not know about",
__PRETTY_FUNCTION__,
- prefix2str(&dest_addr, buf, strlen(buf)));
+ prefix2str(&dest_addr, buf, sizeof(buf)));
+ eigrp_IPv4_InternalTLV_free(tlv);
continue;
}
circuit->lsp_queue = list_new();
circuit->lsp_hash = isis_lsp_hash_new();
- circuit->lsp_queue_last_push = monotime(NULL);
+ circuit->lsp_queue_last_push[0] = circuit->lsp_queue_last_push[1] =
+ monotime(NULL);
return ISIS_OK;
}
struct thread *t_send_lsp;
struct list *lsp_queue; /* LSPs to be txed (both levels) */
struct isis_lsp_hash *lsp_hash; /* Hashtable synchronized with lsp_queue */
- time_t lsp_queue_last_push; /* timestamp used to enforce transmit
+ time_t lsp_queue_last_push[2]; /* timestamp used to enforce transmit
* interval;
* for scalability, use one timestamp per
* circuit, instead of one per lsp per
if (!circuit->lsp_queue)
continue;
- if (now - circuit->lsp_queue_last_push
+ if (now - circuit->lsp_queue_last_push[level]
< MIN_LSP_RETRANS_INTERVAL) {
continue;
}
- circuit->lsp_queue_last_push = now;
+ circuit->lsp_queue_last_push[level] = now;
for (ALL_LIST_ELEMENTS_RO(
lsp_list, lspnode, lsp)) {
timer, &area->spf_timer[level - 1]);
if (isis->debugs & DEBUG_SPF_EVENTS)
- zlog_debug("ISIS-Spf (%s) L%d SPF scheduled %d sec from now",
- area->area_tag, level,
- area->min_spf_interval[level - 1] - diff);
+ zlog_debug("ISIS-Spf (%s) L%d SPF scheduled %ld sec from now",
+ area->area_tag, level, timer);
return ISIS_OK;
}
#define IS_ZEBRA_IF_VRF_SLAVE(ifp) \
(((struct zebra_if *)(ifp->info))->zif_slave_type == ZEBRA_IF_SLAVE_VRF)
+extern void zebra_if_init(void);
+
extern struct interface *if_lookup_by_index_per_ns(struct zebra_ns *,
u_int32_t);
extern struct interface *if_lookup_by_name_per_ns(struct zebra_ns *,
#include "zebra/zserv.h"
#include "zebra/zebra_ns.h"
#include "zebra/zebra_vrf.h"
+#include "zebra/rt.h"
#include "zebra/debug.h"
#include "zebra/kernel_netlink.h"
#include "zebra/rt_netlink.h"
zebrad.master = frr_init();
/* Zebra related initialize. */
- zebra_init();
+ zserv_init();
rib_init();
zebra_if_init();
zebra_debug_init();
DECLARE_HOOK(rib_update, (struct route_node * rn, const char *reason),
(rn, reason))
+
+extern void zebra_vty_init(void);
+extern pid_t pid;
+
#endif /*_ZEBRA_RIB_H */
struct ethaddr *mac);
extern int kernel_del_neigh(struct interface *ifp, struct ipaddr *ip);
+/*
+ * Southbound Initialization routines to get initial starting
+ * state.
+ */
+extern void interface_list(struct zebra_ns *zns);
+extern void kernel_init(struct zebra_ns *zns);
+extern void kernel_terminate(struct zebra_ns *zns);
+extern void macfdb_read(struct zebra_ns *zns);
+extern void macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp,
+ struct interface *br_if);
+extern void neigh_read(struct zebra_ns *zns);
+extern void neigh_read_for_vlan(struct zebra_ns *zns, struct interface *ifp);
+extern void route_read(struct zebra_ns *zns);
+
#endif /* _ZEBRA_RT_H */
#include "vty.h"
#include "zebra/rib.h"
-#include "zebra/zserv.h"
+#include "zebra/rt.h"
/* Thank you, Solaris, for polluting application symbol namespace. */
#undef hook_register
#ifdef GNU_LINUX
#include "vty.h"
-#include "zebra/zserv.h"
+#include "zebra/rt.h"
#include "zebra/rt_netlink.h"
void route_read(struct zebra_ns *zns)
#include "log.h"
#include "vrf.h"
-#include "zebra/zserv.h"
#include "zebra/rt.h"
#include "zebra/kernel_socket.h"
#include "zebra_ns.h"
#include "zebra_vrf.h"
#include "zebra_memory.h"
+#include "rt.h"
DEFINE_MTYPE(ZEBRA, ZEBRA_NS, "Zebra Name Space")
#ifndef __ZEBRA_ROUTEMAP_H__
#define __ZEBRA_ROUTEMAP_H__
+extern void zebra_route_map_init(void);
extern void zebra_routemap_config_write_protocol(struct vty *vty);
extern char *zebra_get_import_table_route_map(afi_t afi, uint32_t table);
extern void zebra_add_import_table_route_map(afi_t afi, const char *rmap_name,
#include "zebra/zebra_vty_clippy.c"
#endif
#include "zebra/zserv.h"
+#include "zebra/router-id.h"
+#include "zebra/ipforward.h"
extern int allow_delete;
return 1;
}
+#ifdef HAVE_NETLINK
+/* Display default rtm_table for all clients. */
+DEFUN (show_table,
+ show_table_cmd,
+ "show table",
+ SHOW_STR
+ "default routing table to use for all clients\n")
+{
+ vty_out(vty, "table %d\n", zebrad.rtm_table_default);
+ return CMD_SUCCESS;
+}
+
+DEFUN (config_table,
+ config_table_cmd,
+ "table TABLENO",
+ "Configure target kernel routing table\n"
+ "TABLE integer\n")
+{
+ zebrad.rtm_table_default = strtol(argv[1]->arg, (char **)0, 10);
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_config_table,
+ no_config_table_cmd,
+ "no table [TABLENO]",
+ NO_STR
+ "Configure target kernel routing table\n"
+ "TABLE integer\n")
+{
+ zebrad.rtm_table_default = 0;
+ return CMD_SUCCESS;
+}
+#endif
+
+DEFUN (show_zebra,
+ show_zebra_cmd,
+ "show zebra",
+ SHOW_STR
+ ZEBRA_STR)
+{
+ struct vrf *vrf;
+
+ vty_out(vty,
+ " Route Route Neighbor LSP LSP\n");
+ vty_out(vty,
+ "VRF Installs Removals Updates Installs Removals\n");
+
+ RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) {
+ struct zebra_vrf *zvrf = vrf->info;
+
+ vty_out(vty, "%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64
+ " %10" PRIu64 " %10" PRIu64 "\n",
+ vrf->name, zvrf->installs, zvrf->removals,
+ zvrf->neigh_updates, zvrf->lsp_installs,
+ zvrf->lsp_removals);
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFUN (ip_forwarding,
+ ip_forwarding_cmd,
+ "ip forwarding",
+ IP_STR
+ "Turn on IP forwarding\n")
+{
+ int ret;
+
+ ret = ipforward();
+ if (ret == 0)
+ ret = ipforward_on();
+
+ if (ret == 0) {
+ vty_out(vty, "Can't turn on IP forwarding\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_ip_forwarding,
+ no_ip_forwarding_cmd,
+ "no ip forwarding",
+ NO_STR
+ IP_STR
+ "Turn off IP forwarding\n")
+{
+ int ret;
+
+ ret = ipforward();
+ if (ret != 0)
+ ret = ipforward_off();
+
+ if (ret != 0) {
+ vty_out(vty, "Can't turn off IP forwarding\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ return CMD_SUCCESS;
+}
+
+/* Only display ip forwarding is enabled or not. */
+DEFUN (show_ip_forwarding,
+ show_ip_forwarding_cmd,
+ "show ip forwarding",
+ SHOW_STR
+ IP_STR
+ "IP forwarding status\n")
+{
+ int ret;
+
+ ret = ipforward();
+
+ if (ret == 0)
+ vty_out(vty, "IP forwarding is off\n");
+ else
+ vty_out(vty, "IP forwarding is on\n");
+ return CMD_SUCCESS;
+}
+
+/* Only display ipv6 forwarding is enabled or not. */
+DEFUN (show_ipv6_forwarding,
+ show_ipv6_forwarding_cmd,
+ "show ipv6 forwarding",
+ SHOW_STR
+ "IPv6 information\n"
+ "Forwarding status\n")
+{
+ int ret;
+
+ ret = ipforward_ipv6();
+
+ switch (ret) {
+ case -1:
+ vty_out(vty, "ipv6 forwarding is unknown\n");
+ break;
+ case 0:
+ vty_out(vty, "ipv6 forwarding is %s\n", "off");
+ break;
+ case 1:
+ vty_out(vty, "ipv6 forwarding is %s\n", "on");
+ break;
+ default:
+ vty_out(vty, "ipv6 forwarding is %s\n", "off");
+ break;
+ }
+ return CMD_SUCCESS;
+}
+
+DEFUN (ipv6_forwarding,
+ ipv6_forwarding_cmd,
+ "ipv6 forwarding",
+ IPV6_STR
+ "Turn on IPv6 forwarding\n")
+{
+ int ret;
+
+ ret = ipforward_ipv6();
+ if (ret == 0)
+ ret = ipforward_ipv6_on();
+
+ if (ret == 0) {
+ vty_out(vty, "Can't turn on IPv6 forwarding\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_ipv6_forwarding,
+ no_ipv6_forwarding_cmd,
+ "no ipv6 forwarding",
+ NO_STR
+ IPV6_STR
+ "Turn off IPv6 forwarding\n")
+{
+ int ret;
+
+ ret = ipforward_ipv6();
+ if (ret != 0)
+ ret = ipforward_ipv6_off();
+
+ if (ret != 0) {
+ vty_out(vty, "Can't turn off IPv6 forwarding\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ return CMD_SUCCESS;
+}
+
+/* Table configuration write function. */
+static int config_write_table(struct vty *vty)
+{
+ if (zebrad.rtm_table_default)
+ vty_out(vty, "table %d\n", zebrad.rtm_table_default);
+ return 0;
+}
+
+/* IPForwarding configuration write function. */
+static int config_write_forwarding(struct vty *vty)
+{
+ /* FIXME: Find better place for that. */
+ router_id_write(vty);
+
+ if (!ipforward())
+ vty_out(vty, "no ip forwarding\n");
+ if (!ipforward_ipv6())
+ vty_out(vty, "no ipv6 forwarding\n");
+ vty_out(vty, "!\n");
+ return 0;
+}
+
/* IP node for static routes. */
static struct cmd_node ip_node = {IP_NODE, "", 1};
static struct cmd_node protocol_node = {PROTOCOL_NODE, "", 1};
+/* table node for routing tables. */
+static struct cmd_node table_node = {TABLE_NODE,
+ "", /* This node has no interface. */
+ 1};
+static struct cmd_node forwarding_node = {FORWARDING_NODE,
+ "", /* This node has no interface. */
+ 1};
/* Route VTY. */
void zebra_vty_init(void)
{
+ /* Install configuration write function. */
+ install_node(&table_node, config_write_table);
+ install_node(&forwarding_node, config_write_forwarding);
+
+ install_element(VIEW_NODE, &show_ip_forwarding_cmd);
+ install_element(CONFIG_NODE, &ip_forwarding_cmd);
+ install_element(CONFIG_NODE, &no_ip_forwarding_cmd);
+ install_element(ENABLE_NODE, &show_zebra_cmd);
+
+#ifdef HAVE_NETLINK
+ install_element(VIEW_NODE, &show_table_cmd);
+ install_element(CONFIG_NODE, &config_table_cmd);
+ install_element(CONFIG_NODE, &no_config_table_cmd);
+#endif /* HAVE_NETLINK */
+
+ install_element(VIEW_NODE, &show_ipv6_forwarding_cmd);
+ install_element(CONFIG_NODE, &ipv6_forwarding_cmd);
+ install_element(CONFIG_NODE, &no_ipv6_forwarding_cmd);
+
+ /* Route-map */
+ zebra_route_map_init();
+
install_node(&ip_node, zebra_ip_config);
install_node(&protocol_node, config_write_protocol);
#include "zebra/router-id.h"
#include "zebra/redistribute.h"
#include "zebra/debug.h"
-#include "zebra/ipforward.h"
#include "zebra/zebra_rnh.h"
#include "zebra/rt_netlink.h"
#include "zebra/interface.h"
return NULL;
}
-#ifdef HAVE_NETLINK
-/* Display default rtm_table for all clients. */
-DEFUN (show_table,
- show_table_cmd,
- "show table",
- SHOW_STR
- "default routing table to use for all clients\n")
-{
- vty_out(vty, "table %d\n", zebrad.rtm_table_default);
- return CMD_SUCCESS;
-}
-
-DEFUN (config_table,
- config_table_cmd,
- "table TABLENO",
- "Configure target kernel routing table\n"
- "TABLE integer\n")
-{
- zebrad.rtm_table_default = strtol(argv[1]->arg, (char **)0, 10);
- return CMD_SUCCESS;
-}
-
-DEFUN (no_config_table,
- no_config_table_cmd,
- "no table [TABLENO]",
- NO_STR
- "Configure target kernel routing table\n"
- "TABLE integer\n")
-{
- zebrad.rtm_table_default = 0;
- return CMD_SUCCESS;
-}
-#endif
-
-DEFUN (ip_forwarding,
- ip_forwarding_cmd,
- "ip forwarding",
- IP_STR
- "Turn on IP forwarding\n")
-{
- int ret;
-
- ret = ipforward();
- if (ret == 0)
- ret = ipforward_on();
-
- if (ret == 0) {
- vty_out(vty, "Can't turn on IP forwarding\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ip_forwarding,
- no_ip_forwarding_cmd,
- "no ip forwarding",
- NO_STR
- IP_STR
- "Turn off IP forwarding\n")
-{
- int ret;
-
- ret = ipforward();
- if (ret != 0)
- ret = ipforward_off();
-
- if (ret != 0) {
- vty_out(vty, "Can't turn off IP forwarding\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (show_zebra,
- show_zebra_cmd,
- "show zebra",
- SHOW_STR
- ZEBRA_STR)
-{
- struct vrf *vrf;
-
- vty_out(vty,
- " Route Route Neighbor LSP LSP\n");
- vty_out(vty,
- "VRF Installs Removals Updates Installs Removals\n");
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- struct zebra_vrf *zvrf = vrf->info;
- vty_out(vty, "%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64
- " %10" PRIu64 " %10" PRIu64 "\n",
- vrf->name, zvrf->installs, zvrf->removals,
- zvrf->neigh_updates, zvrf->lsp_installs,
- zvrf->lsp_removals);
- }
-
- return CMD_SUCCESS;
-}
-
/* This command is for debugging purpose. */
DEFUN (show_zebra_client,
show_zebra_client_cmd,
return CMD_SUCCESS;
}
-/* Table configuration write function. */
-static int config_write_table(struct vty *vty)
-{
- if (zebrad.rtm_table_default)
- vty_out(vty, "table %d\n", zebrad.rtm_table_default);
- return 0;
-}
-
-/* table node for routing tables. */
-static struct cmd_node table_node = {TABLE_NODE,
- "", /* This node has no interface. */
- 1};
-
-/* Only display ip forwarding is enabled or not. */
-DEFUN (show_ip_forwarding,
- show_ip_forwarding_cmd,
- "show ip forwarding",
- SHOW_STR
- IP_STR
- "IP forwarding status\n")
-{
- int ret;
-
- ret = ipforward();
-
- if (ret == 0)
- vty_out(vty, "IP forwarding is off\n");
- else
- vty_out(vty, "IP forwarding is on\n");
- return CMD_SUCCESS;
-}
-
-/* Only display ipv6 forwarding is enabled or not. */
-DEFUN (show_ipv6_forwarding,
- show_ipv6_forwarding_cmd,
- "show ipv6 forwarding",
- SHOW_STR
- "IPv6 information\n"
- "Forwarding status\n")
-{
- int ret;
-
- ret = ipforward_ipv6();
-
- switch (ret) {
- case -1:
- vty_out(vty, "ipv6 forwarding is unknown\n");
- break;
- case 0:
- vty_out(vty, "ipv6 forwarding is %s\n", "off");
- break;
- case 1:
- vty_out(vty, "ipv6 forwarding is %s\n", "on");
- break;
- default:
- vty_out(vty, "ipv6 forwarding is %s\n", "off");
- break;
- }
- return CMD_SUCCESS;
-}
-
-DEFUN (ipv6_forwarding,
- ipv6_forwarding_cmd,
- "ipv6 forwarding",
- IPV6_STR
- "Turn on IPv6 forwarding\n")
-{
- int ret;
-
- ret = ipforward_ipv6();
- if (ret == 0)
- ret = ipforward_ipv6_on();
-
- if (ret == 0) {
- vty_out(vty, "Can't turn on IPv6 forwarding\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ipv6_forwarding,
- no_ipv6_forwarding_cmd,
- "no ipv6 forwarding",
- NO_STR
- IPV6_STR
- "Turn off IPv6 forwarding\n")
-{
- int ret;
-
- ret = ipforward_ipv6();
- if (ret != 0)
- ret = ipforward_ipv6_off();
-
- if (ret != 0) {
- vty_out(vty, "Can't turn off IPv6 forwarding\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- return CMD_SUCCESS;
-}
-
-/* IPForwarding configuration write function. */
-static int config_write_forwarding(struct vty *vty)
-{
- /* FIXME: Find better place for that. */
- router_id_write(vty);
-
- if (!ipforward())
- vty_out(vty, "no ip forwarding\n");
- if (!ipforward_ipv6())
- vty_out(vty, "no ipv6 forwarding\n");
- vty_out(vty, "!\n");
- return 0;
-}
-
-/* table node for routing tables. */
-static struct cmd_node forwarding_node = {FORWARDING_NODE,
- "", /* This node has no interface. */
- 1};
-
#if defined(HANDLE_ZAPI_FUZZING)
void zserv_read_file(char *input)
{
}
#endif
-/* Initialisation of zebra and installation of commands. */
-void zebra_init(void)
+void zserv_init(void)
{
/* Client list init. */
zebrad.client_list = list_new();
zebrad.client_list->del = (void (*)(void *))zebra_client_free;
- /* Install configuration write function. */
- install_node(&table_node, config_write_table);
- install_node(&forwarding_node, config_write_forwarding);
-
- install_element(VIEW_NODE, &show_ip_forwarding_cmd);
- install_element(CONFIG_NODE, &ip_forwarding_cmd);
- install_element(CONFIG_NODE, &no_ip_forwarding_cmd);
- install_element(ENABLE_NODE, &show_zebra_cmd);
install_element(ENABLE_NODE, &show_zebra_client_cmd);
install_element(ENABLE_NODE, &show_zebra_client_summary_cmd);
-
-#ifdef HAVE_NETLINK
- install_element(VIEW_NODE, &show_table_cmd);
- install_element(CONFIG_NODE, &config_table_cmd);
- install_element(CONFIG_NODE, &no_config_table_cmd);
-#endif /* HAVE_NETLINK */
-
- install_element(VIEW_NODE, &show_ipv6_forwarding_cmd);
- install_element(CONFIG_NODE, &ipv6_forwarding_cmd);
- install_element(CONFIG_NODE, &no_ipv6_forwarding_cmd);
-
- /* Route-map */
- zebra_route_map_init();
}
extern unsigned int multipath_num;
/* Prototypes. */
-extern void zebra_init(void);
-extern void zebra_if_init(void);
+extern void zserv_init(void);
extern void zebra_zserv_socket_init(char *path);
-extern void hostinfo_get(void);
-extern void rib_init(void);
-extern void interface_list(struct zebra_ns *);
-extern void route_read(struct zebra_ns *);
-extern void macfdb_read(struct zebra_ns *);
-extern void macfdb_read_for_bridge(struct zebra_ns *, struct interface *,
- struct interface *);
-extern void neigh_read(struct zebra_ns *);
-extern void neigh_read_for_vlan(struct zebra_ns *, struct interface *);
-extern void kernel_init(struct zebra_ns *);
-extern void kernel_terminate(struct zebra_ns *);
-extern void zebra_route_map_init(void);
-extern void zebra_vty_init(void);
extern int zsend_vrf_add(struct zserv *, struct zebra_vrf *);
extern int zsend_vrf_delete(struct zserv *, struct zebra_vrf *);
vrf_id_t vrf_id, struct prefix *p,
enum zapi_route_notify_owner note);
-extern pid_t pid;
-
extern void zserv_create_header(struct stream *s, uint16_t cmd,
vrf_id_t vrf_id);
extern void zserv_nexthop_num_warn(const char *, const struct prefix *,