From 9a7d1e7427a1c7d24e270ad12cd3f45be49e9a51 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 28 Mar 2023 15:49:50 -0400 Subject: [PATCH] zebra: Use zebra_vrf_lookup_by_id when we can Let's make this as consistent as is possible. Signed-off-by: Donald Sharp --- zebra/dplane_fpm_nl.c | 4 ++-- zebra/redistribute.c | 2 +- zebra/router-id.c | 10 +++++----- zebra/zapi_msg.c | 6 +++--- zebra/zebra_evpn_mac.c | 2 +- zebra/zebra_mpls.c | 10 +++++----- zebra/zebra_mpls_vty.c | 12 ++++++------ zebra/zebra_pw.c | 12 ++++++------ zebra/zebra_rib.c | 10 +++++----- zebra/zebra_rnh.c | 2 +- zebra/zebra_vty.c | 6 +++--- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c index b3bf1197be..be2f55120c 100644 --- a/zebra/dplane_fpm_nl.c +++ b/zebra/dplane_fpm_nl.c @@ -1023,7 +1023,7 @@ static int fpm_lsp_send_cb(struct hash_bucket *bucket, void *arg) static void fpm_lsp_send(struct event *t) { struct fpm_nl_ctx *fnc = EVENT_ARG(t); - struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT); + struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); struct fpm_lsp_arg fla; fla.fnc = fnc; @@ -1263,7 +1263,7 @@ static void fpm_lsp_reset_cb(struct hash_bucket *bucket, void *arg) static void fpm_lsp_reset(struct event *t) { struct fpm_nl_ctx *fnc = EVENT_ARG(t); - struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT); + struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); hash_iterate(zvrf->lsp_table, fpm_lsp_reset_cb, NULL); diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 8cdc419cce..d2fa85eb64 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -145,7 +145,7 @@ static bool zebra_redistribute_check(const struct route_node *rn, return false; afi = family2afi(rn->p.family); - zvrf = vrf_info_lookup(re->vrf_id); + zvrf = zebra_vrf_lookup_by_id(re->vrf_id); if (re->vrf_id == VRF_DEFAULT && zvrf->table_id != re->table) return false; diff --git a/zebra/router-id.c b/zebra/router-id.c index e8cb33c35c..ef87d924fe 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -284,7 +284,7 @@ DEFUN (ip_router_id, argv_find(argv, argc, "NAME", &idx); VRF_GET_ID(vrf_id, argv[idx]->arg, false); - zvrf = vrf_info_lookup(vrf_id); + zvrf = zebra_vrf_lookup_by_id(vrf_id); router_id_set(AFI_IP, &rid, zvrf); return CMD_SUCCESS; @@ -321,7 +321,7 @@ DEFUN (ipv6_router_id, argv_find(argv, argc, "NAME", &idx); VRF_GET_ID(vrf_id, argv[idx]->arg, false); - zvrf = vrf_info_lookup(vrf_id); + zvrf = zebra_vrf_lookup_by_id(vrf_id); router_id_set(AFI_IP6, &rid, zvrf); return CMD_SUCCESS; @@ -403,7 +403,7 @@ DEFUN (no_ip_router_id, if (argv_find(argv, argc, "NAME", &idx)) VRF_GET_ID(vrf_id, argv[idx]->arg, false); - zvrf = vrf_info_lookup(vrf_id); + zvrf = zebra_vrf_lookup_by_id(vrf_id); router_id_set(AFI_IP, &rid, zvrf); return CMD_SUCCESS; @@ -437,7 +437,7 @@ DEFUN (no_ipv6_router_id, if (argv_find(argv, argc, "NAME", &idx)) VRF_GET_ID(vrf_id, argv[idx]->arg, false); - zvrf = vrf_info_lookup(vrf_id); + zvrf = zebra_vrf_lookup_by_id(vrf_id); router_id_set(AFI_IP6, &rid, zvrf); return CMD_SUCCESS; @@ -514,7 +514,7 @@ DEFUN (show_ip_router_id, vrf_name = argv[idx]->arg; } - zvrf = vrf_info_lookup(vrf_id); + zvrf = zebra_vrf_lookup_by_id(vrf_id); if (zvrf != NULL) { if (is_ipv6) { diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 1ff188c76d..4c6c336d41 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1330,7 +1330,7 @@ static void zread_fec_register(ZAPI_HANDLER_ARGS) uint32_t label_index = MPLS_INVALID_LABEL_INDEX; s = msg; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return; @@ -1393,7 +1393,7 @@ static void zread_fec_unregister(ZAPI_HANDLER_ARGS) uint16_t flags; s = msg; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return; @@ -2337,7 +2337,7 @@ void zsend_capabilities_all_clients(void) struct zebra_vrf *zvrf; struct zserv *client; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { /* Do not send unsolicited messages to synchronous clients. */ if (client->synchronous) diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index c7252e48bc..ccc1b61e06 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -389,7 +389,7 @@ static void zebra_evpn_dad_mac_auto_recovery_exp(struct event *t) mac = EVENT_ARG(t); /* since this is asynchronous we need sanity checks*/ - zvrf = vrf_info_lookup(mac->zevpn->vrf_id); + zvrf = zebra_vrf_lookup_by_id(mac->zevpn->vrf_id); if (!zvrf) return; diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 3fbf201086..f1a99d89ce 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -887,7 +887,7 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data) struct zebra_lsp *lsp; struct zebra_nhlfe *oldbest, *newbest; char buf[BUFSIZ], buf2[BUFSIZ]; - struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT); + struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); enum zebra_dplane_result res; lsp = (struct zebra_lsp *)data; @@ -1028,7 +1028,7 @@ static void lsp_processq_del(struct work_queue *wq, void *data) if (zebra_router_in_shutdown()) return; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); assert(zvrf); lsp_table = zvrf->lsp_table; @@ -1776,7 +1776,7 @@ void zebra_mpls_lsp_dplane_result(struct zebra_dplane_ctx *ctx) case DPLANE_OP_LSP_INSTALL: case DPLANE_OP_LSP_UPDATE: /* Look for zebra LSP object */ - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (zvrf == NULL) break; @@ -2092,7 +2092,7 @@ void zebra_mpls_process_dplane_notify(struct zebra_dplane_ctx *ctx) dplane_ctx_get_in_label(ctx)); /* Look for zebra LSP object */ - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (zvrf == NULL) return; @@ -2467,7 +2467,7 @@ int zebra_mpls_fec_unregister(struct zebra_vrf *zvrf, struct prefix *p, */ static int zebra_mpls_cleanup_fecs_for_client(struct zserv *client) { - struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT); + struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); struct route_node *rn; struct zebra_fec *fec; struct listnode *node; diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c index 7e3cdd738e..6b8859e0ca 100644 --- a/zebra/zebra_mpls_vty.c +++ b/zebra/zebra_mpls_vty.c @@ -41,7 +41,7 @@ static int zebra_mpls_transit_lsp(struct vty *vty, int add_cmd, return CMD_WARNING_CONFIG_FAILED; } - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) { vty_out(vty, "%% Default VRF does not exist\n"); return CMD_WARNING_CONFIG_FAILED; @@ -185,7 +185,7 @@ static int zebra_mpls_bind(struct vty *vty, int add_cmd, const char *prefix, uint32_t label; int ret; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) { vty_out(vty, "%% Default VRF does not exist\n"); return CMD_WARNING_CONFIG_FAILED; @@ -273,7 +273,7 @@ static int zebra_mpls_config(struct vty *vty) int write = 0; struct zebra_vrf *zvrf; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return 0; @@ -296,7 +296,7 @@ DEFUN (show_mpls_fec, struct prefix p; int ret; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return 0; @@ -326,7 +326,7 @@ DEFUN (show_mpls_table, struct zebra_vrf *zvrf; bool uj = use_json(argc, argv); - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); zebra_mpls_print_lsp_table(vty, zvrf, uj); return CMD_SUCCESS; } @@ -344,7 +344,7 @@ DEFUN (show_mpls_table_lsp, struct zebra_vrf *zvrf; bool uj = use_json(argc, argv); - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); label = atoi(argv[3]->arg); zebra_mpls_print_lsp(vty, zvrf, label, uj); return CMD_SUCCESS; diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c index a02d7e8807..12dcac1de5 100644 --- a/zebra/zebra_pw.c +++ b/zebra/zebra_pw.c @@ -407,7 +407,7 @@ DEFUN_NOSH (pseudowire_if, const char *ifname; int idx = 0; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return CMD_WARNING; @@ -439,7 +439,7 @@ DEFUN (no_pseudowire_if, const char *ifname; int idx = 0; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return CMD_WARNING; @@ -563,7 +563,7 @@ DEFUN (show_pseudowires, struct zebra_vrf *zvrf; struct zebra_pw *pw; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return 0; @@ -602,7 +602,7 @@ static void vty_show_mpls_pseudowire_detail(struct vty *vty) struct nexthop *nexthop; struct nexthop_group *nhg; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return; @@ -758,7 +758,7 @@ static void vty_show_mpls_pseudowire_detail_json(struct vty *vty) struct zebra_vrf *zvrf; struct zebra_pw *pw; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return; @@ -794,7 +794,7 @@ static int zebra_pw_config(struct vty *vty) struct zebra_vrf *zvrf; struct zebra_pw *pw; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return 0; diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 5a86b7d0a5..7a9d0c0ed6 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -632,7 +632,7 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re, { struct nexthop *nexthop; struct rib_table_info *info = srcdest_rnode_table_info(rn); - struct zebra_vrf *zvrf = vrf_info_lookup(re->vrf_id); + struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(re->vrf_id); const struct prefix *p, *src_p; enum zebra_dplane_result ret; @@ -715,7 +715,7 @@ void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re) { struct nexthop *nexthop; struct rib_table_info *info = srcdest_rnode_table_info(rn); - struct zebra_vrf *zvrf = vrf_info_lookup(re->vrf_id); + struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(re->vrf_id); if (info->safi != SAFI_UNICAST) { UNSET_FLAG(re->status, ROUTE_ENTRY_INSTALLED); @@ -1410,7 +1410,7 @@ static void rib_process(struct route_node *rn) static void zebra_rib_evaluate_mpls(struct route_node *rn) { rib_dest_t *dest = rib_dest_from_rnode(rn); - struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT); + struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!dest) return; @@ -1898,7 +1898,7 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx) struct rib_table_info *info; bool rt_delete = false; - zvrf = vrf_info_lookup(dplane_ctx_get_vrf(ctx)); + zvrf = zebra_vrf_lookup_by_id(dplane_ctx_get_vrf(ctx)); vrf = vrf_lookup_by_id(dplane_ctx_get_vrf(ctx)); /* Locate rn and re(s) from ctx */ @@ -2566,7 +2566,7 @@ static void process_subq_early_label(struct listnode *lnode) if (!w) return; - zvrf = vrf_info_lookup(w->vrf_id); + zvrf = zebra_vrf_lookup_by_id(w->vrf_id); if (!zvrf) { XFREE(MTYPE_WQ_WRAPPER, w); return; diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index abb10e21cc..3bbcd38d1c 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -326,7 +326,7 @@ void zebra_register_rnh_pseudowire(vrf_id_t vrf_id, struct zebra_pw *pw, *nht_exists = false; - zvrf = vrf_info_lookup(vrf_id); + zvrf = zebra_vrf_lookup_by_id(vrf_id); if (!zvrf) return; diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 56e7226424..d100dc0e69 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -566,7 +566,7 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn, if (re->mtu) vty_out(vty, ", mtu %u", re->mtu); if (re->vrf_id != VRF_DEFAULT) { - zvrf = vrf_info_lookup(re->vrf_id); + zvrf = zebra_vrf_lookup_by_id(re->vrf_id); vty_out(vty, ", vrf %s", zvrf_name(zvrf)); } if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED)) @@ -2706,7 +2706,7 @@ DEFUN (default_vrf_vni_mapping, struct zebra_vrf *zvrf = NULL; int filter = 0; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return CMD_WARNING; @@ -2745,7 +2745,7 @@ DEFUN (no_default_vrf_vni_mapping, vni_t vni = strtoul(argv[2]->arg, NULL, 10); struct zebra_vrf *zvrf = NULL; - zvrf = vrf_info_lookup(VRF_DEFAULT); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return CMD_WARNING;