}
/* 1 space + lcom->size lcom strings + null terminator */
- size_t str_buf_sz = BUFSIZ;
+ size_t str_buf_sz = (LCOMMUNITY_STRLEN * lcom->size) + 2;
str_buf = XCALLOC(MTYPE_LCOMMUNITY_STR, str_buf_sz);
+ len = 0;
for (i = 0; i < lcom->size; i++) {
if (i > 0)
- strlcat(str_buf, " ", str_buf_sz);
+ len = strlcat(str_buf, " ", str_buf_sz);
pnt = lcom->val + (i * LCOMMUNITY_SIZE);
pnt = ptr_get_be32(pnt, &global);
snprintf(lcsb, sizeof(lcsb), "%u:%u:%u", global, local1,
local2);
+ /*
+ * Aliases can cause havoc, if the alias length is greater
+ * than the LCOMMUNITY_STRLEN for a particular item
+ * then we need to realloc the memory associated
+ * with the string so that it can fit
+ */
const char *com2alias =
translate_alias ? bgp_community2alias(lcsb) : lcsb;
+ size_t individual_len = strlen(com2alias);
+ if (individual_len + len > str_buf_sz) {
+ str_buf_sz = individual_len + len + 1;
+ str_buf = XREALLOC(MTYPE_LCOMMUNITY_STR, str_buf,
+ str_buf_sz);
+ }
len = strlcat(str_buf, com2alias, str_buf_sz);
- assert((unsigned int)len < str_buf_sz);
if (make_json) {
json_string = json_object_new_string(com2alias);
struct affinity_map *map;
uint16_t pos;
+ if (!isis)
+ return false;
+
map = affinity_map_get(affmap_name);
pos = map->bit_position;
struct flex_algo *fa;
bool changed;
+ if (!isis)
+ return;
+
for (ALL_LIST_ELEMENTS_RO(isis->area_list, area_node, area)) {
changed = false;
for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, fa_node,
{
bool ret;
struct isis_ext_subtlvs *subtlvs = reach->subtlvs;
- uint8_t lspid_orig[ISIS_SYS_ID_LEN + 2];
- uint8_t lspid_neigh[ISIS_SYS_ID_LEN + 2];
struct isis_router_cap_fad *fad;
struct isis_asla_subtlvs *asla;
struct listnode *node;
if (link_admin_group && link_ext_admin_group) {
link_ext_admin_group_bitmap0 =
admin_group_get_offset(link_ext_admin_group, 0);
- if (*link_admin_group != link_ext_admin_group_bitmap0) {
- memcpy(lspid_orig, lsp->hdr.lsp_id,
- ISIS_SYS_ID_LEN + 2);
- memcpy(lspid_neigh, reach->id, ISIS_SYS_ID_LEN + 2);
+ if (*link_admin_group != link_ext_admin_group_bitmap0)
zlog_warn(
- "ISIS-SPF: LSP from %pLS neighbor %pLS. Admin-group 0x%08x differs from ext admin-group 0x%08x.",
- lspid_orig, lspid_neigh, *link_admin_group,
+ "ISIS-SPF: LSP from %pPN neighbor %pPN. Admin-group 0x%08x differs from ext admin-group 0x%08x.",
+ lsp->hdr.lsp_id, reach->id, *link_admin_group,
link_ext_admin_group_bitmap0);
- }
}
/*
spftree = area->spftree[SPFTREE_IPV4]
[level - 1];
- isis_print_spftree(vty, spftree);
+ if (!json)
+ isis_print_spftree(vty, spftree);
isis_print_routes(vty, spftree,
json ? &json_val : NULL,
spftree = area->spftree[SPFTREE_IPV6]
[level - 1];
- isis_print_spftree(vty, spftree);
+ if (!json)
+ isis_print_spftree(vty, spftree);
isis_print_routes(vty, spftree,
json ? &json_val : NULL,
spftree = area->spftree[SPFTREE_DSTSRC]
[level - 1];
- isis_print_spftree(vty, spftree);
+ if (!json)
+ isis_print_spftree(vty, spftree);
isis_print_routes(vty, spftree,
json ? &json_val : NULL,
prefix_sid, backup);
for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, node,
fa)) {
data = fa->data;
- if (data->spftree[level - 1]) {
+ if (data->spftree[tree][level - 1]) {
isis_spftree_del(
data->spftree[tree][level - 1]);
data->spftree[tree][level - 1] = NULL;
fd = open(filename, O_RDONLY | O_NOCTTY);
if (fd < 0 || fstat(fd, &st)) {
PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename);
- close(fd);
+ if (fd > 0)
+ close(fd);
goto out;
}
w->len = st.st_size;
char timebuf[RIP_UPTIME_LEN];
for (ALL_LIST_ELEMENTS(rip->peer_list, node, nnode, peer)) {
- vty_out(vty, " %-16pI4 %9d %9d %9d %s\n",
+ vty_out(vty, " %-17pI4 %9d %9d %9d %11s\n",
&peer->addr, peer->recv_badpackets,
peer->recv_badroutes, ZEBRA_RIP_DISTANCE_DEFAULT,
rip_peer_uptime(peer, timebuf, RIP_UPTIME_LEN));
r1-eth3
Routing Information Sources:
Gateway BadPackets BadRoutes Distance Last Update
- 193.1.1.2 0 0 120 XX:XX:XX
+ 193.1.1.2 0 0 120 XX:XX:XX
Distance: (default is 120)
193.1.2.0/24
Routing Information Sources:
Gateway BadPackets BadRoutes Distance Last Update
- 193.1.1.1 0 0 120 XX:XX:XX
- 193.1.2.2 0 0 120 XX:XX:XX
+ 193.1.1.1 0 0 120 XX:XX:XX
+ 193.1.2.2 0 0 120 XX:XX:XX
Distance: (default is 120)
193.1.2.0/24
Routing Information Sources:
Gateway BadPackets BadRoutes Distance Last Update
- 193.1.2.1 0 0 120 XX:XX:XX
+ 193.1.2.1 0 0 120 XX:XX:XX
Distance: (default is 120)
atomic_fetch_add_explicit(
&zdplane_info.dg_gre_set_errors, 1,
memory_order_relaxed);
- if (ctx)
- dplane_ctx_free(&ctx);
+ dplane_ctx_free(&ctx);
result = ZEBRA_DPLANE_REQUEST_FAILURE;
}
return result;