]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6: clean up -Wshadow warnings
authorMark Stapp <mjs@cisco.com>
Thu, 23 Jan 2025 20:42:52 +0000 (15:42 -0500)
committerMark Stapp <mjs@cisco.com>
Tue, 8 Apr 2025 18:41:27 +0000 (14:41 -0400)
Clean up various "shadow" warnings.

Signed-off-by: Mark Stapp <mjs@cisco.com>
ospf6d/ospf6_abr.c
ospf6d/ospf6_area.h
ospf6d/ospf6_asbr.c
ospf6d/ospf6_bfd.c
ospf6d/ospf6_main.c
ospf6d/ospf6_snmp.c
ospf6d/ospf6_top.c
ospf6d/ospf6_top.h
ospf6d/ospf6_zebra.c
ospf6d/ospf6_zebra.h
ospf6d/ospf6d.c

index 343dfefcecd39966f03f1e1782be93c52cbc3abd..2cb63d8a29051d4f830dbd15502fbf6b0145fb83 100644 (file)
@@ -515,8 +515,6 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
                        summary->path.origin.id =
                                ADV_ROUTER_IN_PREFIX(&route->prefix);
                } else {
-                       struct ospf6_lsa *old;
-
                        summary->path.origin.type =
                                htons(OSPF6_LSTYPE_INTER_PREFIX);
 
index 2ed69cc59785a21b434954ffce86552a57fc079c..16049427acd814d0d44930191aa6c741a844bbfb 100644 (file)
@@ -123,16 +123,16 @@ struct ospf6_area {
 
 #define OSPF6_CMD_AREA_GET(str, oa, ospf6)                                     \
        {                                                                      \
-               uint32_t area_id;                                              \
-               int format, ret;                                               \
-               ret = str2area_id(str, &area_id, &format);                     \
-               if (ret) {                                                     \
+               uint32_t _area_id;                                             \
+               int _format, _ret;                                             \
+               _ret = str2area_id(str, &_area_id, &_format);                  \
+               if (_ret) {                                                    \
                        vty_out(vty, "Malformed Area-ID: %s\n", str);          \
                        return CMD_WARNING;                                    \
                }                                                              \
-               oa = ospf6_area_lookup(area_id, ospf6);                        \
+               oa = ospf6_area_lookup(_area_id, ospf6);                       \
                if (oa == NULL)                                                \
-                       oa = ospf6_area_create(area_id, ospf6, format);        \
+                       oa = ospf6_area_create(_area_id, ospf6, _format);      \
        }
 
 /* prototypes */
index 8fa85badbec0e6d6a451881fa8c1f9c997064555..df2758b081a45781c84def69df1df127719616d4 100644 (file)
@@ -1899,7 +1899,7 @@ static void ospf6_redistribute_default_set(struct ospf6 *ospf6, int originate)
                break;
        case DEFAULT_ORIGINATE_ZEBRA:
                zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE,
-                                            zclient, AFI_IP6, ospf6->vrf_id);
+                                            ospf6_zclient, AFI_IP6, ospf6->vrf_id);
                ospf6_asbr_redistribute_remove(DEFAULT_ROUTE, 0,
                                               (struct prefix *)&p, ospf6);
 
@@ -1915,7 +1915,7 @@ static void ospf6_redistribute_default_set(struct ospf6 *ospf6, int originate)
                break;
        case DEFAULT_ORIGINATE_ZEBRA:
                zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
-                                            zclient, AFI_IP6, ospf6->vrf_id);
+                                            ospf6_zclient, AFI_IP6, ospf6->vrf_id);
 
                break;
        case DEFAULT_ORIGINATE_ALWAYS:
index 6379f9d992c59ebb7aa9e767b0ce1c095187d61d..0b00558572b4bf09036bb7fb74bd68658e7a587b 100644 (file)
@@ -27,8 +27,6 @@
 #include "ospf6_zebra.h"
 #include "ospf6_bfd.h"
 
