summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2022-08-15 18:10:03 -0400
committerGitHub <noreply@github.com>2022-08-15 18:10:03 -0400
commit261e70c66a5d6f637fef33d59ab580a52f3e3203 (patch)
treec351859c77b0148bf0d845d72262a34b9f1d1b38
parente1a39919e15a66897cbc5dc6f10282bce383c6f8 (diff)
parent7a8120da5a059f0f4cb11a2e52b1ff51ae8e6619 (diff)
Merge pull request #11804 from donaldsharp/aug_coverity_update
Aug coverity update
-rw-r--r--bgpd/bgp_evpn_vty.c3
-rw-r--r--lib/link_state.c5
-rw-r--r--nhrpd/nhrp_peer.c3
-rw-r--r--pathd/path_pcep_pcc.c2
-rw-r--r--pbrd/pbr_vty.c54
-rw-r--r--pimd/pim_cmd.c3
-rw-r--r--pimd/pim_ifchannel.c52
-rw-r--r--pimd/pim_upstream.c16
-rw-r--r--watchfrr/watchfrr.c2
-rw-r--r--zebra/zebra_dplane.c6
10 files changed, 99 insertions, 47 deletions
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 797075563b..6ba516c39c 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -4036,6 +4036,9 @@ DEFUN (no_bgp_evpn_advertise_type5,
afi_t afi = 0;
safi_t safi = 0;
+ if (!bgp_vrf)
+ return CMD_WARNING;
+
argv_find_and_parse_afi(argv, argc, &idx_afi, &afi);
argv_find_and_parse_safi(argv, argc, &idx_safi, &safi);
diff --git a/lib/link_state.c b/lib/link_state.c
index 0ef87b7a51..ab5a8515b5 100644
--- a/lib/link_state.c
+++ b/lib/link_state.c
@@ -1791,9 +1791,10 @@ struct ls_edge *ls_msg2edge(struct ls_ted *ted, struct ls_message *msg,
case LS_MSG_EVENT_DELETE:
edge = ls_find_edge_by_source(ted, attr);
if (edge) {
- if (delete)
+ if (delete) {
ls_edge_del_all(ted, edge);
- else
+ edge = NULL;
+ } else
edge->status = DELETE;
}
break;
diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c
index 4b03032566..e7f2eaf5a7 100644
--- a/nhrpd/nhrp_peer.c
+++ b/nhrpd/nhrp_peer.c
@@ -17,6 +17,7 @@
#include "memory.h"
#include "thread.h"
#include "hash.h"
+#include "network.h"
#include "nhrpd.h"
#include "nhrp_protocol.h"
@@ -334,7 +335,7 @@ int nhrp_peer_check(struct nhrp_peer *p, int establish)
&p->t_fallback);
} else {
/* Maximum timeout is 1 second */
- int r_time_ms = rand() % 1000;
+ int r_time_ms = frr_weak_random() % 1000;
debugf(NHRP_DEBUG_COMMON,
"Initiating IPsec connection request to %pSU after %d ms:",
diff --git a/pathd/path_pcep_pcc.c b/pathd/path_pcep_pcc.c
index b72a536ef4..a1c56f93ad 100644
--- a/pathd/path_pcep_pcc.c
+++ b/pathd/path_pcep_pcc.c
@@ -1326,9 +1326,9 @@ void handle_pcep_lsp_initiate(struct ctrl_state *ctrl_state,
* possibly disconnect and blacklist */
flog_warn(EC_PATH_PCEP_UNSUPPORTED_PCEP_FEATURE,
"Unsupported PCEP protocol feature: %s", err);
- pcep_free_path(path);
send_pcep_error(pcc_state, PCEP_ERRT_INVALID_OPERATION,
PCEP_ERRV_LSP_NOT_PCE_INITIATED, path);
+ pcep_free_path(path);
}
}
diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c
index d68bcfa160..a2b3431b94 100644
--- a/pbrd/pbr_vty.c
+++ b/pbrd/pbr_vty.c
@@ -137,6 +137,9 @@ DEFPY(pbr_map_match_src, pbr_map_match_src_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
if (pbrms->dst && pbrms->family && prefix->family != pbrms->family) {
vty_out(vty, "Cannot mismatch families within match src/dst\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -170,6 +173,9 @@ DEFPY(pbr_map_match_dst, pbr_map_match_dst_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
if (pbrms->src && pbrms->family && prefix->family != pbrms->family) {
vty_out(vty, "Cannot mismatch families within match src/dst\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -204,6 +210,9 @@ DEFPY(pbr_map_match_ip_proto, pbr_map_match_ip_proto_cmd,
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
struct protoent *p;
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
if (!no) {
p = getprotobyname(ip_proto);
if (!p) {
@@ -228,6 +237,9 @@ DEFPY(pbr_map_match_src_port, pbr_map_match_src_port_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
if (!no) {
if (pbrms->src_prt == port)
return CMD_SUCCESS;
@@ -250,6 +262,9 @@ DEFPY(pbr_map_match_dst_port, pbr_map_match_dst_port_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
if (!no) {
if (pbrms->dst_prt == port)
return CMD_SUCCESS;
@@ -274,6 +289,9 @@ DEFPY(pbr_map_match_dscp, pbr_map_match_dscp_cmd,
char dscpname[100];
uint8_t rawDscp;
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
/* Discriminate dscp enums (cs0, cs1 etc.) and numbers */
bool isANumber = true;
for (int i = 0; i < (int)strlen(dscp); i++) {
@@ -333,6 +351,9 @@ DEFPY(pbr_map_match_ecn, pbr_map_match_ecn_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
if (!no) {
if ((pbrms->dsfield & PBR_DSFIELD_ECN) == ecn)
return CMD_SUCCESS;
@@ -357,6 +378,9 @@ DEFPY(pbr_map_match_mark, pbr_map_match_mark_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
#ifndef GNU_LINUX
vty_out(vty, "pbr marks are not supported on this platform\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -417,6 +441,9 @@ DEFPY(pbr_map_action_queue_id, pbr_map_action_queue_id_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
if (!no)
pbrms->action_queue_id = queue_id;
else if ((uint32_t)queue_id == pbrms->action_queue_id)
@@ -435,6 +462,9 @@ DEFPY(pbr_map_action_pcp, pbr_map_action_pcp_cmd, "[no] set pcp <(0-7)$pcp>",
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
if (!no)
pbrms->action_pcp = pcp;
else if (pcp == pbrms->action_pcp)
@@ -454,6 +484,9 @@ DEFPY(pbr_map_action_vlan_id, pbr_map_action_vlan_id_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
if (!no)
pbrms->action_vlan_id = vlan_id;
else if (pbrms->action_vlan_id == vlan_id)
@@ -472,6 +505,9 @@ DEFPY(pbr_map_action_strip_vlan, pbr_map_action_strip_vlan_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
if (!no)
pbrms->action_vlan_flags = PBR_MAP_STRIP_INNER_ANY;
else
@@ -492,6 +528,9 @@ DEFPY(pbr_map_nexthop_group, pbr_map_nexthop_group_cmd,
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
struct nexthop_group_cmd *nhgc;
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
nhgc = nhgc_find(name);
if (!nhgc) {
vty_out(vty, "Specified nexthop-group %s does not exist\n",
@@ -522,6 +561,9 @@ DEFPY(no_pbr_map_nexthop_group, no_pbr_map_nexthop_group_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
pbrms_clear_set_config(pbrms);
return CMD_SUCCESS;
@@ -548,6 +590,9 @@ DEFPY(pbr_map_nexthop, pbr_map_nexthop_cmd,
struct nexthop nhop;
struct nexthop *nh = NULL;
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
if (vrf_name)
vrf = vrf_lookup_by_name(vrf_name);
else
@@ -670,6 +715,9 @@ DEFPY(no_pbr_map_nexthop, no_pbr_map_nexthop_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
pbrms_clear_set_config(pbrms);
return CMD_SUCCESS;
@@ -684,6 +732,9 @@ DEFPY(pbr_map_vrf, pbr_map_vrf_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
/*
* If an equivalent set vrf * exists, just return success.
*/
@@ -722,6 +773,9 @@ DEFPY(no_pbr_map_vrf, no_pbr_map_vrf_cmd,
{
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
+ if (!pbrms)
+ return CMD_WARNING_CONFIG_FAILED;
+
pbrms_clear_set_config(pbrms);
return CMD_SUCCESS;
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index a3188128fa..c2453efa06 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -5526,12 +5526,13 @@ DEFUN (show_ip_msdp_mesh_group,
int idx = 2;
struct pim_msdp_mg *mg;
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- struct pim_instance *pim = vrf->info;
+ struct pim_instance *pim;
struct json_object *json = NULL;
if (!vrf)
return CMD_WARNING;
+ pim = vrf->info;
/* Quick case: list is empty. */
if (SLIST_EMPTY(&pim->msdp.mglist)) {
if (uj)
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index ac2eee0a30..ce252366ce 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -539,10 +539,7 @@ struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp, pim_sgaddr *sg,
if (up_flags == PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)
PIM_IF_FLAG_SET_PROTO_IGMP(ch->flags);
- if (ch->upstream)
- ch->upstream->flags |= up_flags;
- else if (PIM_DEBUG_EVENTS)
- zlog_debug("%s:%pSG No Upstream found", __func__, sg);
+ ch->upstream->flags |= up_flags;
return ch;
}
@@ -637,8 +634,7 @@ static void ifjoin_to_noinfo(struct pim_ifchannel *ch)
pim_ifchannel_ifjoin_switch(__func__, ch, PIM_IFJOIN_NOINFO);
pim_forward_stop(ch);
- if (ch->upstream)
- PIM_UPSTREAM_FLAG_UNSET_SRC_PIM(ch->upstream->flags);
+ PIM_UPSTREAM_FLAG_UNSET_SRC_PIM(ch->upstream->flags);
PIM_IF_FLAG_UNSET_PROTO_PIM(ch->flags);
@@ -696,31 +692,29 @@ static void on_ifjoin_prune_pending_timer(struct thread *t)
* message on RP path upon prune timer expiry.
*/
ch->ifjoin_state = PIM_IFJOIN_PRUNE;
- if (ch->upstream) {
- struct pim_upstream *parent =
- ch->upstream->parent;
+ struct pim_upstream *parent =
+ ch->upstream->parent;
- pim_upstream_update_join_desired(pim_ifp->pim,
- ch->upstream);
+ pim_upstream_update_join_desired(pim_ifp->pim,
+ ch->upstream);
- pim_jp_agg_single_upstream_send(&parent->rpf,
- parent, true);
- /*
- * SGRpt prune pending expiry has to install
- * SG entry with empty olist to drop the SG
- * traffic incase no other intf exists.
- * On that scenario, SG entry wouldn't have
- * got installed until Prune pending timer
- * expired. So install now.
- */
- pim_channel_del_oif(
- ch->upstream->channel_oil, ifp,
- PIM_OIF_FLAG_PROTO_STAR, __func__);
- if (!ch->upstream->channel_oil->installed)
- pim_upstream_mroute_add(
- ch->upstream->channel_oil,
- __func__);
- }
+ pim_jp_agg_single_upstream_send(&parent->rpf,
+ parent, true);
+ /*
+ * SGRpt prune pending expiry has to install
+ * SG entry with empty olist to drop the SG
+ * traffic incase no other intf exists.
+ * On that scenario, SG entry wouldn't have
+ * got installed until Prune pending timer
+ * expired. So install now.
+ */
+ pim_channel_del_oif(
+ ch->upstream->channel_oil, ifp,
+ PIM_OIF_FLAG_PROTO_STAR, __func__);
+ if (!ch->upstream->channel_oil->installed)
+ pim_upstream_mroute_add(
+ ch->upstream->channel_oil,
+ __func__);
}
/* from here ch may have been deleted */
}
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index 25e7e52705..0742daa4de 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -1061,15 +1061,13 @@ struct pim_upstream *pim_upstream_add(struct pim_instance *pim, pim_sgaddr *sg,
}
if (PIM_DEBUG_PIM_TRACE) {
- if (up)
- zlog_debug("%s(%s): %s, iif %pPA (%s) found: %d: ref_count: %d",
- __func__, name,
- up->sg_str, &up->rpf.rpf_addr, up->rpf.source_nexthop.interface ?
- up->rpf.source_nexthop.interface->name : "Unknown" ,
- found, up->ref_count);
- else
- zlog_debug("%s(%s): (%pSG) failure to create", __func__,
- name, sg);
+ zlog_debug(
+ "%s(%s): %s, iif %pPA (%s) found: %d: ref_count: %d",
+ __func__, name, up->sg_str, &up->rpf.rpf_addr,
+ up->rpf.source_nexthop.interface ? up->rpf.source_nexthop
+ .interface->name
+ : "Unknown",
+ found, up->ref_count);
}
return up;
diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c
index fc285c748a..423f25faa2 100644
--- a/watchfrr/watchfrr.c
+++ b/watchfrr/watchfrr.c
@@ -1429,7 +1429,7 @@ int main(int argc, char **argv)
if ((sscanf(optarg, "%ld%1s", &gs.operational_timeout,
garbage) != 1) ||
- (gs.max_restart_interval < 0)) {
+ (gs.operational_timeout < 0)) {
fprintf(stderr,
"Invalid Operational_timeout argument: %s\n",
optarg);
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index 4c7838198e..fd170450f1 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -3422,7 +3422,7 @@ static enum zebra_dplane_result
dplane_nexthop_update_internal(struct nhg_hash_entry *nhe, enum dplane_op_e op)
{
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
- int ret = EINVAL;
+ int ret;
struct zebra_dplane_ctx *ctx = NULL;
/* Obtain context block */
@@ -3700,7 +3700,7 @@ dplane_lsp_notif_update(struct zebra_lsp *lsp, enum dplane_op_e op,
struct zebra_dplane_ctx *notif_ctx)
{
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
- int ret = EINVAL;
+ int ret;
struct zebra_dplane_ctx *ctx = NULL;
struct nhlfe_list_head *head;
struct zebra_nhlfe *nhlfe, *new_nhlfe;
@@ -4075,7 +4075,7 @@ static enum zebra_dplane_result
dplane_intf_update_internal(const struct interface *ifp, enum dplane_op_e op)
{
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
- int ret = EINVAL;
+ int ret;
struct zebra_dplane_ctx *ctx = NULL;
/* Obtain context block */