From: Mark Stapp Date: Thu, 23 Jan 2025 18:16:11 +0000 (-0500) Subject: isisd: clean up -Wshadow warnings X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e88f0a47782b0b81d6f04874e04a8712b1a97572;p=mirror%2Ffrr.git isisd: clean up -Wshadow warnings Clean up various "shadow" warnings. Signed-off-by: Mark Stapp --- diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 078280acf5..39ed076fab 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -653,7 +653,6 @@ void isis_adj_print_json(struct isis_adjacency *adj, struct json_object *json, json_object_object_add(iface_json, "ipv6-link-local", ipv6_link_json); for (unsigned int i = 0; i < adj->ll_ipv6_count; i++) { - char buf[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &adj->ll_ipv6_addrs[i], buf, sizeof(buf)); json_object_string_add(ipv6_link_json, "ipv6", @@ -666,7 +665,6 @@ void isis_adj_print_json(struct isis_adjacency *adj, struct json_object *json, ipv6_non_link_json); for (unsigned int i = 0; i < adj->global_ipv6_count; i++) { - char buf[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &adj->global_ipv6_addrs[i], buf, sizeof(buf)); json_object_string_add(ipv6_non_link_json, diff --git a/isisd/isis_bfd.c b/isisd/isis_bfd.c index 5e24e35210..c003b8002d 100644 --- a/isisd/isis_bfd.c +++ b/isisd/isis_bfd.c @@ -211,7 +211,7 @@ static int bfd_handle_circuit_add_addr(struct isis_circuit *circuit) void isis_bfd_init(struct event_loop *tm) { - bfd_protocol_integration_init(zclient, tm); + bfd_protocol_integration_init(isis_zclient, tm); hook_register(isis_adj_state_change_hook, bfd_handle_adj_state_change); hook_register(isis_adj_ip_enabled_hook, bfd_handle_adj_ip_enabled); diff --git a/isisd/isis_ldp_sync.c b/isisd/isis_ldp_sync.c index 53676ffe36..99e9227ad5 100644 --- a/isisd/isis_ldp_sync.c +++ b/isisd/isis_ldp_sync.c @@ -40,10 +40,9 @@ #include "isisd/isis_errors.h" #include "isisd/isis_tx_queue.h" #include "isisd/isis_nb.h" +#include "isisd/isis_zebra.h" #include "isisd/isis_ldp_sync.h" -extern struct zclient *zclient; - /* * LDP-SYNC msg between IGP and LDP */ @@ -122,8 +121,8 @@ void isis_ldp_sync_state_req_msg(struct isis_circuit *circuit) request.proto = LDP_IGP_SYNC_IF_STATE_REQUEST; request.ifindex = ifp->ifindex; - zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_REQUEST, - (uint8_t *)&request, sizeof(request)); + zclient_send_opaque(isis_zclient, LDP_IGP_SYNC_IF_STATE_REQUEST, + (uint8_t *)&request, sizeof(request)); } /* diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 28b987df38..4952c689fc 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -1125,7 +1125,6 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) struct isis_router_cap *rcap; #ifndef FABRICD struct isis_router_cap_fad *rcap_fad; - struct listnode *node; struct flex_algo *fa; #endif /* ifndef FABRICD */ diff --git a/isisd/isis_route.c b/isisd/isis_route.c index b907c962be..0a0c6341d6 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -240,7 +240,7 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p, for (ALL_LIST_ELEMENTS_RO(adjacencies, node, vadj)) { struct isis_spf_adj *sadj = vadj->sadj; struct isis_adjacency *adj = sadj->adj; - struct isis_sr_psid_info *sr = &vadj->sr; + struct isis_sr_psid_info *vsr = &vadj->sr; struct mpls_label_stack *label_stack = vadj->label_stack; /* @@ -248,7 +248,7 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p, * environment. */ if (CHECK_FLAG(im->options, F_ISIS_UNIT_TEST)) { - isis_route_add_dummy_nexthops(rinfo, sadj->id, sr, + isis_route_add_dummy_nexthops(rinfo, sadj->id, vsr, label_stack); if (!allow_ecmp) break; @@ -260,7 +260,7 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p, ISIS_CIRCUIT_FLAPPED_AFTER_SPF)) SET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC); - adjinfo2nexthop(prefix->family, rinfo->nexthops, adj, sr, + adjinfo2nexthop(prefix->family, rinfo->nexthops, adj, vsr, label_stack); if (!allow_ecmp) break; diff --git a/isisd/isis_snmp.c b/isisd/isis_snmp.c index 83a06b6998..24320e9ed9 100644 --- a/isisd/isis_snmp.c +++ b/isisd/isis_snmp.c @@ -692,15 +692,15 @@ static int isis_circuit_snmp_id_free(struct isis_circuit *circuit) static struct isis_circuit *isis_snmp_circuit_next(struct isis_circuit *circuit) { uint32_t start; - uint32_t off; + uint32_t offset; start = 1; if (circuit != NULL) start = circuit->snmp_id + 1; - for (off = start; off < SNMP_CIRCUITS_MAX; off++) { - circuit = snmp_circuits[off]; + for (offset = start; offset < SNMP_CIRCUITS_MAX; offset++) { + circuit = snmp_circuits[offset]; if (circuit != NULL) return circuit; @@ -759,7 +759,7 @@ static int isis_snmp_get_level_match(int is_type, int level) static int isis_snmp_conv_exact(uint8_t *buf, size_t max_len, size_t *out_len, const oid *idx, size_t idx_len) { - size_t off; + size_t offset; size_t len; /* Oid representation: length followed by bytes */ @@ -774,11 +774,11 @@ static int isis_snmp_conv_exact(uint8_t *buf, size_t max_len, size_t *out_len, if (idx_len < len + 1) return 0; - for (off = 0; off < len; off++) { - if (idx[off + 1] > 0xff) + for (offset = 0; offset < len; offset++) { + if (idx[offset + 1] > 0xff) return 0; - buf[off] = (uint8_t)(idx[off + 1] & 0xff); + buf[offset] = (uint8_t)(idx[offset + 1] & 0xff); } *out_len = len; @@ -789,7 +789,7 @@ static int isis_snmp_conv_exact(uint8_t *buf, size_t max_len, size_t *out_len, static int isis_snmp_conv_next(uint8_t *buf, size_t max_len, size_t *out_len, int *try_exact, const oid *idx, size_t idx_len) { - size_t off; + size_t offset; size_t len; size_t cmp_len; @@ -809,15 +809,15 @@ static int isis_snmp_conv_next(uint8_t *buf, size_t max_len, size_t *out_len, if ((idx_len - 1) < cmp_len) cmp_len = idx_len - 1; - for (off = 0; off < cmp_len; off++) { - if (idx[off + 1] > 0xff) { - memset(buf + off, 0xff, len - off); + for (offset = 0; offset < cmp_len; offset++) { + if (idx[offset + 1] > 0xff) { + memset(buf + offset, 0xff, len - off); *out_len = len; *try_exact = 1; return 1; } - buf[off] = (uint8_t)(idx[off + 1] & 0xff); + buf[offset] = (uint8_t)(idx[offset + 1] & 0xff); } if (cmp_len < len) @@ -983,7 +983,7 @@ static int isis_snmp_circuit_lookup_exact(oid *oid_idx, size_t oid_idx_len, static int isis_snmp_circuit_lookup_next(oid *oid_idx, size_t oid_idx_len, struct isis_circuit **ret_circuit) { - oid off; + oid offset; oid start; struct isis_circuit *circuit; @@ -996,10 +996,10 @@ static int isis_snmp_circuit_lookup_next(oid *oid_idx, size_t oid_idx_len, start = oid_idx[0]; } - for (off = start; off < SNMP_CIRCUITS_MAX; ++off) { - circuit = snmp_circuits[off]; + for (offset = start; offset < SNMP_CIRCUITS_MAX; ++offset) { + circuit = snmp_circuits[offset]; - if (circuit != NULL && off > start) { + if (circuit != NULL && offset > start) { if (ret_circuit != NULL) *ret_circuit = circuit; @@ -1052,7 +1052,7 @@ static int isis_snmp_circuit_level_lookup_next( oid *oid_idx, size_t oid_idx_len, int check_match, struct isis_circuit **ret_circuit, int *ret_level) { - oid off; + oid offset; oid start; struct isis_circuit *circuit = NULL; int level; @@ -1066,13 +1066,13 @@ static int isis_snmp_circuit_level_lookup_next( start = oid_idx[0]; } - for (off = start; off < SNMP_CIRCUITS_MAX; off++) { - circuit = snmp_circuits[off]; + for (offset = start; offset < SNMP_CIRCUITS_MAX; offset++) { + circuit = snmp_circuits[offset]; if (circuit == NULL) continue; - if (off > start || oid_idx_len < 2) { + if (offset > start || oid_idx_len < 2) { /* Found and can use level 1 */ level = IS_LEVEL_1; break; @@ -1504,7 +1504,7 @@ static uint8_t *isis_snmp_find_man_area(struct variable *v, oid *name, struct iso_address *area_addr = NULL; oid *oid_idx; size_t oid_idx_len; - size_t off = 0; + size_t offset = 0; *write_method = NULL; @@ -1539,8 +1539,8 @@ static uint8_t *isis_snmp_find_man_area(struct variable *v, oid *name, /* Append index */ name[v->namelen] = area_addr->addr_len; - for (off = 0; off < area_addr->addr_len; off++) - name[v->namelen + 1 + off] = area_addr->area_addr[off]; + for (offset = 0; offset < area_addr->addr_len; offset++) + name[v->namelen + 1 + offset] = area_addr->area_addr[offset]; *length = v->namelen + 1 + area_addr->addr_len; } @@ -1628,7 +1628,7 @@ static uint8_t *isis_snmp_find_router(struct variable *v, oid *name, struct isis_dynhn *dyn = NULL; oid *oid_idx; size_t oid_idx_len; - size_t off = 0; + size_t offset = 0; struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT); if (isis == NULL) @@ -1729,8 +1729,8 @@ static uint8_t *isis_snmp_find_router(struct variable *v, oid *name, /* Append index */ name[v->namelen] = ISIS_SYS_ID_LEN; - for (off = 0; off < ISIS_SYS_ID_LEN; off++) - name[v->namelen + 1 + off] = dyn->id[off]; + for (offset = 0; offset < ISIS_SYS_ID_LEN; offset++) + name[v->namelen + 1 + off] = dyn->id[offset]; name[v->namelen + 1 + ISIS_SYS_ID_LEN] = (oid)dyn->level; @@ -2803,8 +2803,8 @@ static int isis_snmp_init(struct event_loop *tm) struct isis_func_to_prefix *h2f = isis_func_to_prefix_arr; struct variable *v; - for (size_t off = 0; off < isis_var_count; off++) { - v = &isis_var_arr[off]; + for (size_t offset = 0; offset < isis_var_count; offset++) { + v = &isis_var_arr[offset]; if (v->findVar != h2f->ihtp_func) { /* Next table */ @@ -2858,7 +2858,7 @@ static int isis_snmp_db_overload_update(const struct isis_area *area) { netsnmp_variable_list *notification_vars; long val; - uint32_t off; + uint32_t offset; if (!isis_snmp_trap_throttle(ISIS_TRAP_DB_OVERLOAD)) return 0; @@ -2880,8 +2880,8 @@ static int isis_snmp_db_overload_update(const struct isis_area *area) (uint8_t *)&val, sizeof(val)); /* Patch sys_level_state with proper index */ - off = array_size(isis_snmp_trap_data_var_sys_level_state) - 1; - isis_snmp_trap_data_var_sys_level_state[off] = val; + offset = array_size(isis_snmp_trap_data_var_sys_level_state) - 1; + isis_snmp_trap_data_var_sys_level_state[offset] = val; /* Prepare data */ if (area->overload_bit) diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 9c32a8447c..5960fef755 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -1195,7 +1195,7 @@ end: && !spftree->area->attached_bit_rcv_ignore && (spftree->area->is_type & IS_LEVEL_1) && !isis_level2_adj_up(spftree->area)) { - struct prefix_pair ip_info = { {0} }; + memset(&ip_info, 0, sizeof(ip_info)); if (IS_DEBUG_RTE_EVENTS) zlog_debug("ISIS-Spf (%pLS): add default %s route", lsp->hdr.lsp_id, diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index 95ea36c3a8..fd6a44504c 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -749,11 +749,11 @@ void sr_adj_sid_add_single(struct isis_adjacency *adj, int family, bool backup, sra->backup_nexthops = list_new(); for (ALL_LIST_ELEMENTS_RO(nexthops, node, vadj)) { - struct isis_adjacency *adj = vadj->sadj->adj; + struct isis_adjacency *tadj = vadj->sadj->adj; struct mpls_label_stack *label_stack; label_stack = vadj->label_stack; - adjinfo2nexthop(family, sra->backup_nexthops, adj, NULL, + adjinfo2nexthop(family, sra->backup_nexthops, tadj, NULL, label_stack); } } diff --git a/isisd/isis_te.c b/isisd/isis_te.c index 32492ae0c0..cf92ae46e9 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -704,15 +704,15 @@ static int isis_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(isis_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(isis_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(isis_zclient, &msg, NULL); break; default: rc = -1; @@ -1494,7 +1494,7 @@ static void isis_te_parse_lsp(struct mpls_te_area *mta, struct isis_lsp *lsp) /* Clean remaining Orphan Edges or Subnets */ if (IS_EXPORT_TE(mta)) - ls_vertex_clean(ted, vertex, zclient); + ls_vertex_clean(ted, vertex, isis_zclient); else ls_vertex_clean(ted, vertex, NULL); } @@ -1653,7 +1653,7 @@ int isis_te_sync_ted(struct zapi_opaque_reg_info dst) if (IS_MPLS_TE(mta) && IS_EXPORT_TE(mta)) { te_debug(" |- Export TED from area %s", area->area_tag); - rc = ls_sync_ted(mta->ted, zclient, &dst); + rc = ls_sync_ted(mta->ted, isis_zclient, &dst); if (rc != 0) return rc; } diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 8c97dcda2f..aa9d5e683b 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -518,7 +518,7 @@ static void format_item_asla_subtlvs(struct isis_asla_subtlvs *asla, asla->max_rsv_bw); if (IS_SUBTLV(asla, EXT_UNRSV_BW)) { sbuf_push(buf, indent + 2, "Unreserved Bandwidth:\n"); - for (int j = 0; j < MAX_CLASS_TYPE; j += 2) { + for (j = 0; j < MAX_CLASS_TYPE; j += 2) { sbuf_push( buf, indent + 2, "[%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)\n", @@ -3209,7 +3209,7 @@ static struct isis_item *copy_item_lsp_entry(struct isis_item *i) } static void format_item_lsp_entry(uint16_t mtid, struct isis_item *i, - struct sbuf *buf, struct json_object *json, + struct sbuf *sbuf, struct json_object *json, int indent) { struct isis_lsp_entry *e = (struct isis_lsp_entry *)i; @@ -3229,10 +3229,9 @@ static void format_item_lsp_entry(uint16_t mtid, struct isis_item *i, json_object_string_add(lsp_json, "chksum", buf); json_object_int_add(lsp_json, "lifetime", e->checksum); } else - sbuf_push( - buf, indent, - "LSP Entry: %s, seq 0x%08x, cksum 0x%04hx, lifetime %hus\n", - sys_id, e->seqno, e->checksum, e->rem_lifetime); + sbuf_push(sbuf, indent, + "LSP Entry: %s, seq 0x%08x, cksum 0x%04hx, lifetime %hus\n", + sys_id, e->seqno, e->checksum, e->rem_lifetime); } static void free_item_lsp_entry(struct isis_item *i) @@ -3553,7 +3552,7 @@ static void copy_tlv_protocols_supported(struct isis_protocols_supported *src, } static void format_tlv_protocols_supported(struct isis_protocols_supported *p, - struct sbuf *buf, + struct sbuf *sbuf, struct json_object *json, int indent) { if (!p || !p->count || !p->protocols) @@ -3572,12 +3571,12 @@ static void format_tlv_protocols_supported(struct isis_protocols_supported *p, nlpid2str(p->protocols[i])); } } else { - sbuf_push(buf, indent, "Protocols Supported: "); + sbuf_push(sbuf, indent, "Protocols Supported: "); for (uint8_t i = 0; i < p->count; i++) { - sbuf_push(buf, 0, "%s%s", nlpid2str(p->protocols[i]), + sbuf_push(sbuf, 0, "%s%s", nlpid2str(p->protocols[i]), (i + 1 < p->count) ? ", " : ""); } - sbuf_push(buf, 0, "\n"); + sbuf_push(sbuf, 0, "\n"); } } @@ -5275,9 +5274,9 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap, /* Flex Algo Definitions */ for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { struct isis_router_cap_fad *fad; - size_t subtlv_len; struct admin_group *ag; uint32_t admin_group_length; + size_t j; fad = router_cap->fads[i]; if (!fad) @@ -5315,8 +5314,8 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap, if (admin_group_length) { stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_EXCAG); stream_putc(s, sizeof(uint32_t) * admin_group_length); - for (size_t i = 0; i < admin_group_length; i++) - stream_putl(s, admin_group_get_offset(ag, i)); + for (j = 0; j < admin_group_length; j++) + stream_putl(s, admin_group_get_offset(ag, j)); } ag = &fad->fad.admin_group_include_any; @@ -5324,8 +5323,8 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap, if (admin_group_length) { stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_INCANYAG); stream_putc(s, sizeof(uint32_t) * admin_group_length); - for (size_t i = 0; i < admin_group_length; i++) - stream_putl(s, admin_group_get_offset(ag, i)); + for (j = 0; j < admin_group_length; j++) + stream_putl(s, admin_group_get_offset(ag, j)); } ag = &fad->fad.admin_group_include_all; @@ -5333,8 +5332,8 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap, if (admin_group_length) { stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_INCALLAG); stream_putc(s, sizeof(uint32_t) * admin_group_length); - for (size_t i = 0; i < admin_group_length; i++) - stream_putl(s, admin_group_get_offset(ag, i)); + for (j = 0; j < admin_group_length; j++) + stream_putl(s, admin_group_get_offset(ag, j)); } if (fad->fad.flags != 0) { diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index c2670143f2..cb729501cc 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -45,7 +45,7 @@ #include "isisd/isis_sr.h" #include "isisd/isis_ldp_sync.h" -struct zclient *zclient; +struct zclient *isis_zclient; static struct zclient *zclient_sync; /* Router-id update message from zebra. */ @@ -254,7 +254,7 @@ void isis_zebra_route_add_route(struct isis *isis, struct prefix *prefix, struct zapi_route api; int count = 0; - if (zclient->sock < 0) + if (isis_zclient->sock < 0) return; /* Uninstall the route if it doesn't have any valid nexthop. */ @@ -295,7 +295,7 @@ void isis_zebra_route_add_route(struct isis *isis, struct prefix *prefix, return; api.nexthop_num = count; - zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); + zclient_route_send(ZEBRA_ROUTE_ADD, isis_zclient, &api); } void isis_zebra_route_del_route(struct isis *isis, @@ -305,7 +305,7 @@ void isis_zebra_route_del_route(struct isis *isis, { struct zapi_route api; - if (zclient->sock < 0) + if (isis_zclient->sock < 0) return; if (!CHECK_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED)) @@ -321,7 +321,7 @@ void isis_zebra_route_del_route(struct isis *isis, SET_FLAG(api.message, ZAPI_MESSAGE_SRCPFX); } - zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); + zclient_route_send(ZEBRA_ROUTE_DELETE, isis_zclient, &api); } /** @@ -388,7 +388,7 @@ void isis_zebra_prefix_sid_install(struct isis_area *area, } /* Send message to zebra. */ - (void)zebra_send_mpls_labels(zclient, ZEBRA_MPLS_LABELS_REPLACE, &zl); + (void)zebra_send_mpls_labels(isis_zclient, ZEBRA_MPLS_LABELS_REPLACE, &zl); } /** @@ -415,7 +415,7 @@ void isis_zebra_prefix_sid_uninstall(struct isis_area *area, zl.local_label = psid->label; /* Send message to zebra. */ - (void)zebra_send_mpls_labels(zclient, ZEBRA_MPLS_LABELS_DELETE, &zl); + (void)zebra_send_mpls_labels(isis_zclient, ZEBRA_MPLS_LABELS_DELETE, &zl); } /** @@ -471,7 +471,7 @@ void isis_zebra_send_adjacency_sid(int cmd, const struct sr_adjacency *sra) } } - (void)zebra_send_mpls_labels(zclient, cmd, &zl); + (void)zebra_send_mpls_labels(isis_zclient, cmd, &zl); } static int isis_zebra_read(ZAPI_CALLBACK_ARGS) @@ -523,9 +523,9 @@ void isis_zebra_redistribute_set(afi_t afi, int type, vrf_id_t vrf_id, { if (type == DEFAULT_ROUTE) zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD, - zclient, afi, vrf_id); + isis_zclient, afi, vrf_id); else - zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type, + zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, isis_zclient, afi, type, tableid, vrf_id); } @@ -534,9 +534,9 @@ void isis_zebra_redistribute_unset(afi_t afi, int type, vrf_id_t vrf_id, { if (type == DEFAULT_ROUTE) zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, - zclient, afi, vrf_id); + isis_zclient, afi, vrf_id); else - zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, afi, + zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, isis_zclient, afi, type, tableid, vrf_id); } @@ -549,7 +549,7 @@ int isis_zebra_rlfa_register(struct isis_spftree *spftree, struct rlfa *rlfa) struct zapi_rlfa_request zr = {}; int ret; - if (!zclient) + if (!isis_zclient) return 0; zr.igp.vrf_id = area->isis->vrf_id; @@ -565,7 +565,7 @@ int isis_zebra_rlfa_register(struct isis_spftree *spftree, struct rlfa *rlfa) zlog_debug("ISIS-LFA: registering RLFA %pFX@%pI4 with LDP", &rlfa->prefix, &rlfa->pq_address); - ret = zclient_send_opaque_unicast(zclient, LDP_RLFA_REGISTER, + ret = zclient_send_opaque_unicast(isis_zclient, LDP_RLFA_REGISTER, ZEBRA_ROUTE_LDP, 0, 0, (const uint8_t *)&zr, sizeof(zr)); if (ret == ZCLIENT_SEND_FAILURE) { @@ -585,8 +585,8 @@ void isis_zebra_rlfa_unregister_all(struct isis_spftree *spftree) struct zapi_rlfa_igp igp = {}; int ret; - if (!zclient || spftree->type != SPF_TYPE_FORWARD - || CHECK_FLAG(spftree->flags, F_SPFTREE_NO_ADJACENCIES)) + if (!isis_zclient || spftree->type != SPF_TYPE_FORWARD || + CHECK_FLAG(spftree->flags, F_SPFTREE_NO_ADJACENCIES)) return; if (IS_DEBUG_LFA) @@ -599,7 +599,7 @@ void isis_zebra_rlfa_unregister_all(struct isis_spftree *spftree) igp.isis.spf.level = spftree->level; igp.isis.spf.run_id = spftree->runcount; - ret = zclient_send_opaque_unicast(zclient, LDP_RLFA_UNREGISTER_ALL, + ret = zclient_send_opaque_unicast(isis_zclient, LDP_RLFA_UNREGISTER_ALL, ZEBRA_ROUTE_LDP, 0, 0, (const uint8_t *)&igp, sizeof(igp)); if (ret == ZCLIENT_SEND_FAILURE) @@ -774,27 +774,27 @@ int isis_zebra_label_manager_connect(void) void isis_zebra_vrf_register(struct isis *isis) { - if (!zclient || zclient->sock < 0 || !isis) + if (!isis_zclient || isis_zclient->sock < 0 || !isis) return; if (isis->vrf_id != VRF_UNKNOWN) { if (IS_DEBUG_EVENTS) zlog_debug("%s: Register VRF %s id %u", __func__, isis->name, isis->vrf_id); - zclient_send_reg_requests(zclient, isis->vrf_id); + zclient_send_reg_requests(isis_zclient, isis->vrf_id); } } void isis_zebra_vrf_deregister(struct isis *isis) { - if (!zclient || zclient->sock < 0 || !isis) + if (!isis_zclient || isis_zclient->sock < 0 || !isis) return; if (isis->vrf_id != VRF_UNKNOWN) { if (IS_DEBUG_EVENTS) zlog_debug("%s: Deregister VRF %s id %u", __func__, isis->name, isis->vrf_id); - zclient_send_dereg_requests(zclient, isis->vrf_id); + zclient_send_dereg_requests(isis_zclient, isis->vrf_id); } } @@ -820,9 +820,9 @@ int isis_zebra_ls_register(bool up) int rc; if (up) - rc = ls_register(zclient, true); + rc = ls_register(isis_zclient, true); else - rc = ls_unregister(zclient, true); + rc = ls_unregister(isis_zclient, true); return rc; } @@ -934,7 +934,7 @@ static void isis_zebra_send_localsid(int cmd, const struct in6_addr *sid, memcpy(&api.prefix, &p, sizeof(p)); if (cmd == ZEBRA_ROUTE_DELETE) - return (void)zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, + return (void)zclient_route_send(ZEBRA_ROUTE_DELETE, isis_zclient, &api); SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION); @@ -952,7 +952,7 @@ static void isis_zebra_send_localsid(int cmd, const struct in6_addr *sid, api.nexthop_num = 1; - zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); + zclient_route_send(ZEBRA_ROUTE_ADD, isis_zclient, &api); } /** @@ -1372,7 +1372,7 @@ static int isis_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS) */ int isis_zebra_srv6_manager_get_locator_chunk(const char *name) { - return srv6_manager_get_locator_chunk(zclient, name); + return srv6_manager_get_locator_chunk(isis_zclient, name); } @@ -1385,7 +1385,7 @@ int isis_zebra_srv6_manager_get_locator_chunk(const char *name) */ int isis_zebra_srv6_manager_release_locator_chunk(const char *name) { - return srv6_manager_release_locator_chunk(zclient, name); + return srv6_manager_release_locator_chunk(isis_zclient, name); } /** @@ -1403,7 +1403,7 @@ int isis_zebra_srv6_manager_get_locator(const char *name) * Send the Get Locator request to the SRv6 Manager and return the * result */ - return srv6_manager_get_locator(zclient, name); + return srv6_manager_get_locator(isis_zclient, name); } /** @@ -1434,7 +1434,7 @@ bool isis_zebra_request_srv6_sid(const struct srv6_sid_ctx *ctx, * Send the Get SRv6 SID request to the SRv6 Manager and check the * result */ - ret = srv6_manager_get_sid(zclient, ctx, sid_value, locator_name, NULL); + ret = srv6_manager_get_sid(isis_zclient, ctx, sid_value, locator_name, NULL); if (ret < 0) { zlog_warn("%s: error getting SRv6 SID!", __func__); return false; @@ -1462,7 +1462,7 @@ void isis_zebra_release_srv6_sid(const struct srv6_sid_ctx *ctx) * Send the Release SRv6 SID request to the SRv6 Manager and check the * result */ - ret = srv6_manager_release_sid(zclient, ctx); + ret = srv6_manager_release_sid(isis_zclient, ctx); if (ret < 0) { zlog_warn("%s: error releasing SRv6 SID!", __func__); return; @@ -1631,16 +1631,16 @@ static zclient_handler *const isis_handlers[] = { [ZEBRA_SRV6_SID_NOTIFY] = isis_zebra_srv6_sid_notify, }; -void isis_zebra_init(struct event_loop *master, int instance) +void isis_zebra_init(struct event_loop *mst, int instance) { /* Initialize asynchronous zclient. */ - zclient = zclient_new(master, &zclient_options_default, isis_handlers, + isis_zclient = zclient_new(mst, &zclient_options_default, isis_handlers, array_size(isis_handlers)); - zclient_init(zclient, PROTO_TYPE, 0, &isisd_privs); - zclient->zebra_connected = isis_zebra_connected; + zclient_init(isis_zclient, PROTO_TYPE, 0, &isisd_privs); + isis_zclient->zebra_connected = isis_zebra_connected; /* 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_ISIS; zclient_sync->instance = instance; @@ -1654,11 +1654,11 @@ void isis_zebra_init(struct event_loop *master, int instance) void isis_zebra_stop(void) { - zclient_unregister_opaque(zclient, LDP_RLFA_LABELS); - zclient_unregister_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE); - zclient_unregister_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE); + zclient_unregister_opaque(isis_zclient, LDP_RLFA_LABELS); + zclient_unregister_opaque(isis_zclient, LDP_IGP_SYNC_IF_STATE_UPDATE); + zclient_unregister_opaque(isis_zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE); zclient_stop(zclient_sync); zclient_free(zclient_sync); - zclient_stop(zclient); - zclient_free(zclient); + zclient_stop(isis_zclient); + zclient_free(isis_zclient); } diff --git a/isisd/isis_zebra.h b/isisd/isis_zebra.h index 79da16efac..83a71b7dc9 100644 --- a/isisd/isis_zebra.h +++ b/isisd/isis_zebra.h @@ -11,7 +11,7 @@ #include "isisd.h" -extern struct zclient *zclient; +extern struct zclient *isis_zclient; struct label_chunk { uint32_t start; diff --git a/isisd/isisd.c b/isisd/isisd.c index a0faf31221..2260ba664f 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -187,12 +187,12 @@ struct isis *isis_lookup_by_sysid(const uint8_t *sysid) return NULL; } -void isis_master_init(struct event_loop *master) +void isis_master_init(struct event_loop *mst) { memset(&isis_master, 0, sizeof(isis_master)); im = &isis_master; im->isis = list_new(); - im->master = master; + im->master = mst; } void isis_master_terminate(void) @@ -694,24 +694,24 @@ static void isis_set_redist_vrf_bitmaps(struct isis *isis, bool set) if (type == DEFAULT_ROUTE) { if (set) vrf_bitmap_set( - &zclient->default_information + &isis_zclient->default_information [afi], isis->vrf_id); else vrf_bitmap_unset( - &zclient->default_information + &isis_zclient->default_information [afi], isis->vrf_id); } else { if (set) vrf_bitmap_set( - &zclient->redist + &isis_zclient->redist [afi] [type], isis->vrf_id); else vrf_bitmap_unset( - &zclient->redist + &isis_zclient->redist [afi] [type], isis->vrf_id);