ospfd: clean up -Wshadow warnings

Clean up various "shadow" warnings.

Signed-off-by: Mark Stapp <mjs@cisco.com>
This commit is contained in:
Mark Stapp 2025-01-23 15:14:49 -05:00
parent e88f0a4778
commit 0561943a78
9 changed files with 61 additions and 69 deletions

View file

@ -312,7 +312,7 @@ DEFUN (no_ip_ospf_bfd,
void ospf_bfd_init(struct event_loop *tm)
{
bfd_protocol_integration_init(zclient, tm);
bfd_protocol_integration_init(ospf_zclient, tm);
/* Install BFD command */
install_element(INTERFACE_NODE, &ip_ospf_bfd_cmd);

View file

@ -33,8 +33,6 @@
#include "ospfd/ospf_zebra.h"
#include "ospfd/ospf_dump.h"
extern struct zclient *zclient;
/** @brief Function to refresh type-5 and type-7 DNA
* LSAs when we receive an indication LSA.
* @param Ospf instance.
@ -172,11 +170,11 @@ struct external_info *ospf_external_info_check(struct ospf *ospf,
redist_on =
is_default_prefix4(&p)
? vrf_bitmap_check(
&zclient->default_information[AFI_IP],
&ospf_zclient->default_information[AFI_IP],
ospf->vrf_id)
: (zclient->mi_redist[AFI_IP][type].enabled ||
: (ospf_zclient->mi_redist[AFI_IP][type].enabled ||
vrf_bitmap_check(
&zclient->redist[AFI_IP][type],
&ospf_zclient->redist[AFI_IP][type],
ospf->vrf_id));
// Pending: check for MI above.
if (redist_on) {

View file

@ -28,8 +28,6 @@
#include "ospf_dump.h"
#include "ospf_ism.h"
extern struct zclient *zclient;
/*
* LDP-SYNC msg between IGP and LDP
*/
@ -98,7 +96,7 @@ void ospf_ldp_sync_state_req_msg(struct interface *ifp)
request.proto = LDP_IGP_SYNC_IF_STATE_REQUEST;
request.ifindex = ifp->ifindex;
zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_REQUEST,
zclient_send_opaque(ospf_zclient, LDP_IGP_SYNC_IF_STATE_REQUEST,
(uint8_t *)&request, sizeof(request));
}
@ -400,9 +398,9 @@ void ospf_ldp_sync_gbl_exit(struct ospf *ospf, bool remove)
*/
if (CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) {
/* unregister with opaque client to recv LDP-IGP Sync msgs */
zclient_unregister_opaque(zclient,
zclient_unregister_opaque(ospf_zclient,
LDP_IGP_SYNC_IF_STATE_UPDATE);
zclient_unregister_opaque(zclient,
zclient_unregister_opaque(ospf_zclient,
LDP_IGP_SYNC_ANNOUNCE_UPDATE);
/* disable LDP globally */
@ -754,8 +752,8 @@ DEFPY (ospf_mpls_ldp_sync,
}
/* register with opaque client to recv LDP-IGP Sync msgs */
zclient_register_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE);
zclient_register_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE);
zclient_register_opaque(ospf_zclient, LDP_IGP_SYNC_IF_STATE_UPDATE);
zclient_register_opaque(ospf_zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE);
if (!CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) {
SET_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE);

View file

@ -4055,11 +4055,11 @@ void ospf_ls_ack_send_direct(struct ospf_neighbor *nbr, struct ospf_lsa *lsa)
* ignored.
*/
if (oi->type == OSPF_IFTYPE_POINTOMULTIPOINT && !oi->p2mp_non_broadcast) {
struct ospf_lsa_list_entry *ls_ack_list_entry;
struct ospf_lsa_list_entry *ack_list_entry;
struct ospf_lsa *ack_queue_lsa;
frr_each (ospf_lsa_list, &oi->ls_ack_direct, ls_ack_list_entry) {
ack_queue_lsa = ls_ack_list_entry->lsa;
frr_each (ospf_lsa_list, &oi->ls_ack_direct, ack_list_entry) {
ack_queue_lsa = ack_list_entry->lsa;
if ((lsa == ack_queue_lsa) ||
((lsa->data->type == ack_queue_lsa->data->type) &&
(lsa->data->id.s_addr ==

View file

@ -1709,15 +1709,15 @@ static int ospf_te_export(uint8_t type, void *link_state)
switch (type) {
case LS_MSG_TYPE_NODE:
ls_vertex2msg(&msg, (struct ls_vertex *)link_state);
rc = ls_send_msg(zclient, &msg, NULL);
rc = ls_send_msg(ospf_zclient, &msg, NULL);
break;
case LS_MSG_TYPE_ATTRIBUTES:
ls_edge2msg(&msg, (struct ls_edge *)link_state);
rc = ls_send_msg(zclient, &msg, NULL);
rc = ls_send_msg(ospf_zclient, &msg, NULL);
break;
case LS_MSG_TYPE_PREFIX:
ls_subnet2msg(&msg, (struct ls_subnet *)link_state);
rc = ls_send_msg(zclient, &msg, NULL);
rc = ls_send_msg(ospf_zclient, &msg, NULL);
break;
default:
rc = -1;
@ -3113,7 +3113,7 @@ int ospf_te_sync_ted(struct zapi_opaque_reg_info dst)
if (!OspfMplsTE.enabled || !OspfMplsTE.export)
return rc;
rc = ls_sync_ted(OspfMplsTE.ted, zclient, &dst);
rc = ls_sync_ted(OspfMplsTE.ted, ospf_zclient, &dst);
return rc;
}
@ -4306,7 +4306,7 @@ DEFUN (ospf_mpls_te_export,
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
if (OspfMplsTE.enabled) {
if (ls_register(zclient, true) != 0) {
if (ls_register(ospf_zclient, true) != 0) {
vty_out(vty, "Unable to register Link State\n");
return CMD_WARNING;
}
@ -4330,7 +4330,7 @@ DEFUN (no_ospf_mpls_te_export,
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
if (OspfMplsTE.export) {
if (ls_unregister(zclient, true) != 0) {
if (ls_unregister(ospf_zclient, true) != 0) {
vty_out(vty, "Unable to unregister Link State\n");
return CMD_WARNING;
}

View file

@ -12308,8 +12308,6 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
else
vty_out(vty, " ip ospf");
char buf[INET_ADDRSTRLEN];
area_id2str(buf, sizeof(buf), &params->if_area,
params->if_area_id_fmt);
vty_out(vty, " area %s", buf);

View file

@ -45,7 +45,7 @@ DEFINE_MTYPE_STATIC(OSPFD, OSPF_REDISTRIBUTE, "OSPF Redistriute");
/* Zebra structure to hold current status. */
struct zclient *zclient = NULL;
struct zclient *ospf_zclient;
/* and for the Synchronous connection to the Label Manager */
struct zclient *zclient_sync;
@ -342,7 +342,7 @@ void ospf_zebra_add(struct ospf *ospf, struct prefix_ipv4 *p,
if (CHECK_FLAG(ospf->config, OSPF_SEND_EXTRA_DATA_TO_ZEBRA))
ospf_zebra_append_opaque_attr(or, &api);
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
zclient_route_send(ZEBRA_ROUTE_ADD, ospf_zclient, &api);
}
void ospf_zebra_delete(struct ospf *ospf, struct prefix_ipv4 *p,
@ -368,7 +368,7 @@ void ospf_zebra_delete(struct ospf *ospf, struct prefix_ipv4 *p,
zlog_debug("Zebra: Route delete %pFX(%s)", p,
ospf_vrf_id_to_name(ospf->vrf_id));
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
zclient_route_send(ZEBRA_ROUTE_DELETE, ospf_zclient, &api);
}
void ospf_zebra_add_discard(struct ospf *ospf, struct prefix_ipv4 *p)
@ -390,7 +390,7 @@ void ospf_zebra_add_discard(struct ospf *ospf, struct prefix_ipv4 *p)
memcpy(&api.prefix, p, sizeof(*p));
zapi_route_set_blackhole(&api, BLACKHOLE_NULL);
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
zclient_route_send(ZEBRA_ROUTE_ADD, ospf_zclient, &api);
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
zlog_debug("Zebra: Route add discard %pFX(%s)", p,
@ -416,7 +416,7 @@ void ospf_zebra_delete_discard(struct ospf *ospf, struct prefix_ipv4 *p)
memcpy(&api.prefix, p, sizeof(*p));
zapi_route_set_blackhole(&api, BLACKHOLE_NULL);
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
zclient_route_send(ZEBRA_ROUTE_DELETE, ospf_zclient, &api);
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
zlog_debug("Zebra: Route delete discard %pFX(%s)", p,
@ -695,7 +695,7 @@ void ospf_zebra_update_prefix_sid(const struct sr_prefix *srp)
}
/* Finally, send message to zebra. */
(void)zebra_send_mpls_labels(zclient, ZEBRA_MPLS_LABELS_REPLACE, &zl);
(void)zebra_send_mpls_labels(ospf_zclient, ZEBRA_MPLS_LABELS_REPLACE, &zl);
}
/* Remove NHLFE for Prefix-SID */
@ -722,7 +722,7 @@ void ospf_zebra_delete_prefix_sid(const struct sr_prefix *srp)
}
/* Send message to zebra. */
(void)zebra_send_mpls_labels(zclient, ZEBRA_MPLS_LABELS_DELETE, &zl);
(void)zebra_send_mpls_labels(ospf_zclient, ZEBRA_MPLS_LABELS_DELETE, &zl);
}
/* Send MPLS Label entry to Zebra for installation or deletion */
@ -746,7 +746,7 @@ void ospf_zebra_send_adjacency_sid(int cmd, struct sr_nhlfe nhlfe)
znh->label_num = 1;
znh->labels[0] = nhlfe.label_out;
(void)zebra_send_mpls_labels(zclient, cmd, &zl);
(void)zebra_send_mpls_labels(ospf_zclient, cmd, &zl);
}
struct ospf_redist *ospf_redist_lookup(struct ospf *ospf, uint8_t type,
@ -815,14 +815,14 @@ int ospf_is_type_redistributed(struct ospf *ospf, int type,
{
return (DEFAULT_ROUTE_TYPE(type)
? vrf_bitmap_check(
&zclient->default_information[AFI_IP],
&ospf_zclient->default_information[AFI_IP],
ospf->vrf_id)
: ((instance &&
redist_check_instance(
&zclient->mi_redist[AFI_IP][type],
&ospf_zclient->mi_redist[AFI_IP][type],
instance)) ||
(!instance &&
vrf_bitmap_check(&zclient->redist[AFI_IP][type],
vrf_bitmap_check(&ospf_zclient->redist[AFI_IP][type],
ospf->vrf_id))));
}
@ -861,7 +861,7 @@ int ospf_redistribute_set(struct ospf *ospf, struct ospf_redist *red, int type,
ospf_external_add(ospf, type, instance);
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, type,
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, ospf_zclient, AFI_IP, type,
instance, ospf->vrf_id);
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
@ -879,10 +879,10 @@ int ospf_redistribute_set(struct ospf *ospf, struct ospf_redist *red, int type,
int ospf_redistribute_unset(struct ospf *ospf, int type,
unsigned short instance)
{
if (type == zclient->redist_default && instance == zclient->instance)
if (type == ospf_zclient->redist_default && instance == ospf_zclient->instance)
return CMD_SUCCESS;
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP, type,
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, ospf_zclient, AFI_IP, type,
instance, ospf->vrf_id);
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
@ -933,7 +933,7 @@ int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype,
break;
case DEFAULT_ORIGINATE_ZEBRA:
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE,
zclient, AFI_IP, ospf->vrf_id);
ospf_zclient, AFI_IP, ospf->vrf_id);
ospf->redistribute--;
break;
case DEFAULT_ORIGINATE_ALWAYS:
@ -951,7 +951,7 @@ int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype,
type_str = "normal";
ospf->redistribute++;
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
zclient, AFI_IP, ospf->vrf_id);
ospf_zclient, AFI_IP, ospf->vrf_id);
break;
case DEFAULT_ORIGINATE_ALWAYS:
type_str = "always";
@ -1242,7 +1242,7 @@ static int ospf_zebra_gr_update(struct ospf *ospf, int command,
{
struct zapi_cap api;
if (!zclient || zclient->sock < 0 || !ospf)
if (!ospf_zclient || ospf_zclient->sock < 0 || !ospf)
return 1;
memset(&api, 0, sizeof(api));
@ -1250,7 +1250,7 @@ static int ospf_zebra_gr_update(struct ospf *ospf, int command,
api.stale_removal_time = stale_time;
api.vrf_id = ospf->vrf_id;
(void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient,
(void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, ospf_zclient,
&api);
return 0;
@ -1495,7 +1495,7 @@ void ospf_zebra_import_default_route(struct ospf *ospf, bool unreg)
struct prefix prefix = {};
int command;
if (zclient->sock < 0) {
if (ospf_zclient->sock < 0) {
if (IS_DEBUG_OSPF(zebra, ZEBRA))
zlog_debug(" Not connected to Zebra vrf: %s",
ospf_vrf_id_to_name(ospf->vrf_id));
@ -1515,7 +1515,7 @@ void ospf_zebra_import_default_route(struct ospf *ospf, bool unreg)
zserv_command_string(command), &prefix,
ospf_vrf_id_to_name(ospf->vrf_id));
if (zclient_send_rnh(zclient, command, &prefix, SAFI_UNICAST, false,
if (zclient_send_rnh(ospf_zclient, command, &prefix, SAFI_UNICAST, false,
true, ospf->vrf_id) == ZCLIENT_SEND_FAILURE)
flog_err(EC_LIB_ZAPI_SOCKET, "%s(%s): zclient_send_rnh() failed",
__func__, ospf_vrf_id_to_name(ospf->vrf_id));
@ -2011,7 +2011,7 @@ uint8_t ospf_distance_apply(struct ospf *ospf, struct prefix_ipv4 *p,
void ospf_zebra_vrf_register(struct ospf *ospf)
{
if (!zclient || zclient->sock < 0 || !ospf)
if (!ospf_zclient || ospf_zclient->sock < 0 || !ospf)
return;
if (ospf->vrf_id != VRF_UNKNOWN) {
@ -2019,13 +2019,13 @@ void ospf_zebra_vrf_register(struct ospf *ospf)
zlog_debug("%s: Register VRF %s id %u", __func__,
ospf_vrf_id_to_name(ospf->vrf_id),
ospf->vrf_id);
zclient_send_reg_requests(zclient, ospf->vrf_id);
zclient_send_reg_requests(ospf_zclient, ospf->vrf_id);
}
}
void ospf_zebra_vrf_deregister(struct ospf *ospf)
{
if (!zclient || zclient->sock < 0 || !ospf)
if (!ospf_zclient || ospf_zclient->sock < 0 || !ospf)
return;
if (ospf->vrf_id != VRF_DEFAULT && ospf->vrf_id != VRF_UNKNOWN) {
@ -2035,7 +2035,7 @@ void ospf_zebra_vrf_deregister(struct ospf *ospf)
ospf->vrf_id);
/* Deregister for router-id, interfaces,
* redistributed routes. */
zclient_send_dereg_requests(zclient, ospf->vrf_id);
zclient_send_dereg_requests(ospf_zclient, ospf->vrf_id);
}
}
@ -2230,17 +2230,17 @@ static zclient_handler *const ospf_handlers[] = {
[ZEBRA_CLIENT_CLOSE_NOTIFY] = ospf_zebra_client_close_notify,
};
void ospf_zebra_init(struct event_loop *master, unsigned short instance)
void ospf_zebra_init(struct event_loop *mst, unsigned short instance)
{
/* Allocate zebra structure. */
zclient = zclient_new(master, &zclient_options_default, ospf_handlers,
ospf_zclient = zclient_new(mst, &zclient_options_default, ospf_handlers,
array_size(ospf_handlers));
zclient_init(zclient, ZEBRA_ROUTE_OSPF, instance, &ospfd_privs);
zclient->zebra_connected = ospf_zebra_connected;
zclient->nexthop_update = ospf_zebra_import_check_update;
zclient_init(ospf_zclient, ZEBRA_ROUTE_OSPF, instance, &ospfd_privs);
ospf_zclient->zebra_connected = ospf_zebra_connected;
ospf_zclient->nexthop_update = ospf_zebra_import_check_update;
/* Initialize special zclient for synchronous message exchanges. */
zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
zclient_sync = zclient_new(mst, &zclient_options_sync, NULL, 0);
zclient_sync->sock = -1;
zclient_sync->redist_default = ZEBRA_ROUTE_OSPF;
zclient_sync->instance = instance;
@ -2259,5 +2259,5 @@ void ospf_zebra_init(struct event_loop *master, unsigned short instance)
void ospf_zebra_send_arp(const struct interface *ifp, const struct prefix *p)
{
zclient_send_neigh_discovery_req(zclient, ifp, p);
zclient_send_neigh_discovery_req(ospf_zclient, ifp, p);
}

View file

@ -59,9 +59,6 @@ struct ospf_master *om;
unsigned short ospf_instance;
extern struct zclient *zclient;
extern struct zclient *zclient_sync;
/* OSPF config processing timer thread */
struct event *t_ospf_cfg;
@ -648,8 +645,8 @@ void ospf_terminate(void)
* One or more ospf_finish()'s may have deferred shutdown to a timer
* thread
*/
zclient_stop(zclient);
zclient_free(zclient);
zclient_stop(ospf_zclient);
zclient_free(ospf_zclient);
zclient_stop(zclient_sync);
zclient_free(zclient_sync);
@ -2214,13 +2211,13 @@ void ospf_update_bufsize(struct ospf *ospf, uint32_t recvsize,
ospf_sock_bufsize_update(ospf, ospf->fd, type);
}
void ospf_master_init(struct event_loop *master)
void ospf_master_init(struct event_loop *mst)
{
memset(&ospf_master, 0, sizeof(ospf_master));
om = &ospf_master;
om->ospf = list_new();
om->master = master;
om->master = mst;
}
/* Link OSPF instance to VRF. */
@ -2273,20 +2270,20 @@ static void ospf_set_redist_vrf_bitmaps(struct ospf *ospf, bool set)
"%s: setting redist vrf %d bitmap for type %d",
__func__, ospf->vrf_id, type);
if (set)
vrf_bitmap_set(&zclient->redist[AFI_IP][type],
vrf_bitmap_set(&ospf_zclient->redist[AFI_IP][type],
ospf->vrf_id);
else
vrf_bitmap_unset(&zclient->redist[AFI_IP][type],
vrf_bitmap_unset(&ospf_zclient->redist[AFI_IP][type],
ospf->vrf_id);
}
red_list = ospf->redist[DEFAULT_ROUTE];
if (red_list) {
if (set)
vrf_bitmap_set(&zclient->default_information[AFI_IP],
vrf_bitmap_set(&ospf_zclient->default_information[AFI_IP],
ospf->vrf_id);
else
vrf_bitmap_unset(&zclient->default_information[AFI_IP],
vrf_bitmap_unset(&ospf_zclient->default_information[AFI_IP],
ospf->vrf_id);
}
}

View file

@ -695,7 +695,8 @@ struct ospf_nbr_nbma {
extern struct ospf_master *om;
extern unsigned short ospf_instance;
extern const int ospf_redistributed_proto_max;
extern struct zclient *zclient;
extern struct zclient *ospf_zclient;
extern struct zclient *zclient_sync;
extern struct event_loop *master;
extern int ospf_zlog;
extern struct zebra_privs_t ospfd_privs;