-extern struct zclient *zclient;
-
 /*
  * ospf6_bfd_trigger_event - Neighbor is registered/deregistered with BFD when
  *                           neighbor state is changed to/from 2way.
@@ -280,7 +278,7 @@ DEFUN (no_ipv6_ospf6_bfd,
 
 void ospf6_bfd_init(void)
 {
-       bfd_protocol_integration_init(zclient, master);
+       bfd_protocol_integration_init(ospf6_zclient, master);
 
        /* Install BFD command */
        install_element(INTERFACE_NODE, &ipv6_ospf6_bfd_cmd);
index 8320f11f6cceed20a325318cc2b72a1a6cf42d37..e94f2a1c474de0897c9b7949918f3027468e02b1 100644 (file)
@@ -104,9 +104,9 @@ static void __attribute__((noreturn)) ospf6_exit(int status)
 
        vrf_terminate();
 
-       if (zclient) {
-               zclient_stop(zclient);
-               zclient_free(zclient);
+       if (ospf6_zclient) {
+               zclient_stop(ospf6_zclient);
+               zclient_free(ospf6_zclient);
        }
 
        ospf6_master_delete();
index 9ac8b6c1af9d2b19f395909bc4b73567961397bb..037ca9bc0b0d663a7c8172cf7fa1955cfaeb08f1 100644 (file)
@@ -1382,9 +1382,9 @@ static int ospf6TrapIfStateChange(struct ospf6_interface *oi, int next_state,
 }
 
 /* Register OSPFv3-MIB. */
-static int ospf6_snmp_init(struct event_loop *master)
+static int ospf6_snmp_init(struct event_loop *mstr)
 {
-       smux_init(master);
+       smux_init(mstr);
        REGISTER_MIB("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid);
        return 0;
 }
index ad487f3565a916e529057f55595469d4d06fcbc6..9755cc44ccc70a8fe3aa887dde03c52e46edf8fd 100644 (file)
@@ -142,20 +142,20 @@ static void ospf6_set_redist_vrf_bitmaps(struct ospf6 *ospf6, bool set)
                                "%s: setting redist vrf %d bitmap for type %d",
                                __func__, ospf6->vrf_id, type);
                if (set)
-                       vrf_bitmap_set(&zclient->redist[AFI_IP6][type],
+                       vrf_bitmap_set(&ospf6_zclient->redist[AFI_IP6][type],
                                       ospf6->vrf_id);
                else
-                       vrf_bitmap_unset(&zclient->redist[AFI_IP6][type],
+                       vrf_bitmap_unset(&ospf6_zclient->redist[AFI_IP6][type],
                                         ospf6->vrf_id);
        }
 
        red_list = ospf6->redist[DEFAULT_ROUTE];
        if (red_list) {
                if (set)
-                       vrf_bitmap_set(&zclient->default_information[AFI_IP6],
+                       vrf_bitmap_set(&ospf6_zclient->default_information[AFI_IP6],
                                       ospf6->vrf_id);
                else
-                       vrf_bitmap_unset(&zclient->default_information[AFI_IP6],
+                       vrf_bitmap_unset(&ospf6_zclient->default_information[AFI_IP6],
                                         ospf6->vrf_id);
        }
 }
@@ -566,13 +566,13 @@ static void ospf6_disable(struct ospf6 *o)
        }
 }
 
-void ospf6_master_init(struct event_loop *master)
+void ospf6_master_init(struct event_loop *mst)
 {
        memset(&ospf6_master, 0, sizeof(ospf6_master));
 
        om6 = &ospf6_master;
        om6->ospf6 = list_new();
-       om6->master = master;
+       om6->master = mst;
 }
 
 void ospf6_master_delete(void)
index 8288413c105613859649e430f05978678fb5330f..2b29eeae897ce2686ea4dd0ab610e200077e09a7 100644 (file)
@@ -231,7 +231,6 @@ DECLARE_QOBJ_TYPE(ospf6);
 #define OSPF6_STUB_ROUTER 0x02
 
 /* global pointer for OSPF top data structure */
-extern struct ospf6 *ospf6;
 extern struct ospf6_master *om6;
 
 /* prototypes */
index 466301309f2a22ea437c7a1e6e529f820d278305..cfb9bc1c11b2754d2fa9dac44fdbb8becef2e124 100644 (file)
@@ -36,11 +36,11 @@ DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_DISTANCE, "OSPF6 distance");
 unsigned char conf_debug_ospf6_zebra = 0;
 
 /* information about zebra. */
