]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: clean up variable-shadow warnings
authorMark Stapp <mjs@cisco.com>
Wed, 26 Mar 2025 19:27:09 +0000 (15:27 -0400)
committerMark Stapp <mjs@cisco.com>
Tue, 8 Apr 2025 18:41:27 +0000 (14:41 -0400)
Clean up -Wshadow warnings in pimd

Signed-off-by: Mark Stapp <mjs@cisco.com>
pimd/pim_mlag.c
pimd/pim_nht.c
pimd/pim_upstream.c
pimd/pim_zebra.c
pimd/pim_zlookup.c
pimd/pim_zpthread.c

index dcef2d0d33ab40a3145ec889241335eac599c34a..3b4e71ecf48bd7c5c18718218250edb2b2aabc43 100644 (file)
@@ -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)
index 1e9ea24b2621834137992143223e5117f36b32e7..d97b56e4d6875efa4b4a15190d818c5731ba76fb 100644 (file)
@@ -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));
index e4603ff946c8e29e3813759b4f510fe8faee425e..aed9d2be9033ef456c2144dd17094a1e8b53cb74 100644 (file)
@@ -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))",
index f0ec3c6b6e8257b27c5c5e4e2067d348d27945a8..1f7e2b255f6435919c7095d73c07b5619620847c 100644 (file)
@@ -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, "<null zclient>\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);
 }
index 4ffb5bac17c20705234a13e5de4b92edf8e0e9f5..b8f73f91837629bf66c6faa5922c0a1399faa41b 100644 (file)
@@ -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, "<null zclient>\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;
        }
 
index d6b2621ff4b6fb4a2d35fa64e71f6c3ecfb81c54..45d886880805ceaa3854d1d0915fd19db356a2e3 100644 (file)
@@ -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;