eigrpd: clean up variable-shadow warnings

Clean up various warnings from -Wshadow in eigrp.

Signed-off-by: Mark Stapp <mjs@cisco.com>
This commit is contained in:
Mark Stapp 2025-01-24 14:59:04 -05:00
parent 2d32ad6aa9
commit e49a2f9a53
5 changed files with 21 additions and 24 deletions

View file

@ -739,7 +739,7 @@ static int eigrpd_instance_redistribute_create(struct nb_cb_create_args *args)
else else
vrfid = VRF_DEFAULT; vrfid = VRF_DEFAULT;
if (vrf_bitmap_check(&zclient->redist[AFI_IP][proto], vrfid)) if (vrf_bitmap_check(&eigrp_zclient->redist[AFI_IP][proto], vrfid))
return NB_ERR_INCONSISTENCY; return NB_ERR_INCONSISTENCY;
break; break;
case NB_EV_PREPARE: case NB_EV_PREPARE:

View file

@ -280,14 +280,14 @@ DEFPY (show_ip_eigrp_neighbors,
struct eigrp *eigrp; struct eigrp *eigrp;
if (vrf && strncmp(vrf, "all", sizeof("all")) == 0) { if (vrf && strncmp(vrf, "all", sizeof("all")) == 0) {
struct vrf *vrf; struct vrf *tvrf;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { RB_FOREACH (tvrf, vrf_name_head, &vrfs_by_name) {
eigrp = eigrp_lookup(vrf->vrf_id); eigrp = eigrp_lookup(tvrf->vrf_id);
if (!eigrp) if (!eigrp)
continue; continue;
vty_out(vty, "VRF %s:\n", vrf->name); vty_out(vty, "VRF %s:\n", tvrf->name);
eigrp_neighbors_helper(vty, eigrp, ifname, detail); eigrp_neighbors_helper(vty, eigrp, ifname, detail);
} }

View file

@ -46,7 +46,7 @@ static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS);
static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS); static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS);
/* Zebra structure to hold current status. */ /* Zebra structure to hold current status. */
struct zclient *zclient = NULL; struct zclient *eigrp_zclient = NULL;
/* For registering threads. */ /* For registering threads. */
extern struct event_loop *master; extern struct event_loop *master;
@ -98,17 +98,17 @@ static zclient_handler *const eigrp_handlers[] = {
void eigrp_zebra_init(void) void eigrp_zebra_init(void)
{ {
zclient = zclient_new(master, &zclient_options_default, eigrp_handlers, eigrp_zclient = zclient_new(master, &zclient_options_default, eigrp_handlers,
array_size(eigrp_handlers)); array_size(eigrp_handlers));
zclient_init(zclient, ZEBRA_ROUTE_EIGRP, 0, &eigrpd_privs); zclient_init(eigrp_zclient, ZEBRA_ROUTE_EIGRP, 0, &eigrpd_privs);
zclient->zebra_connected = eigrp_zebra_connected; eigrp_zclient->zebra_connected = eigrp_zebra_connected;
} }
void eigrp_zebra_stop(void) void eigrp_zebra_stop(void)
{ {
zclient_stop(zclient); zclient_stop(eigrp_zclient);
zclient_free(zclient); zclient_free(eigrp_zclient);
} }
/* Zebra route add and delete treatment. */ /* Zebra route add and delete treatment. */
@ -192,7 +192,7 @@ void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p,
struct listnode *node; struct listnode *node;
int count = 0; int count = 0;
if (!zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP]) if (!eigrp_zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP])
return; return;
memset(&api, 0, sizeof(api)); memset(&api, 0, sizeof(api));
@ -226,14 +226,14 @@ void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p,
zlog_debug("Zebra: Route add %pFX", p); zlog_debug("Zebra: Route add %pFX", p);
} }
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); zclient_route_send(ZEBRA_ROUTE_ADD, eigrp_zclient, &api);
} }
void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p) void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p)
{ {
struct zapi_route api; struct zapi_route api;
if (!zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP]) if (!eigrp_zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP])
return; return;
memset(&api, 0, sizeof(api)); memset(&api, 0, sizeof(api));
@ -241,7 +241,7 @@ void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p)
api.type = ZEBRA_ROUTE_EIGRP; api.type = ZEBRA_ROUTE_EIGRP;
api.safi = SAFI_UNICAST; api.safi = SAFI_UNICAST;
memcpy(&api.prefix, p, sizeof(*p)); memcpy(&api.prefix, p, sizeof(*p));
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); zclient_route_send(ZEBRA_ROUTE_DELETE, eigrp_zclient, &api);
if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE))
zlog_debug("Zebra: Route del %pFX", p); zlog_debug("Zebra: Route del %pFX", p);
@ -252,10 +252,8 @@ void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p)
static int eigrp_is_type_redistributed(int type, vrf_id_t vrf_id) static int eigrp_is_type_redistributed(int type, vrf_id_t vrf_id)
{ {
return ((DEFAULT_ROUTE_TYPE(type)) return ((DEFAULT_ROUTE_TYPE(type))
? vrf_bitmap_check( ? vrf_bitmap_check(&eigrp_zclient->default_information[AFI_IP], vrf_id)
&zclient->default_information[AFI_IP], vrf_id) : vrf_bitmap_check(&eigrp_zclient->redist[AFI_IP][type], vrf_id));
: vrf_bitmap_check(&zclient->redist[AFI_IP][type],
vrf_id));
} }
int eigrp_redistribute_set(struct eigrp *eigrp, int type, int eigrp_redistribute_set(struct eigrp *eigrp, int type,
@ -280,7 +278,7 @@ int eigrp_redistribute_set(struct eigrp *eigrp, int type,
eigrp->dmetric[type] = metric; eigrp->dmetric[type] = metric;
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, type, 0, zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, eigrp_zclient, AFI_IP, type, 0,
eigrp->vrf_id); eigrp->vrf_id);
++eigrp->redistribute; ++eigrp->redistribute;
@ -293,7 +291,7 @@ int eigrp_redistribute_unset(struct eigrp *eigrp, int type)
if (eigrp_is_type_redistributed(type, eigrp->vrf_id)) { if (eigrp_is_type_redistributed(type, eigrp->vrf_id)) {
memset(&eigrp->dmetric[type], 0, sizeof(struct eigrp_metrics)); memset(&eigrp->dmetric[type], 0, sizeof(struct eigrp_metrics));
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP, zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, eigrp_zclient, AFI_IP,
type, 0, eigrp->vrf_id); type, 0, eigrp->vrf_id);
--eigrp->redistribute; --eigrp->redistribute;
} }

View file

@ -52,7 +52,6 @@ static struct eigrp_master eigrp_master;
struct eigrp_master *eigrp_om; struct eigrp_master *eigrp_om;
extern struct zclient *zclient;
extern struct in_addr router_id_zebra; extern struct in_addr router_id_zebra;
int eigrp_master_hash_cmp(const struct eigrp *a, const struct eigrp *b) int eigrp_master_hash_cmp(const struct eigrp *a, const struct eigrp *b)

View file

@ -52,7 +52,7 @@ struct eigrp_master {
}; };
/* Extern variables. */ /* Extern variables. */
extern struct zclient *zclient; extern struct zclient *eigrp_zclient;
extern struct event_loop *master; extern struct event_loop *master;
extern struct eigrp_master *eigrp_om; extern struct eigrp_master *eigrp_om;
extern struct zebra_privs_t eigrpd_privs; extern struct zebra_privs_t eigrpd_privs;