summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-09-13 14:37:22 +0200
committerGitHub <noreply@github.com>2018-09-13 14:37:22 +0200
commitfc6eb7d827d7373a89dd04c1d809059e9ef79f9e (patch)
tree407311c755f8251639660af2ecd05cb647085005
parentMerge pull request #3009 from pacovn/static_analysis__shadow_variables3 (diff)
parentbgpd isisd ospf6d ospfd: variable shadowing fixes (diff)
downloadfrr-fc6eb7d827d7373a89dd04c1d809059e9ef79f9e.tar.xz
frr-fc6eb7d827d7373a89dd04c1d809059e9ef79f9e.zip
Merge pull request #3006 from pacovn/static_analysis__shadow_variables1
bgpd isisd ospf6d ospfd: variable shadowing fixes
-rw-r--r--bgpd/bgp_attr.c14
-rw-r--r--bgpd/bgp_route.c5
-rw-r--r--bgpd/bgp_routemap.c1
-rw-r--r--bgpd/bgpd.c1
-rw-r--r--bgpd/rfapi/rfapi.c2
-rw-r--r--bgpd/rfapi/rfapi_import.c6
-rw-r--r--bgpd/rfapi/rfapi_vty.c3
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c10
-rw-r--r--isisd/isis_pdu.c3
-rw-r--r--isisd/isis_tlvs.c6
-rw-r--r--ospf6d/ospf6_abr.c3
-rw-r--r--ospfd/ospf_flood.c1
-rw-r--r--ospfd/ospf_ia.c8
-rw-r--r--ospfd/ospf_nsm.c2
-rw-r--r--ospfd/ospf_packet.c2
-rw-r--r--ospfd/ospf_zebra.c2
-rw-r--r--ospfd/ospfd.c3
17 files changed, 21 insertions, 51 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 062a8a9b4..a603bbcd8 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2354,7 +2354,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
bgp_size_t size, struct bgp_nlri *mp_update,
struct bgp_nlri *mp_withdraw)
{
- int ret;
+ bgp_attr_parse_ret_t ret;
uint8_t flag = 0;
uint8_t type = 0;
bgp_size_t length;
@@ -2509,7 +2509,6 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
Attribute Flags Error. The Data field contains the erroneous
attribute (type, length and value). */
if (bgp_attr_flag_invalid(&attr_args)) {
- bgp_attr_parse_ret_t ret;
ret = bgp_attr_malformed(
&attr_args, BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR,
attr_args.total);
@@ -2647,13 +2646,10 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
}
/* Check all mandatory well-known attributes are present */
- {
- bgp_attr_parse_ret_t ret;
- if ((ret = bgp_attr_check(peer, attr)) < 0) {
- if (as4_path)
- aspath_unintern(&as4_path);
- return ret;
- }
+ if ((ret = bgp_attr_check(peer, attr)) < 0) {
+ if (as4_path)
+ aspath_unintern(&as4_path);
+ return ret;
}
/*
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 2107d1f9f..4c2df0dd0 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -4040,7 +4040,6 @@ void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi)
for (rn = bgp_table_top(peer->bgp->rib[afi][safi]); rn;
rn = bgp_route_next(rn)) {
struct bgp_node *rm;
- struct bgp_info *ri;
/* look for neighbor in tables */
if ((table = rn->info) == NULL)
@@ -4728,7 +4727,6 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,
break;
if (ri) {
- union gw_addr add;
memset(&add, 0, sizeof(union gw_addr));
if (attrhash_cmp(ri->attr, attr_new)
&& overlay_index_equal(afi, ri, bgp_static->eth_s_id, &add)
@@ -8291,8 +8289,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
continue;
}
if (type == bgp_show_type_prefix_longer) {
- struct prefix *p = output_arg;
-
+ p = output_arg;
if (!prefix_match(p, &rn->p))
continue;
}
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index bee4fca70..0b4355805 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -3086,7 +3086,6 @@ static void bgp_route_map_process_update(struct bgp *bgp, const char *rmap_name,
for (afi = AFI_IP; afi < AFI_MAX; afi++)
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
struct list *red_list;
- struct listnode *node;
struct bgp_redist *red;
red_list = bgp->redist[afi][i];
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index a9707a7fc..066db1c77 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -7332,7 +7332,6 @@ static void bgp_config_write_family(struct vty *vty, struct bgp *bgp, afi_t afi,
}
if (CHECK_FLAG(bgp->af_flags[afi][safi],
BGP_CONFIG_VRF_TO_VRF_IMPORT)) {
- struct listnode *node;
char *name;
for (ALL_LIST_ELEMENTS_RO(
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 51504bb0a..18c3c6385 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -459,8 +459,6 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
rfapiProcessWithdraw(peer, rfd, p, prd, NULL, afi, safi, type, kill);
if (bi) {
- char buf[PREFIX_STRLEN];
-
prefix2str(p, buf, sizeof(buf));
vnc_zlog_debug_verbose(
"%s: Found route (safi=%d) to delete at prefix %s",
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 4601718f1..f014f16fc 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -3678,12 +3678,12 @@ void rfapiBgpInfoFilteredImportVPN(
rfapiCopyUnEncap2VPN(ern->info, info_new);
agg_unlock_node(ern); /* undo lock in route_note_match */
} else {
- char buf[PREFIX_STRLEN];
+ char bpf[PREFIX_STRLEN];
- prefix2str(&vn_prefix, buf, sizeof(buf));
+ prefix2str(&vn_prefix, bpf, sizeof(bpf));
/* 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);
+ __func__, bpf);
info_new->extra->vnc.import.un_family = 0;
}
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index cd751319e..9f8270097 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -666,7 +666,6 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
HVTYNL);
}
if (bi->extra && bi->extra->vnc.import.aux_prefix.family) {
- char buf[BUFSIZ];
const char *sp;
sp = rfapi_ntop(bi->extra->vnc.import.aux_prefix.family,
@@ -3179,8 +3178,6 @@ static int rfapiDeleteLocalPrefixesByRFD(struct rfapi_local_reg_delete_arg *cda,
list_delete_all_node(adb_delete_list);
if (!(pPrefix && !RFAPI_0_PREFIX(pPrefix))) {
- void *cursor;
-
/*
* Caller didn't specify a prefix, or specified
* (0/32 or 0/128)
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 6022e4cc2..dc37ff89b 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -1010,13 +1010,13 @@ vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,
bgp_attr_dup(&hattr, attr); /* hattr becomes a ghost attr */
if (rmap) {
- struct bgp_info info;
+ struct bgp_info binfo;
route_map_result_t ret;
- memset(&info, 0, sizeof(info));
- info.peer = peer;
- info.attr = &hattr;
- ret = route_map_apply(rmap, prefix, RMAP_BGP, &info);
+ memset(&binfo, 0, sizeof(binfo));
+ binfo.peer = peer;
+ binfo.attr = &hattr;
+ ret = route_map_apply(rmap, prefix, RMAP_BGP, &binfo);
if (ret == RMAP_DENYMATCH) {
bgp_attr_flush(&hattr);
vnc_zlog_debug_verbose(
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index 88575f531..a335a96cd 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -1311,8 +1311,7 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit,
continue;
}
}
- struct isis_lsp *lsp =
- lsp_new(circuit->area, entry->id,
+ lsp = lsp_new(circuit->area, entry->id,
entry->rem_lifetime, 0, 0,
entry->checksum, lsp0, level);
lsp_insert(lsp,
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c
index b22460a0b..782462766 100644
--- a/isisd/isis_tlvs.c
+++ b/isisd/isis_tlvs.c
@@ -1904,9 +1904,9 @@ static void format_item_auth(uint16_t mtid, struct isis_item *i,
sbuf_push(buf, indent, " Password: %s\n", obuf);
break;
case ISIS_PASSWD_TYPE_HMAC_MD5:
- for (unsigned int i = 0; i < 16; i++) {
- snprintf(obuf + 2 * i, sizeof(obuf) - 2 * i,
- "%02" PRIx8, auth->value[i]);
+ for (unsigned int j = 0; j < 16; j++) {
+ snprintf(obuf + 2 * j, sizeof(obuf) - 2 * j,
+ "%02" PRIx8, auth->value[j]);
}
sbuf_push(buf, indent, " HMAC-MD5: %s\n", obuf);
break;
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index 7bccc78e0..586584c65 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -918,9 +918,6 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
* old as the route.
*/
if (listcount(route->paths) > 1) {
- struct listnode *anode;
- struct ospf6_path *o_path;
-
for (ALL_LIST_ELEMENTS_RO(route->paths, anode,
o_path)) {
inet_ntop(AF_INET,
diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c
index b4e9dda58..807845593 100644
--- a/ospfd/ospf_flood.c
+++ b/ospfd/ospf_flood.c
@@ -539,7 +539,6 @@ static int ospf_flood_through_interface(struct ospf_interface *oi,
IP addresses for these packets are the neighbors' IP
addresses. */
if (oi->type == OSPF_IFTYPE_NBMA) {
- struct route_node *rn;
struct ospf_neighbor *nbr;
for (rn = route_top(oi->nbrs); rn; rn = route_next(rn))
diff --git a/ospfd/ospf_ia.c b/ospfd/ospf_ia.c
index 86d15480a..f1ba8a31e 100644
--- a/ospfd/ospf_ia.c
+++ b/ospfd/ospf_ia.c
@@ -589,23 +589,19 @@ static void ospf_examine_transit_summaries(struct ospf_area *area,
void ospf_ia_routing(struct ospf *ospf, struct route_table *rt,
struct route_table *rtrs)
{
+ struct listnode *node;
struct ospf_area *area;
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("ospf_ia_routing():start");
if (IS_OSPF_ABR(ospf)) {
- struct listnode *node;
- struct ospf_area *area;
-
switch (ospf->abr_type) {
case OSPF_ABR_STAND:
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("ospf_ia_routing():Standard ABR");
if ((area = ospf->backbone)) {
- struct listnode *node;
-
if (IS_DEBUG_OSPF_EVENT) {
zlog_debug(
"ospf_ia_routing():backbone area found");
@@ -694,8 +690,6 @@ void ospf_ia_routing(struct ospf *ospf, struct route_table *rt,
break;
}
} else {
- struct listnode *node;
-
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
"ospf_ia_routing():not ABR, considering all areas");
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index 985e2efc9..fc8b516af 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -714,7 +714,7 @@ static void nsm_change_state(struct ospf_neighbor *nbr, int state)
ospf_router_lsa_update_area(oi->area);
if (oi->type == OSPF_IFTYPE_VIRTUALLINK) {
- struct ospf_area *vl_area = ospf_area_lookup_by_area_id(
+ vl_area = ospf_area_lookup_by_area_id(
oi->ospf, oi->vl_data->vl_area_id);
if (vl_area)
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 76359a539..59340fbf1 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -4091,7 +4091,7 @@ void ospf_ls_upd_send(struct ospf_neighbor *nbr, struct list *update, int flag,
ospf_lsa_lock(lsa)); /* oi->ls_upd_queue */
if (send_lsupd_now) {
struct list *send_update_list;
- struct route_node *rn, *rnext;
+ struct route_node *rnext;
for (rn = route_top(oi->ls_upd_queue); rn; rn = rnext) {
rnext = route_next(rn);
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 5dfea4378..912142b78 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -1205,7 +1205,6 @@ static void ospf_filter_update(struct access_list *access)
/* Update distribute-list, and apply filter. */
for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
struct list *red_list;
- struct listnode *node;
struct ospf_redist *red;
red_list = ospf->redist[type];
@@ -1295,7 +1294,6 @@ void ospf_prefix_list_update(struct prefix_list *plist)
*/
for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
struct list *red_list;
- struct listnode *node;
struct ospf_redist *red;
red_list = ospf->redist[type];
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index a8535fa9c..b18c5a93a 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -719,8 +719,6 @@ static void ospf_finish_final(struct ospf *ospf)
ospf_lsdb_free(ospf->lsdb);
for (rn = route_top(ospf->maxage_lsa); rn; rn = route_next(rn)) {
- struct ospf_lsa *lsa;
-
if ((lsa = rn->info) != NULL) {
ospf_lsa_unlock(&lsa);
rn->info = NULL;
@@ -756,7 +754,6 @@ static void ospf_finish_final(struct ospf *ospf)
for (i = ZEBRA_ROUTE_SYSTEM; i <= ZEBRA_ROUTE_MAX; i++) {
struct list *ext_list;
- struct listnode *node;
struct ospf_external *ext;
ext_list = ospf->external[i];