From: Mark Stapp Date: Wed, 26 Mar 2025 19:27:09 +0000 (-0400) Subject: pimd: clean up variable-shadow warnings X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=aece400f10cf60392b527f688b754bec38d2bfe8;p=matthieu%2Ffrr.git pimd: clean up variable-shadow warnings Clean up -Wshadow warnings in pimd Signed-off-by: Mark Stapp --- diff --git a/pimd/pim_mlag.c b/pimd/pim_mlag.c index dcef2d0d33..3b4e71ecf4 100644 --- a/pimd/pim_mlag.c +++ b/pimd/pim_mlag.c @@ -15,7 +15,7 @@ #include "pim_upstream.h" #include "pim_vxlan.h" -extern struct zclient *zclient; +extern struct zclient *pim_zclient; #define PIM_MLAG_METADATA_LEN 4 @@ -925,7 +925,7 @@ static void pim_mlag_register_handler(struct event *thread) { uint32_t bit_mask = 0; - if (!zclient) + if (!pim_zclient) return; SET_FLAG(bit_mask, (1 << MLAG_STATUS_UPDATE)); @@ -942,7 +942,7 @@ static void pim_mlag_register_handler(struct event *thread) zlog_debug("%s: Posting Client Register to MLAG mask: 0x%x", __func__, bit_mask); - zclient_send_mlag_register(zclient, bit_mask); + zclient_send_mlag_register(pim_zclient, bit_mask); } void pim_mlag_register(void) @@ -958,14 +958,14 @@ void pim_mlag_register(void) static void pim_mlag_deregister_handler(struct event *thread) { - if (!zclient) + if (!pim_zclient) return; if (PIM_DEBUG_MLAG) zlog_debug("%s: Posting Client De-Register to MLAG from PIM", __func__); router->connected_to_mlag = false; - zclient_send_mlag_deregister(zclient); + zclient_send_mlag_deregister(pim_zclient); } void pim_mlag_deregister(void) diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index 1e9ea24b26..d97b56e4d6 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -780,7 +780,6 @@ bool pim_nht_bsr_rpf_check(struct pim_instance *pim, pim_addr bsr_addr, */ struct pim_zlookup_nexthop nexthop_tab[router->multipath]; ifindex_t i; - struct interface *ifp = NULL; int num_ifindex; memset(nexthop_tab, 0, sizeof(nexthop_tab)); diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index e4603ff946..aed9d2be90 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -1624,8 +1624,7 @@ void pim_upstream_set_sptbit(struct pim_upstream *up, if (!starup || up->rpf.source_nexthop .interface != starup->rpf.source_nexthop.interface) { - struct pim_upstream *starup = up->parent; - + starup = up->parent; if (PIM_DEBUG_PIM_TRACE) zlog_debug( "%s: %s RPF_interface(S) != RPF_interface(RP(G))", diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index f0ec3c6b6e..1f7e2b255f 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -38,7 +38,7 @@ #undef PIM_DEBUG_IFADDR_DUMP #define PIM_DEBUG_IFADDR_DUMP -struct zclient *zclient; +struct zclient *pim_zclient; /* Router-id update message from zebra. */ @@ -349,16 +349,16 @@ static void pim_zebra_vxlan_replay(void) struct stream *s = NULL; /* Check socket. */ - if (!zclient || zclient->sock < 0) + if (!pim_zclient || pim_zclient->sock < 0) return; - s = zclient->obuf; + s = pim_zclient->obuf; stream_reset(s); zclient_create_header(s, ZEBRA_VXLAN_SG_REPLAY, VRF_DEFAULT); stream_putw_at(s, 0, stream_get_endp(s)); - zclient_send_message(zclient); + zclient_send_message(pim_zclient); } void pim_scan_oil(struct pim_instance *pim) @@ -448,14 +448,14 @@ static zclient_handler *const pim_handlers[] = { void pim_zebra_init(void) { /* Socket for receiving updates from Zebra daemon */ - zclient = zclient_new(router->master, &zclient_options_default, - pim_handlers, array_size(pim_handlers)); + pim_zclient = zclient_new(router->master, &zclient_options_default, + pim_handlers, array_size(pim_handlers)); - zclient->zebra_capabilities = pim_zebra_capabilities; - zclient->zebra_connected = pim_zebra_connected; - zclient->nexthop_update = pim_nexthop_update; + pim_zclient->zebra_capabilities = pim_zebra_capabilities; + pim_zclient->zebra_connected = pim_zebra_connected; + pim_zclient->nexthop_update = pim_nexthop_update; - zclient_init(zclient, ZEBRA_ROUTE_PIM, 0, &pimd_privs); + zclient_init(pim_zclient, ZEBRA_ROUTE_PIM, 0, &pimd_privs); if (PIM_DEBUG_PIM_TRACE) { zlog_notice("%s: zclient socket initialized", __func__); } @@ -508,8 +508,8 @@ void pim_zebra_zclient_update(struct vty *vty) { vty_out(vty, "Zclient update socket: "); - if (zclient) { - vty_out(vty, "%d failures=%d\n", zclient->sock, zclient->fail); + if (pim_zclient) { + vty_out(vty, "%d failures=%d\n", pim_zclient->sock, pim_zclient->fail); } else { vty_out(vty, "\n"); } @@ -517,8 +517,8 @@ void pim_zebra_zclient_update(struct vty *vty) struct zclient *pim_zebra_zclient_get(void) { - if (zclient) - return zclient; + if (pim_zclient) + return pim_zclient; else return NULL; } @@ -526,5 +526,5 @@ struct zclient *pim_zebra_zclient_get(void) void pim_zebra_interface_set_master(struct interface *vrf, struct interface *ifp) { - zclient_interface_set_master(zclient, vrf, ifp); + zclient_interface_set_master(pim_zclient, vrf, ifp); } diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 4ffb5bac17..b8f73f9183 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -26,7 +26,7 @@ #include "pim_zlookup.h" #include "pim_addr.h" -static struct zclient *zlookup = NULL; +static struct zclient *pim_zlookup = NULL; struct event *zlookup_read; static void zclient_lookup_sched(struct zclient *zlookup, int delay); @@ -115,25 +115,25 @@ static void zclient_lookup_failed(struct zclient *zlookup) void zclient_lookup_free(void) { EVENT_OFF(zlookup_read); - zclient_stop(zlookup); - zclient_free(zlookup); - zlookup = NULL; + zclient_stop(pim_zlookup); + zclient_free(pim_zlookup); + pim_zlookup = NULL; } void zclient_lookup_new(void) { - zlookup = zclient_new(router->master, &zclient_options_sync, NULL, 0); - if (!zlookup) { + pim_zlookup = zclient_new(router->master, &zclient_options_sync, NULL, 0); + if (!pim_zlookup) { flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient_new() failure", __func__); return; } - zlookup->sock = -1; - zlookup->t_connect = NULL; - zlookup->privs = &pimd_privs; + pim_zlookup->sock = -1; + pim_zlookup->t_connect = NULL; + pim_zlookup->privs = &pimd_privs; - zclient_lookup_sched_now(zlookup); + zclient_lookup_sched_now(pim_zlookup); zlog_notice("%s: zclient lookup socket initialized", __func__); } @@ -328,11 +328,11 @@ static int zclient_rib_lookup(struct pim_instance *pim, struct pim_zlookup_nexth (safi == SAFI_MULTICAST ? "M" : "U")); /* Check socket. */ - if (zlookup->sock < 0) { + if (pim_zlookup->sock < 0) { flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient lookup socket is not connected", __func__); - zclient_lookup_failed(zlookup); + zclient_lookup_failed(pim_zlookup); return -1; } @@ -346,31 +346,31 @@ static int zclient_rib_lookup(struct pim_instance *pim, struct pim_zlookup_nexth ipaddr.ipa_type = PIM_IPADDR; ipaddr.ipaddr_pim = addr; - s = zlookup->obuf; + s = pim_zlookup->obuf; stream_reset(s); zclient_create_header(s, ZEBRA_NEXTHOP_LOOKUP, pim->vrf->vrf_id); stream_put_ipaddr(s, &ipaddr); stream_putc(s, safi); stream_putw_at(s, 0, stream_get_endp(s)); - ret = writen(zlookup->sock, s->data, stream_get_endp(s)); + ret = writen(pim_zlookup->sock, s->data, stream_get_endp(s)); if (ret < 0) { flog_err( EC_LIB_SOCKET, "%s: writen() failure: %d writing to zclient lookup socket", __func__, errno); - zclient_lookup_failed(zlookup); + zclient_lookup_failed(pim_zlookup); return -2; } if (ret == 0) { flog_err_sys(EC_LIB_SOCKET, "%s: connection closed on zclient lookup socket", __func__); - zclient_lookup_failed(zlookup); + zclient_lookup_failed(pim_zlookup); return -3; } - return zclient_read_nexthop(pim, zlookup, nexthop_tab, tab_size, addr); + return zclient_read_nexthop(pim, pim_zlookup, nexthop_tab, tab_size, addr); } static int zclient_lookup_nexthop_once(struct pim_instance *pim, @@ -562,8 +562,8 @@ int zclient_lookup_nexthop(struct pim_instance *pim, struct pim_zlookup_nexthop void pim_zlookup_show_ip_multicast(struct vty *vty) { vty_out(vty, "Zclient lookup socket: "); - if (zlookup) { - vty_out(vty, "%d failures=%d\n", zlookup->sock, zlookup->fail); + if (pim_zlookup) { + vty_out(vty, "%d failures=%d\n", pim_zlookup->sock, pim_zlookup->fail); } else { vty_out(vty, "\n"); } @@ -571,7 +571,7 @@ void pim_zlookup_show_ip_multicast(struct vty *vty) int pim_zlookup_sg_statistics(struct channel_oil *c_oil) { - struct stream *s = zlookup->obuf; + struct stream *s = pim_zlookup->obuf; uint16_t command = 0; unsigned long long lastused; pim_sgaddr sg; @@ -602,7 +602,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil) stream_putw_at(s, 0, stream_get_endp(s)); count = stream_get_endp(s); - ret = writen(zlookup->sock, s->data, count); + ret = writen(pim_zlookup->sock, s->data, count); if (ret <= 0) { flog_err( EC_LIB_SOCKET, @@ -611,7 +611,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil) return -1; } - s = zlookup->ibuf; + s = pim_zlookup->ibuf; while (command != ZEBRA_IPMR_ROUTE_STATS) { int err; @@ -621,12 +621,12 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil) uint8_t version; stream_reset(s); - err = zclient_read_header(s, zlookup->sock, &length, &marker, + err = zclient_read_header(s, pim_zlookup->sock, &length, &marker, &version, &vrf_id, &command); if (err < 0) { flog_err(EC_LIB_ZAPI_MISSMATCH, "%s: zclient_read_header() failed", __func__); - zclient_lookup_failed(zlookup); + zclient_lookup_failed(pim_zlookup); return -1; } } @@ -642,7 +642,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil) EC_LIB_ZAPI_MISSMATCH, "%s: Received wrong %pSG(%s) information requested", __func__, &more, c_oil->pim->vrf->name); - zclient_lookup_failed(zlookup); + zclient_lookup_failed(pim_zlookup); return -3; } diff --git a/pimd/pim_zpthread.c b/pimd/pim_zpthread.c index d6b2621ff4..45d8868808 100644 --- a/pimd/pim_zpthread.c +++ b/pimd/pim_zpthread.c @@ -13,7 +13,7 @@ #include "pim_mlag.h" #include "pim_zebra.h" -extern struct zclient *zclient; +extern struct zclient *pim_zclient; #define PIM_MLAG_POST_LIMIT 100 @@ -96,7 +96,7 @@ static void pim_mlag_zebra_flush_buffer(void) } } - zclient_send_mlag_data(zclient, router->mlag_stream); + zclient_send_mlag_data(pim_zclient, router->mlag_stream); stream_failure: stream_reset(router->mlag_stream); mlag_bulk_cnt = 0;