mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 20:04:11 +00:00
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)) {
|
||||
const char *name, *type;
|
||||
struct peer *peer;
|
||||
struct listnode *node, *nnode;
|
||||
struct listnode *node2, *nnode2;
|
||||
int peers_cfg, peers_estb;
|
||||
json_object *json_vrf = NULL;
|
||||
|
||||
@ -7387,7 +7387,7 @@ DEFUN (show_bgp_vrfs,
|
||||
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))
|
||||
continue;
|
||||
peers_cfg++;
|
||||
|
@ -4015,21 +4015,21 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
|
||||
vty_out(vty, "!\n");
|
||||
|
||||
if (hc->l2_groups) {
|
||||
struct rfapi_l2_group_cfg *rfg = NULL;
|
||||
struct rfapi_l2_group_cfg *rfgc = NULL;
|
||||
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;
|
||||
void *data;
|
||||
++write;
|
||||
vty_out(vty, " vnc l2-group %s\n", rfg->name);
|
||||
if (rfg->logical_net_id != 0)
|
||||
vty_out(vty, " vnc l2-group %s\n", rfgc->name);
|
||||
if (rfgc->logical_net_id != 0)
|
||||
vty_out(vty,
|
||||
" logical-network-id %u\n",
|
||||
rfg->logical_net_id);
|
||||
if (rfg->labels != NULL
|
||||
&& listhead(rfg->labels) != NULL) {
|
||||
rfgc->logical_net_id);
|
||||
if (rfgc->labels != NULL
|
||||
&& listhead(rfgc->labels) != NULL) {
|
||||
vty_out(vty, " labels ");
|
||||
for (ALL_LIST_ELEMENTS_RO(rfg->labels,
|
||||
for (ALL_LIST_ELEMENTS_RO(rfgc->labels,
|
||||
lnode,
|
||||
data)) {
|
||||
vty_out(vty, "%hu ",
|
||||
@ -4040,28 +4040,28 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
|
||||
vty_out(vty, "\n");
|
||||
}
|
||||
|
||||
if (rfg->rt_import_list && rfg->rt_export_list
|
||||
&& ecommunity_cmp(rfg->rt_import_list,
|
||||
rfg->rt_export_list)) {
|
||||
if (rfgc->rt_import_list && rfgc->rt_export_list
|
||||
&& ecommunity_cmp(rfgc->rt_import_list,
|
||||
rfgc->rt_export_list)) {
|
||||
char *b = ecommunity_ecom2str(
|
||||
rfg->rt_import_list,
|
||||
rfgc->rt_import_list,
|
||||
ECOMMUNITY_FORMAT_ROUTE_MAP,
|
||||
ECOMMUNITY_ROUTE_TARGET);
|
||||
vty_out(vty, " rt both %s\n", b);
|
||||
XFREE(MTYPE_ECOMMUNITY_STR, b);
|
||||
} else {
|
||||
if (rfg->rt_import_list) {
|
||||
if (rfgc->rt_import_list) {
|
||||
char *b = ecommunity_ecom2str(
|
||||
rfg->rt_import_list,
|
||||
rfgc->rt_import_list,
|
||||
ECOMMUNITY_FORMAT_ROUTE_MAP,
|
||||
ECOMMUNITY_ROUTE_TARGET);
|
||||
vty_out(vty, " rt import %s\n",
|
||||
b);
|
||||
XFREE(MTYPE_ECOMMUNITY_STR, b);
|
||||
}
|
||||
if (rfg->rt_export_list) {
|
||||
if (rfgc->rt_export_list) {
|
||||
char *b = ecommunity_ecom2str(
|
||||
rfg->rt_export_list,
|
||||
rfgc->rt_export_list,
|
||||
ECOMMUNITY_FORMAT_ROUTE_MAP,
|
||||
ECOMMUNITY_ROUTE_TARGET);
|
||||
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)(
|
||||
vty, bgp->rfapi->rfp,
|
||||
RFAPI_RFP_CFG_GROUP_L2,
|
||||
rfg->name, rfg->rfp_cfg);
|
||||
rfgc->name, rfgc->rfp_cfg);
|
||||
vty_out(vty, " exit-vnc\n");
|
||||
vty_out(vty, "!\n");
|
||||
}
|
||||
|
@ -2398,11 +2398,11 @@ void vnc_import_bgp_exterior_add_route_interior(
|
||||
}
|
||||
if (list_adopted) {
|
||||
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,
|
||||
bi_exterior, NULL);
|
||||
an_bi_exterior, NULL);
|
||||
}
|
||||
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)
|
||||
vty_out(vty, "any");
|
||||
else {
|
||||
struct prefix *p = &pentry->prefix;
|
||||
struct prefix *pf = &pentry->prefix;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
vty_out(vty, "%s/%d",
|
||||
inet_ntop(p->family, p->u.val, buf,
|
||||
inet_ntop(pf->family, pf->u.val, buf,
|
||||
BUFSIZ),
|
||||
p->prefixlen);
|
||||
pf->prefixlen);
|
||||
|
||||
if (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;
|
||||
|
||||
/* count how many columns we have */
|
||||
for (int i = 0; format[i]; i++)
|
||||
ncols += !!(format[i] == '|');
|
||||
for (int j = 0; format[j]; j++)
|
||||
ncols += !!(format[j] == '|');
|
||||
ncols++;
|
||||
|
||||
if (tt->ncols == 0)
|
||||
@ -459,7 +459,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
|
||||
memcpy(&buf[pos], left, 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;
|
||||
|
||||
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) \
|
||||
do { \
|
||||
struct vrf *vrf; \
|
||||
if (!(vrf = vrf_lookup_by_name(NAME))) { \
|
||||
struct vrf *_vrf; \
|
||||
if (!(_vrf = vrf_lookup_by_name(NAME))) { \
|
||||
if (USE_JSON) { \
|
||||
vty_out(vty, "{}\n"); \
|
||||
} else { \
|
||||
@ -120,7 +120,7 @@ extern vrf_id_t vrf_name_to_id(const char *);
|
||||
} \
|
||||
return CMD_WARNING; \
|
||||
} \
|
||||
if (vrf->vrf_id == VRF_UNKNOWN) { \
|
||||
if (_vrf->vrf_id == VRF_UNKNOWN) { \
|
||||
if (USE_JSON) { \
|
||||
vty_out(vty, "{}\n"); \
|
||||
} else { \
|
||||
@ -128,7 +128,7 @@ extern vrf_id_t vrf_name_to_id(const char *);
|
||||
} \
|
||||
return CMD_WARNING; \
|
||||
} \
|
||||
(V) = vrf->vrf_id; \
|
||||
(V) = _vrf->vrf_id; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
|
12
lib/zebra.h
12
lib/zebra.h
@ -333,18 +333,18 @@ struct in_pktinfo {
|
||||
#endif
|
||||
#define MAX(a, b) \
|
||||
({ \
|
||||
typeof(a) _a = (a); \
|
||||
typeof(b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
typeof(a) _max_a = (a); \
|
||||
typeof(b) _max_b = (b); \
|
||||
_max_a > _max_b ? _max_a : _max_b; \
|
||||
})
|
||||
#ifdef MIN
|
||||
#undef MIN
|
||||
#endif
|
||||
#define MIN(a, b) \
|
||||
({ \
|
||||
typeof(a) _a = (a); \
|
||||
typeof(b) _b = (b); \
|
||||
_a < _b ? _a : _b; \
|
||||
typeof(a) _min_a = (a); \
|
||||
typeof(b) _min_b = (b); \
|
||||
_min_a < _min_b ? _min_a : _min_b; \
|
||||
})
|
||||
|
||||
#ifndef offsetof
|
||||
|
@ -72,12 +72,12 @@ extern struct thread_master *master;
|
||||
|
||||
#define threadtimer_string(now, t, buf, size) \
|
||||
do { \
|
||||
struct timeval result; \
|
||||
struct timeval _result; \
|
||||
if (!t) \
|
||||
snprintf(buf, size, "inactive"); \
|
||||
else { \
|
||||
timersub(&t->u.sands, &now, &result); \
|
||||
timerstring(&result, buf, size); \
|
||||
timersub(&t->u.sands, &now, &_result); \
|
||||
timerstring(&_result, buf, size); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
@ -586,13 +586,13 @@ struct pbr_nexthop_group_cache *pbr_nht_add_group(const char *name)
|
||||
pnhgc);
|
||||
|
||||
for (ALL_NEXTHOPS(nhgc->nhg, nhop)) {
|
||||
struct pbr_nexthop_cache lookup;
|
||||
struct pbr_nexthop_cache lookupc;
|
||||
struct pbr_nexthop_cache *pnhc;
|
||||
|
||||
lookup.nexthop = nhop;
|
||||
pnhc = hash_lookup(pnhgc->nhh, &lookup);
|
||||
lookupc.nexthop = nhop;
|
||||
pnhc = hash_lookup(pnhgc->nhh, &lookupc);
|
||||
if (!pnhc) {
|
||||
pnhc = hash_get(pnhgc->nhh, &lookup, pbr_nh_alloc);
|
||||
pnhc = hash_get(pnhgc->nhh, &lookupc, pbr_nh_alloc);
|
||||
pnhc->parent = pnhgc;
|
||||
}
|
||||
}
|
||||
|
@ -265,10 +265,10 @@ static void test_run(struct prng *prng, struct vty *vty, const char *cmd,
|
||||
if (descriptions != NULL) {
|
||||
for (j = 0; j < vector_active(descriptions);
|
||||
j++) {
|
||||
struct cmd_token *cmd =
|
||||
struct cmd_token *ct =
|
||||
vector_slot(descriptions, j);
|
||||
printf(" '%s' '%s'\n", cmd->text,
|
||||
cmd->desc);
|
||||
printf(" '%s' '%s'\n", ct->text,
|
||||
ct->desc);
|
||||
}
|
||||
vector_free(descriptions);
|
||||
}
|
||||
|
@ -289,7 +289,6 @@ static void test_state_verify(struct test_state *test)
|
||||
expected_lock++;
|
||||
|
||||
if (rn->lock != expected_lock) {
|
||||
const struct prefix_ipv6 *dst_p, *src_p;
|
||||
srcdest_rnode_prefixes(
|
||||
rn, (const struct prefix **)&dst_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)
|
||||
{
|
||||
struct vrf *vrf;
|
||||
struct vrf *vrf0;
|
||||
struct interface *ifp;
|
||||
|
||||
zebra_ptm_write(vty);
|
||||
|
||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
|
||||
FOR_ALL_INTERFACES (vrf, ifp) {
|
||||
RB_FOREACH (vrf0, vrf_name_head, &vrfs_by_name)
|
||||
FOR_ALL_INTERFACES (vrf0, ifp) {
|
||||
struct zebra_if *if_data;
|
||||
struct listnode *addrnode;
|
||||
struct connected *ifc;
|
||||
|
Loading…
Reference in New Issue
Block a user