]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Use zebra_vrf_lookup_by_id when we can 13132/head
authorDonald Sharp <sharpd@nvidia.com>
Tue, 28 Mar 2023 19:49:50 +0000 (15:49 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Tue, 28 Mar 2023 19:49:50 +0000 (15:49 -0400)
Let's make this as consistent as is possible.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/dplane_fpm_nl.c
zebra/redistribute.c
zebra/router-id.c
zebra/zapi_msg.c
zebra/zebra_evpn_mac.c
zebra/zebra_mpls.c
zebra/zebra_mpls_vty.c
zebra/zebra_pw.c
zebra/zebra_rib.c
zebra/zebra_rnh.c
zebra/zebra_vty.c

index b3bf1197be68eca031190abb6208cc9a2d5945ee..be2f55120ce31dc63bc60ebe8aba002076b811e0 100644 (file)
@@ -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);
 
index 8cdc419cce4a8b4d5953f464791f5203c7306b08..d2fa85eb6446ad491ae0323f588ca17c56090b5a 100644 (file)
@@ -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;
 
index e8cb33c35c03fc4e0402d3bab8f9e88ce259424a..ef87d924fe54eb58ae7f971516ff77f1a65630f2 100644 (file)
@@ -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) {
index 1ff188c76d5d968947982c0bad984e63610247f1..4c6c336d417e11b44f324499f19923b3e4929584 100644 (file)
@@ -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)
index c7252e48bca31dacab8b08908025937574a1e2c7..ccc1b61e066c283a6265b22a59bbc3b8ffb1fa0b 100644 (file)
@@ -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;
 
index 3fbf201086d11f0048707618b5304a76cea697fb..f1a99d89ce9cbcbb3945f5f298a4f859a146673a 100644 (file)
@@ -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;
index 7e3cdd738e0a23199ebdb43d20cf7d5352f633a1..6b8859e0cae348bdf31e46b733e71a4d8251570b 100644 (file)
@@ -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;
index a02d7e8807365f6f66c609f5c8b094bee1e83862..12dcac1de5f54bb4b1e109b65b388be3c9db5a08 100644 (file)
@@ -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;
 
index 5a86b7d0a55127e7d60b81d9f7e135d03b0ad25d..7a9d0c0ed6219749f242ff3966d023fb8fc4937f 100644 (file)
@@ -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;
index abb10e21cc5bef9cb81b7e57639723ce52ee535f..3bbcd38d1cfe9479293c92bfbc6f3b5b206e67df 100644 (file)
@@ -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;
 
index 56e7226424eb0761e1381e57465fceb54f78f9a8..d100dc0e69623231e6aad105d4fbffac1c282ca8 100644 (file)
@@ -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;