]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd isisd ospf6d ospfd: variable shadowing fixes
authorF. Aragon <paco@voltanet.io>
Wed, 12 Sep 2018 10:18:44 +0000 (12:18 +0200)
committerF. Aragon <paco@voltanet.io>
Wed, 12 Sep 2018 14:44:36 +0000 (16:44 +0200)
Signed-off-by: F. Aragon <paco@voltanet.io>
17 files changed:
bgpd/bgp_attr.c
bgpd/bgp_route.c
bgpd/bgp_routemap.c
bgpd/bgpd.c
bgpd/rfapi/rfapi.c
bgpd/rfapi/rfapi_import.c
bgpd/rfapi/rfapi_vty.c
bgpd/rfapi/vnc_import_bgp.c
isisd/isis_pdu.c
isisd/isis_tlvs.c
ospf6d/ospf6_abr.c
ospfd/ospf_flood.c
ospfd/ospf_ia.c
ospfd/ospf_nsm.c
ospfd/ospf_packet.c
ospfd/ospf_zebra.c
ospfd/ospfd.c

index 6acd4c8cf1670d4f692df891d61ab386377237aa..0a43fce2e485c5552eca6a7414027ec6b128237f 100644 (file)
@@ -2352,7 +2352,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;
@@ -2503,7 +2503,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);
@@ -2637,13 +2636,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;
        }
 
        /*
index 2107d1f9f9a18ff6e6adfd9a19ca81152655850a..4c2df0dd0a39d63e7fbdc4fe00e8a5b649710082 100644 (file)
@@ -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;
                        }
index bee4fca7051d13f7c52420786222ed4540a071db..0b4355805cf6961c75b3887f79faff5d59bdc8c5 100644 (file)
@@ -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];
index a9707a7fc73a3e3de5d2c5d1218e05fe75c2ab59..066db1c77456ec73f928927e5800cb2e0e043d50 100644 (file)
@@ -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(
index 51504bb0ad5005f907f3ae6060727f0141a1ecd6..18c3c63855f6268e7423f2bde80cee44c1c36fa6 100644 (file)
@@ -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",
index 4601718f1209e063b3bc9dff299fa228d79bea65..f014f16fc22cb61c1e2fa052e8d1ad19022088eb 100644 (file)
@@ -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;
        }
 
index cd751319eb5da387fd1e94f0a1404172ce368b6f..9f8270097a0437aa4d11cd891055dcc8aaed7b6d 100644 (file)
@@ -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)
index 6022e4cc24ac1ba883ed5994b61c0d6a5081614b..dc37ff89b50d3ca03bc491d713c55661478cab61 100644 (file)
@@ -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(
index 88575f531943770c7155aba12fa36757fd96a075..a335a96cdb6c9b674ba24193f20d3922a4166508 100644 (file)
@@ -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,
index b22460a0b5402abb914d1a45ea26aec402a114e4..782462766a0505dfb024fa1c77c01480ce0907e6 100644 (file)
@@ -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;
index 7bccc78e00882fe4f93daea760c176f2e4eaeaa6..586584c65c2b3c492d240d87ea16f8c81372b216 100644 (file)
@@ -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,
index b4e9dda58a106f51347399df61be7d0cad0caf03..8078455930bae6e521c7ec76ac1eb9d872d0820e 100644 (file)
@@ -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))
index 86d15480a369c4b6f118e32290a2e4aea92ddd5a..f1ba8a31e87c0969221bd5b79f9998280e3cbb46 100644 (file)
@@ -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");
index 1e72e3db6308f93ba136cf3e18222942a05f08bf..0a2689847700ff60715a20ddeec95f5f2ee59659 100644 (file)
@@ -713,7 +713,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)
index 56b83d22d5b7ca9f84d41f1de34959999b4737cb..bac49e0989a00421d284c023c1fb95f5481d7dd4 100644 (file)
@@ -4037,7 +4037,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);
index 8c94a8ef9949bde227fa446aa0b05d7014a7e82e..79bc838e0f7f7893fa9bfae4df1effcc9ea24370 100644 (file)
@@ -1209,7 +1209,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];
@@ -1299,7 +1298,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];
index d311b4da6b75e32664cb9796779fbfb25e78255e..1594a5df0c983863689f645ce7a6435aad1766fc 100644 (file)
@@ -722,8 +722,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;
@@ -759,7 +757,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];