-struct zclient *zclient = NULL;
+struct zclient *ospf6_zclient = NULL;
 
 void ospf6_zebra_vrf_register(struct ospf6 *ospf6)
 {
-       if (!zclient || zclient->sock < 0 || !ospf6)
+       if (!ospf6_zclient || ospf6_zclient->sock < 0 || !ospf6)
                return;
 
        if (ospf6->vrf_id != VRF_UNKNOWN) {
@@ -49,13 +49,13 @@ void ospf6_zebra_vrf_register(struct ospf6 *ospf6)
                                   ospf6_vrf_id_to_name(ospf6->vrf_id),
                                   ospf6->vrf_id);
                }
-               zclient_send_reg_requests(zclient, ospf6->vrf_id);
+               zclient_send_reg_requests(ospf6_zclient, ospf6->vrf_id);
        }
 }
 
 void ospf6_zebra_vrf_deregister(struct ospf6 *ospf6)
 {
-       if (!zclient || zclient->sock < 0 || !ospf6)
+       if (!ospf6_zclient || ospf6_zclient->sock < 0 || !ospf6)
                return;
 
        if (ospf6->vrf_id != VRF_DEFAULT && ospf6->vrf_id != VRF_UNKNOWN) {
@@ -67,7 +67,7 @@ void ospf6_zebra_vrf_deregister(struct ospf6 *ospf6)
                }
                /* Deregister for router-id, interfaces,
                 * redistributed routes. */
-               zclient_send_dereg_requests(zclient, ospf6->vrf_id);
+               zclient_send_dereg_requests(ospf6_zclient, ospf6->vrf_id);
        }
 }
 
@@ -98,22 +98,22 @@ static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
 /* redistribute function */
 void ospf6_zebra_redistribute(int type, vrf_id_t vrf_id)
 {
-       if (vrf_bitmap_check(&zclient->redist[AFI_IP6][type], vrf_id))
+       if (vrf_bitmap_check(&ospf6_zclient->redist[AFI_IP6][type], vrf_id))
                return;
-       vrf_bitmap_set(&zclient->redist[AFI_IP6][type], vrf_id);
+       vrf_bitmap_set(&ospf6_zclient->redist[AFI_IP6][type], vrf_id);
 
-       if (zclient->sock > 0)
-               zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient,
+       if (ospf6_zclient->sock > 0)
+               zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, ospf6_zclient,
                                        AFI_IP6, type, 0, vrf_id);
 }
 
 void ospf6_zebra_no_redistribute(int type, vrf_id_t vrf_id)
 {
-       if (!vrf_bitmap_check(&zclient->redist[AFI_IP6][type], vrf_id))
+       if (!vrf_bitmap_check(&ospf6_zclient->redist[AFI_IP6][type], vrf_id))
                return;
-       vrf_bitmap_unset(&zclient->redist[AFI_IP6][type], vrf_id);
-       if (zclient->sock > 0)
-               zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient,
+       vrf_bitmap_unset(&ospf6_zclient->redist[AFI_IP6][type], vrf_id);
+       if (ospf6_zclient->sock > 0)
+               zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, ospf6_zclient,
                                        AFI_IP6, type, 0, vrf_id);
 }
 
@@ -122,7 +122,7 @@ void ospf6_zebra_import_default_route(struct ospf6 *ospf6, bool unreg)
        struct prefix prefix = {};
        int command;
 
