forked from Mirror/frr
bgpd lib ospf6d pbrd tests zebra: shadowing fixes
This fixes all remaining local variable shadowing cases Signed-off-by: F. Aragon <paco@voltanet.io>
This commit is contained in:
parent
6efca3442f
commit
7fe96307ee
|
@ -7367,7 +7367,7 @@ DEFUN (show_bgp_vrfs,
|
||||||
for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) {
|
for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) {
|
||||||
const char *name, *type;
|
const char *name, *type;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
struct listnode *node, *nnode;
|
struct listnode *node2, *nnode2;
|
||||||
int peers_cfg, peers_estb;
|
int peers_cfg, peers_estb;
|
||||||
json_object *json_vrf = NULL;
|
json_object *json_vrf = NULL;
|
||||||
|
|
||||||
|
@ -7387,7 +7387,7 @@ DEFUN (show_bgp_vrfs,
|
||||||
json_vrf = json_object_new_object();
|
json_vrf = json_object_new_object();
|
||||||
|
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
|
for (ALL_LIST_ELEMENTS(bgp->peer, node2, nnode2, peer)) {
|
||||||
if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
|
if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
|
||||||
continue;
|
continue;
|
||||||
peers_cfg++;
|
peers_cfg++;
|
||||||
|
|
|
@ -4015,21 +4015,21 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
|
||||||
vty_out(vty, "!\n");
|
vty_out(vty, "!\n");
|
||||||
|
|
||||||
if (hc->l2_groups) {
|
if (hc->l2_groups) {
|
||||||
struct rfapi_l2_group_cfg *rfg = NULL;
|
struct rfapi_l2_group_cfg *rfgc = NULL;
|
||||||
struct listnode *gnode;
|
struct listnode *gnode;
|
||||||
for (ALL_LIST_ELEMENTS_RO(hc->l2_groups, gnode, rfg)) {
|
for (ALL_LIST_ELEMENTS_RO(hc->l2_groups, gnode, rfgc)) {
|
||||||
struct listnode *lnode;
|
struct listnode *lnode;
|
||||||
void *data;
|
void *data;
|
||||||
++write;
|
++write;
|
||||||
vty_out(vty, " vnc l2-group %s\n", rfg->name);
|
vty_out(vty, " vnc l2-group %s\n", rfgc->name);
|
||||||
if (rfg->logical_net_id != 0)
|
if (rfgc->logical_net_id != 0)
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
" logical-network-id %u\n",
|
" logical-network-id %u\n",
|
||||||
rfg->logical_net_id);
|
rfgc->logical_net_id);
|
||||||
if (rfg->labels != NULL
|
if (rfgc->labels != NULL
|
||||||
&& listhead(rfg->labels) != NULL) {
|
&& listhead(rfgc->labels) != NULL) {
|
||||||
vty_out(vty, " labels ");
|
vty_out(vty, " labels ");
|
||||||
for (ALL_LIST_ELEMENTS_RO(rfg->labels,
|
for (ALL_LIST_ELEMENTS_RO(rfgc->labels,
|
||||||
lnode,
|
lnode,
|
||||||
data)) {
|
data)) {
|
||||||
vty_out(vty, "%hu ",
|
vty_out(vty, "%hu ",
|
||||||
|
@ -4040,28 +4040,28 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rfg->rt_import_list && rfg->rt_export_list
|
if (rfgc->rt_import_list && rfgc->rt_export_list
|
||||||
&& ecommunity_cmp(rfg->rt_import_list,
|
&& ecommunity_cmp(rfgc->rt_import_list,
|
||||||
rfg->rt_export_list)) {
|
rfgc->rt_export_list)) {
|
||||||
char *b = ecommunity_ecom2str(
|
char *b = ecommunity_ecom2str(
|
||||||
rfg->rt_import_list,
|
rfgc->rt_import_list,
|
||||||
ECOMMUNITY_FORMAT_ROUTE_MAP,
|
ECOMMUNITY_FORMAT_ROUTE_MAP,
|
||||||
ECOMMUNITY_ROUTE_TARGET);
|
ECOMMUNITY_ROUTE_TARGET);
|
||||||
vty_out(vty, " rt both %s\n", b);
|
vty_out(vty, " rt both %s\n", b);
|
||||||
XFREE(MTYPE_ECOMMUNITY_STR, b);
|
XFREE(MTYPE_ECOMMUNITY_STR, b);
|
||||||
} else {
|
} else {
|
||||||
if (rfg->rt_import_list) {
|
if (rfgc->rt_import_list) {
|
||||||
char *b = ecommunity_ecom2str(
|
char *b = ecommunity_ecom2str(
|
||||||
rfg->rt_import_list,
|
rfgc->rt_import_list,
|
||||||
ECOMMUNITY_FORMAT_ROUTE_MAP,
|
ECOMMUNITY_FORMAT_ROUTE_MAP,
|
||||||
ECOMMUNITY_ROUTE_TARGET);
|
ECOMMUNITY_ROUTE_TARGET);
|
||||||
vty_out(vty, " rt import %s\n",
|
vty_out(vty, " rt import %s\n",
|
||||||
b);
|
b);
|
||||||
XFREE(MTYPE_ECOMMUNITY_STR, b);
|
XFREE(MTYPE_ECOMMUNITY_STR, b);
|
||||||
}
|
}
|
||||||
if (rfg->rt_export_list) {
|
if (rfgc->rt_export_list) {
|
||||||
char *b = ecommunity_ecom2str(
|
char *b = ecommunity_ecom2str(
|
||||||
rfg->rt_export_list,
|
rfgc->rt_export_list,
|
||||||
ECOMMUNITY_FORMAT_ROUTE_MAP,
|
ECOMMUNITY_FORMAT_ROUTE_MAP,
|
||||||
ECOMMUNITY_ROUTE_TARGET);
|
ECOMMUNITY_ROUTE_TARGET);
|
||||||
vty_out(vty, " rt export %s\n",
|
vty_out(vty, " rt export %s\n",
|
||||||
|
@ -4074,7 +4074,7 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
|
||||||
.cfg_group_cb)(
|
.cfg_group_cb)(
|
||||||
vty, bgp->rfapi->rfp,
|
vty, bgp->rfapi->rfp,
|
||||||
RFAPI_RFP_CFG_GROUP_L2,
|
RFAPI_RFP_CFG_GROUP_L2,
|
||||||
rfg->name, rfg->rfp_cfg);
|
rfgc->name, rfgc->rfp_cfg);
|
||||||
vty_out(vty, " exit-vnc\n");
|
vty_out(vty, " exit-vnc\n");
|
||||||
vty_out(vty, "!\n");
|
vty_out(vty, "!\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -2398,11 +2398,11 @@ void vnc_import_bgp_exterior_add_route_interior(
|
||||||
}
|
}
|
||||||
if (list_adopted) {
|
if (list_adopted) {
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
struct agg_node *bi_exterior;
|
struct agg_node *an_bi_exterior;
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(list_adopted, node, bi_exterior)) {
|
for (ALL_LIST_ELEMENTS_RO(list_adopted, node, an_bi_exterior)) {
|
||||||
skiplist_delete(it->monitor_exterior_orphans,
|
skiplist_delete(it->monitor_exterior_orphans,
|
||||||
bi_exterior, NULL);
|
an_bi_exterior, NULL);
|
||||||
}
|
}
|
||||||
list_delete_and_null(&list_adopted);
|
list_delete_and_null(&list_adopted);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1252,13 +1252,13 @@ static int vty_show_prefix_list_prefix(struct vty *vty, afi_t afi,
|
||||||
if (pentry->any)
|
if (pentry->any)
|
||||||
vty_out(vty, "any");
|
vty_out(vty, "any");
|
||||||
else {
|
else {
|
||||||
struct prefix *p = &pentry->prefix;
|
struct prefix *pf = &pentry->prefix;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
vty_out(vty, "%s/%d",
|
vty_out(vty, "%s/%d",
|
||||||
inet_ntop(p->family, p->u.val, buf,
|
inet_ntop(pf->family, pf->u.val, buf,
|
||||||
BUFSIZ),
|
BUFSIZ),
|
||||||
p->prefixlen);
|
pf->prefixlen);
|
||||||
|
|
||||||
if (pentry->ge)
|
if (pentry->ge)
|
||||||
vty_out(vty, " ge %d", pentry->ge);
|
vty_out(vty, " ge %d", pentry->ge);
|
||||||
|
|
|
@ -140,8 +140,8 @@ static struct ttable_cell *ttable_insert_row_va(struct ttable *tt, int i,
|
||||||
int ncols = 0;
|
int ncols = 0;
|
||||||
|
|
||||||
/* count how many columns we have */
|
/* count how many columns we have */
|
||||||
for (int i = 0; format[i]; i++)
|
for (int j = 0; format[j]; j++)
|
||||||
ncols += !!(format[i] == '|');
|
ncols += !!(format[j] == '|');
|
||||||
ncols++;
|
ncols++;
|
||||||
|
|
||||||
if (tt->ncols == 0)
|
if (tt->ncols == 0)
|
||||||
|
@ -459,7 +459,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
|
||||||
memcpy(&buf[pos], left, lsize);
|
memcpy(&buf[pos], left, lsize);
|
||||||
pos += lsize;
|
pos += lsize;
|
||||||
|
|
||||||
for (size_t i = 0; i < width - lsize - rsize; i++)
|
for (size_t l = 0; l < width - lsize - rsize; l++)
|
||||||
buf[pos++] = row[0].style.border.bottom;
|
buf[pos++] = row[0].style.border.bottom;
|
||||||
|
|
||||||
pos -= width - lsize - rsize;
|
pos -= width - lsize - rsize;
|
||||||
|
|
|
@ -111,8 +111,8 @@ extern vrf_id_t vrf_name_to_id(const char *);
|
||||||
|
|
||||||
#define VRF_GET_ID(V, NAME, USE_JSON) \
|
#define VRF_GET_ID(V, NAME, USE_JSON) \
|
||||||
do { \
|
do { \
|
||||||
struct vrf *vrf; \
|
struct vrf *_vrf; \
|
||||||
if (!(vrf = vrf_lookup_by_name(NAME))) { \
|
if (!(_vrf = vrf_lookup_by_name(NAME))) { \
|
||||||
if (USE_JSON) { \
|
if (USE_JSON) { \
|
||||||
vty_out(vty, "{}\n"); \
|
vty_out(vty, "{}\n"); \
|
||||||
} else { \
|
} else { \
|
||||||
|
@ -120,7 +120,7 @@ extern vrf_id_t vrf_name_to_id(const char *);
|
||||||
} \
|
} \
|
||||||
return CMD_WARNING; \
|
return CMD_WARNING; \
|
||||||
} \
|
} \
|
||||||
if (vrf->vrf_id == VRF_UNKNOWN) { \
|
if (_vrf->vrf_id == VRF_UNKNOWN) { \
|
||||||
if (USE_JSON) { \
|
if (USE_JSON) { \
|
||||||
vty_out(vty, "{}\n"); \
|
vty_out(vty, "{}\n"); \
|
||||||
} else { \
|
} else { \
|
||||||
|
@ -128,7 +128,7 @@ extern vrf_id_t vrf_name_to_id(const char *);
|
||||||
} \
|
} \
|
||||||
return CMD_WARNING; \
|
return CMD_WARNING; \
|
||||||
} \
|
} \
|
||||||
(V) = vrf->vrf_id; \
|
(V) = _vrf->vrf_id; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
12
lib/zebra.h
12
lib/zebra.h
|
@ -333,18 +333,18 @@ struct in_pktinfo {
|
||||||
#endif
|
#endif
|
||||||
#define MAX(a, b) \
|
#define MAX(a, b) \
|
||||||
({ \
|
({ \
|
||||||
typeof(a) _a = (a); \
|
typeof(a) _max_a = (a); \
|
||||||
typeof(b) _b = (b); \
|
typeof(b) _max_b = (b); \
|
||||||
_a > _b ? _a : _b; \
|
_max_a > _max_b ? _max_a : _max_b; \
|
||||||
})
|
})
|
||||||
#ifdef MIN
|
#ifdef MIN
|
||||||
#undef MIN
|
#undef MIN
|
||||||
#endif
|
#endif
|
||||||
#define MIN(a, b) \
|
#define MIN(a, b) \
|
||||||
({ \
|
({ \
|
||||||
typeof(a) _a = (a); \
|
typeof(a) _min_a = (a); \
|
||||||
typeof(b) _b = (b); \
|
typeof(b) _min_b = (b); \
|
||||||
_a < _b ? _a : _b; \
|
_min_a < _min_b ? _min_a : _min_b; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#ifndef offsetof
|
#ifndef offsetof
|
||||||
|
|
|
@ -72,12 +72,12 @@ extern struct thread_master *master;
|
||||||
|
|
||||||
#define threadtimer_string(now, t, buf, size) \
|
#define threadtimer_string(now, t, buf, size) \
|
||||||
do { \
|
do { \
|
||||||
struct timeval result; \
|
struct timeval _result; \
|
||||||
if (!t) \
|
if (!t) \
|
||||||
snprintf(buf, size, "inactive"); \
|
snprintf(buf, size, "inactive"); \
|
||||||
else { \
|
else { \
|
||||||
timersub(&t->u.sands, &now, &result); \
|
timersub(&t->u.sands, &now, &_result); \
|
||||||
timerstring(&result, buf, size); \
|
timerstring(&_result, buf, size); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
|
@ -586,13 +586,13 @@ struct pbr_nexthop_group_cache *pbr_nht_add_group(const char *name)
|
||||||
pnhgc);
|
pnhgc);
|
||||||
|
|
||||||
for (ALL_NEXTHOPS(nhgc->nhg, nhop)) {
|
for (ALL_NEXTHOPS(nhgc->nhg, nhop)) {
|
||||||
struct pbr_nexthop_cache lookup;
|
struct pbr_nexthop_cache lookupc;
|
||||||
struct pbr_nexthop_cache *pnhc;
|
struct pbr_nexthop_cache *pnhc;
|
||||||
|
|
||||||
lookup.nexthop = nhop;
|
lookupc.nexthop = nhop;
|
||||||
pnhc = hash_lookup(pnhgc->nhh, &lookup);
|
pnhc = hash_lookup(pnhgc->nhh, &lookupc);
|
||||||
if (!pnhc) {
|
if (!pnhc) {
|
||||||
pnhc = hash_get(pnhgc->nhh, &lookup, pbr_nh_alloc);
|
pnhc = hash_get(pnhgc->nhh, &lookupc, pbr_nh_alloc);
|
||||||
pnhc->parent = pnhgc;
|
pnhc->parent = pnhgc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,10 +265,10 @@ static void test_run(struct prng *prng, struct vty *vty, const char *cmd,
|
||||||
if (descriptions != NULL) {
|
if (descriptions != NULL) {
|
||||||
for (j = 0; j < vector_active(descriptions);
|
for (j = 0; j < vector_active(descriptions);
|
||||||
j++) {
|
j++) {
|
||||||
struct cmd_token *cmd =
|
struct cmd_token *ct =
|
||||||
vector_slot(descriptions, j);
|
vector_slot(descriptions, j);
|
||||||
printf(" '%s' '%s'\n", cmd->text,
|
printf(" '%s' '%s'\n", ct->text,
|
||||||
cmd->desc);
|
ct->desc);
|
||||||
}
|
}
|
||||||
vector_free(descriptions);
|
vector_free(descriptions);
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,7 +289,6 @@ static void test_state_verify(struct test_state *test)
|
||||||
expected_lock++;
|
expected_lock++;
|
||||||
|
|
||||||
if (rn->lock != expected_lock) {
|
if (rn->lock != expected_lock) {
|
||||||
const struct prefix_ipv6 *dst_p, *src_p;
|
|
||||||
srcdest_rnode_prefixes(
|
srcdest_rnode_prefixes(
|
||||||
rn, (const struct prefix **)&dst_p,
|
rn, (const struct prefix **)&dst_p,
|
||||||
(const struct prefix **)&src_p);
|
(const struct prefix **)&src_p);
|
||||||
|
|
|
@ -2901,13 +2901,13 @@ static int link_params_config_write(struct vty *vty, struct interface *ifp)
|
||||||
|
|
||||||
static int if_config_write(struct vty *vty)
|
static int if_config_write(struct vty *vty)
|
||||||
{
|
{
|
||||||
struct vrf *vrf;
|
struct vrf *vrf0;
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
|
||||||
zebra_ptm_write(vty);
|
zebra_ptm_write(vty);
|
||||||
|
|
||||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
|
RB_FOREACH (vrf0, vrf_name_head, &vrfs_by_name)
|
||||||
FOR_ALL_INTERFACES (vrf, ifp) {
|
FOR_ALL_INTERFACES (vrf0, ifp) {
|
||||||
struct zebra_if *if_data;
|
struct zebra_if *if_data;
|
||||||
struct listnode *addrnode;
|
struct listnode *addrnode;
|
||||||
struct connected *ifc;
|
struct connected *ifc;
|
||||||
|
|
Loading…
Reference in a new issue