summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_lcommunity.c18
-rw-r--r--isisd/isis_affinitymap.c6
-rw-r--r--isisd/isis_flex_algo.c12
-rw-r--r--isisd/isis_spf.c9
-rw-r--r--isisd/isisd.c2
-rw-r--r--lib/elf_py.c3
-rw-r--r--pimd/pim6_mld.c13
-rw-r--r--pimd/pim_zebra.c2
-rw-r--r--ripd/rip_peer.c2
-rw-r--r--tests/topotests/rip_topo1/r1/rip_status.ref2
-rw-r--r--tests/topotests/rip_topo1/r2/rip_status.ref4
-rw-r--r--tests/topotests/rip_topo1/r3/rip_status.ref2
-rw-r--r--zebra/zebra_dplane.c3
13 files changed, 54 insertions, 24 deletions
diff --git a/bgpd/bgp_lcommunity.c b/bgpd/bgp_lcommunity.c
index 15bf419868..1b8c22a503 100644
--- a/bgpd/bgp_lcommunity.c
+++ b/bgpd/bgp_lcommunity.c
@@ -197,12 +197,13 @@ static void set_lcommunity_string(struct lcommunity *lcom, bool make_json,
}
/* 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);
@@ -215,11 +216,22 @@ static void set_lcommunity_string(struct lcommunity *lcom, bool make_json,
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);
diff --git a/isisd/isis_affinitymap.c b/isisd/isis_affinitymap.c
index e681e820be..41bad0a7d9 100644
--- a/isisd/isis_affinitymap.c
+++ b/isisd/isis_affinitymap.c
@@ -20,6 +20,9 @@ static bool isis_affinity_map_check_use(const char *affmap_name)
struct affinity_map *map;
uint16_t pos;
+ if (!isis)
+ return false;
+
map = affinity_map_get(affmap_name);
pos = map->bit_position;
@@ -46,6 +49,9 @@ static void isis_affinity_map_update(const char *affmap_name, uint16_t old_pos,
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,
diff --git a/isisd/isis_flex_algo.c b/isisd/isis_flex_algo.c
index 742a862fcd..0efc519eab 100644
--- a/isisd/isis_flex_algo.c
+++ b/isisd/isis_flex_algo.c
@@ -243,8 +243,6 @@ bool isis_flex_algo_constraint_drop(struct isis_spftree *spftree,
{
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;
@@ -286,15 +284,11 @@ bool isis_flex_algo_constraint_drop(struct isis_spftree *spftree,
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);
- }
}
/*
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index 732853796a..466e96b3a2 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -2884,7 +2884,8 @@ static void show_isis_route_common(struct vty *vty, int levels,
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,
@@ -2905,7 +2906,8 @@ static void show_isis_route_common(struct vty *vty, int levels,
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,
@@ -2927,7 +2929,8 @@ static void show_isis_route_common(struct vty *vty, int levels,
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);
diff --git a/isisd/isisd.c b/isisd/isisd.c
index f65d21405b..4b01a18ecd 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -3144,7 +3144,7 @@ static void area_resign_level(struct isis_area *area, int level)
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;
diff --git a/lib/elf_py.c b/lib/elf_py.c
index 05f5aef766..d473dc10cb 100644
--- a/lib/elf_py.c
+++ b/lib/elf_py.c
@@ -1140,7 +1140,8 @@ static PyObject *elffile_load(PyTypeObject *type, PyObject *args,
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;
diff --git a/pimd/pim6_mld.c b/pimd/pim6_mld.c
index e74707b522..74cd729d44 100644
--- a/pimd/pim6_mld.c
+++ b/pimd/pim6_mld.c
@@ -2471,6 +2471,19 @@ static void gm_show_if_vrf(struct vty *vty, struct vrf *vrf, const char *ifname,
if (js) {
js_if = json_object_new_object();
+ /*
+ * If we have js as true and detail as false
+ * and if Coverity thinks that js_if is NULL
+ * because of a failed call to new then
+ * when we call gm_show_if_one below
+ * the tt can be deref'ed and as such
+ * FRR will crash. But since we know
+ * that json_object_new_object never fails
+ * then let's tell Coverity that this assumption
+ * is true. I'm not worried about fast path
+ * here at all.
+ */
+ assert(js_if);
json_object_object_add(js_vrf, ifp->name, js_if);
}
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index 97b68c0a32..92dcbf9d1d 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -68,6 +68,8 @@ static int pim_zebra_interface_vrf_update(ZAPI_CALLBACK_ARGS)
vrf_id, new_vrf_id);
pim = pim_get_pim_instance(new_vrf_id);
+ if (!pim)
+ return 0;
if_update_to_new_vrf(ifp, new_vrf_id);
diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c
index 9410ef380e..c1ab5b14aa 100644
--- a/ripd/rip_peer.c
+++ b/ripd/rip_peer.c
@@ -136,7 +136,7 @@ void rip_peer_display(struct vty *vty, struct rip *rip)
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));
diff --git a/tests/topotests/rip_topo1/r1/rip_status.ref b/tests/topotests/rip_topo1/r1/rip_status.ref
index 31ad46ab2e..19fff1a828 100644
--- a/tests/topotests/rip_topo1/r1/rip_status.ref
+++ b/tests/topotests/rip_topo1/r1/rip_status.ref
@@ -18,5 +18,5 @@ Routing Protocol is "rip"
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)
diff --git a/tests/topotests/rip_topo1/r2/rip_status.ref b/tests/topotests/rip_topo1/r2/rip_status.ref
index 99841a62b0..468b7aece8 100644
--- a/tests/topotests/rip_topo1/r2/rip_status.ref
+++ b/tests/topotests/rip_topo1/r2/rip_status.ref
@@ -14,6 +14,6 @@ Routing Protocol is "rip"
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)
diff --git a/tests/topotests/rip_topo1/r3/rip_status.ref b/tests/topotests/rip_topo1/r3/rip_status.ref
index 040d3c32a1..f423e83f24 100644
--- a/tests/topotests/rip_topo1/r3/rip_status.ref
+++ b/tests/topotests/rip_topo1/r3/rip_status.ref
@@ -12,5 +12,5 @@ Routing Protocol is "rip"
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)
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index e821572c5d..f6c1fdd78e 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -5380,8 +5380,7 @@ dplane_gre_set(struct interface *ifp, struct interface *ifp_link,
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;