-       if (zclient->sock < 0) {
+       if (ospf6_zclient->sock < 0) {
                if (IS_OSPF6_DEBUG_ZEBRA(SEND))
                        zlog_debug("  Not connected to Zebra");
                return;
@@ -141,7 +141,7 @@ void ospf6_zebra_import_default_route(struct ospf6 *ospf6, bool unreg)
                           zserv_command_string(command), &prefix,
                           ospf6->vrf_id);
 
-       if (zclient_send_rnh(zclient, command, &prefix, SAFI_UNICAST, false,
+       if (zclient_send_rnh(ospf6_zclient, command, &prefix, SAFI_UNICAST, false,
                             true, ospf6->vrf_id)
            == ZCLIENT_SEND_FAILURE)
                flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient_send_rnh() failed",
@@ -216,7 +216,7 @@ static int ospf6_zebra_gr_update(struct ospf6 *ospf6, int command,
 {
        struct zapi_cap api;
 
-       if (!zclient || zclient->sock < 0 || !ospf6)
+       if (!ospf6_zclient || ospf6_zclient->sock < 0 || !ospf6)
                return 1;
 
        memset(&api, 0, sizeof(api));
@@ -224,7 +224,7 @@ static int ospf6_zebra_gr_update(struct ospf6 *ospf6, int command,
        api.stale_removal_time = stale_time;
        api.vrf_id = ospf6->vrf_id;
 
-       (void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient,
+       (void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, ospf6_zclient,
                                        &api);
 
        return 0;
@@ -313,7 +313,7 @@ DEFUN(show_zebra,
        json_object *json_zebra;
        json_object *json_array;
 
-       if (zclient == NULL) {
+       if (ospf6_zclient == NULL) {
                vty_out(vty, "Not connected to zebra\n");
                return CMD_SUCCESS;
        }
@@ -323,13 +323,13 @@ DEFUN(show_zebra,
                json_zebra = json_object_new_object();
                json_array = json_object_new_array();
 
-               json_object_int_add(json_zebra, "fail", zclient->fail);
+               json_object_int_add(json_zebra, "fail", ospf6_zclient->fail);
                json_object_int_add(
                        json_zebra, "redistributeDefault",
-                       vrf_bitmap_check(&zclient->default_information[AFI_IP6],
+                       vrf_bitmap_check(&ospf6_zclient->default_information[AFI_IP6],
                                         VRF_DEFAULT));
                for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
-                       if (vrf_bitmap_check(&zclient->redist[AFI_IP6][i],
+                       if (vrf_bitmap_check(&ospf6_zclient->redist[AFI_IP6][i],
                                             VRF_DEFAULT))
                                json_object_array_add(
                                        json_array,
@@ -342,13 +342,13 @@ DEFUN(show_zebra,
                vty_json(vty, json);
        } else {
                vty_out(vty, "Zebra Information\n");
-               vty_out(vty, "  fail: %d\n", zclient->fail);
+               vty_out(vty, "  fail: %d\n", ospf6_zclient->fail);
                vty_out(vty, "  redistribute default: %d\n",
-                       vrf_bitmap_check(&zclient->default_information[AFI_IP6],
+                       vrf_bitmap_check(&ospf6_zclient->default_information[AFI_IP6],
                                         VRF_DEFAULT));
                vty_out(vty, "  redistribute:");
                for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
-                       if (vrf_bitmap_check(&zclient->redist[AFI_IP6][i],
+                       if (vrf_bitmap_check(&ospf6_zclient->redist[AFI_IP6][i],
                                             VRF_DEFAULT))
                                vty_out(vty, " %s", zebra_route_string(i));
                }
@@ -403,7 +403,7 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request,
                zlog_debug("Zebra Send %s route: %pFX",
                           (type == REM ? "remove" : "add"), &request->prefix);
 
-       if (zclient->sock < 0) {
+       if (ospf6_zclient->sock < 0) {
                if (IS_OSPF6_DEBUG_ZEBRA(SEND))
                        zlog_debug("  Not connected to Zebra");
                return;
@@ -487,9 +487,9 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request,
                ospf6_zebra_append_opaque_attr(request, &api);
 
        if (type == REM)
-               ret = zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
+               ret = zclient_route_send(ZEBRA_ROUTE_DELETE, ospf6_zclient, &api);
        else
-               ret = zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
+               ret = zclient_route_send(ZEBRA_ROUTE_ADD, ospf6_zclient, &api);
 
        if (ret == ZCLIENT_SEND_FAILURE)
                flog_err(EC_LIB_ZAPI_SOCKET,
@@ -552,7 +552,7 @@ void ospf6_zebra_add_discard(struct ospf6_route *request, struct ospf6 *ospf6)
                api.prefix = *dest;
                zapi_route_set_blackhole(&api, BLACKHOLE_NULL);
 
-               zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
+               zclient_route_send(ZEBRA_ROUTE_ADD, ospf6_zclient, &api);
 
                if (IS_OSPF6_DEBUG_ZEBRA(SEND))
                        zlog_debug("Zebra: Route add discard %pFX", dest);
@@ -589,7 +589,7 @@ void ospf6_zebra_delete_discard(struct ospf6_route *request,
                api.prefix = *dest;
                zapi_route_set_blackhole(&api, BLACKHOLE_NULL);
 
-               zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
+               zclient_route_send(ZEBRA_ROUTE_DELETE, ospf6_zclient, &api);
 
                if (IS_OSPF6_DEBUG_ZEBRA(SEND))
                        zlog_debug("Zebra: Route delete discard %pFX", dest);
@@ -758,14 +758,14 @@ static zclient_handler *const ospf6_handlers[] = {
        [ZEBRA_REDISTRIBUTE_ROUTE_DEL] = ospf6_zebra_read_route,
 };
 
-void ospf6_zebra_init(struct event_loop *master)
+void ospf6_zebra_init(struct event_loop *mst)
 {
        /* Allocate zebra structure. */
-       zclient = zclient_new(master, &zclient_options_default, ospf6_handlers,
-                             array_size(ospf6_handlers));
-       zclient_init(zclient, ZEBRA_ROUTE_OSPF6, 0, &ospf6d_privs);
-       zclient->zebra_connected = ospf6_zebra_connected;
-       zclient->nexthop_update = ospf6_zebra_import_check_update;
+       ospf6_zclient = zclient_new(mst, &zclient_options_default, ospf6_handlers,
+                                   array_size(ospf6_handlers));
+       zclient_init(ospf6_zclient, ZEBRA_ROUTE_OSPF6, 0, &ospf6d_privs);
+       ospf6_zclient->zebra_connected = ospf6_zebra_connected;
+       ospf6_zclient->nexthop_update = ospf6_zebra_import_check_update;
 
        /* Install command element for zebra node. */
        install_element(VIEW_NODE, &show_ospf6_zebra_cmd);
index 7669b5e2c0cd3a24cddf61a3503f15dbfe5ec299..0ad86e8c9a349ea7233e2a58b6df3377c63145fe 100644 (file)
@@ -27,7 +27,7 @@ struct ospf6_distance {
        char *access_list;
 };
 
-extern struct zclient *zclient;
+extern struct zclient *ospf6_zclient;
 struct ospf6;
 
 extern void ospf6_zebra_route_update_add(struct ospf6_route *request,
@@ -38,7 +38,7 @@ extern void ospf6_zebra_route_update_remove(struct ospf6_route *request,
 extern void ospf6_zebra_redistribute(int, vrf_id_t vrf_id);
 extern void ospf6_zebra_no_redistribute(int, vrf_id_t vrf_id);
 #define ospf6_zebra_is_redistribute(type, vrf_id)                              \
-       vrf_bitmap_check(&zclient->redist[AFI_IP6][type], vrf_id)
+       vrf_bitmap_check(&ospf6_zclient->redist[AFI_IP6][type], vrf_id)
 extern void ospf6_zebra_init(struct event_loop *tm);
 extern void ospf6_zebra_import_default_route(struct ospf6 *ospf6, bool unreg);
 extern void ospf6_zebra_add_discard(struct ospf6_route *request,
index e4e0354fc9f3a98d7df7d2a7b79f9d13fffb561b..ddb8a461d5aef980e76cc133e93f6fd9f256a205 100644 (file)
@@ -1408,13 +1408,13 @@ static void install_element_ospf6_debug_event(void)
 }
 
 /* Install ospf related commands. */
-void ospf6_init(struct event_loop *master)
+void ospf6_init(struct event_loop *mst)
 {
        ospf6_top_init();
        ospf6_area_init();
        ospf6_interface_init();
        ospf6_neighbor_init();
-       ospf6_zebra_init(master);
+       ospf6_zebra_init(mst);
 
        ospf6_lsa_init();
        ospf6_spf_init();