]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/isis_spf.c
Merge pull request #10447 from ton31337/fix/json_with_whitespaces
[mirror_frr.git] / isisd / isis_spf.c
index 3e8ec8817e7e873dd6dd3d472959ab4ab7914c5c..d5b02f388152791eb67980294334467333379b30 100644 (file)
@@ -1070,8 +1070,8 @@ end:
         */
        if ((lsp->hdr.lsp_bits & LSPBIT_ATT) == LSPBIT_ATT
            && !spftree->area->attached_bit_rcv_ignore
-           && spftree->area->is_type == IS_LEVEL_1
-           && !isis_area_count(spftree->area->isis, IS_LEVEL_2)) {
+           && (spftree->area->is_type & IS_LEVEL_1)
+           && !isis_level2_adj_up(spftree->area)) {
                struct prefix_pair ip_info = { {0} };
                if (IS_DEBUG_RTE_EVENTS)
                        zlog_debug("ISIS-Spf (%s): add default %s route",
@@ -1832,7 +1832,7 @@ void isis_spf_invalidate_routes(struct isis_spftree *tree)
        tree->route_table_backup->cleanup = isis_route_node_cleanup;
 }
 
-static int isis_run_spf_cb(struct thread *thread)
+static void isis_run_spf_cb(struct thread *thread)
 {
        struct isis_spf_run *run = THREAD_ARG(thread);
        struct isis_area *area = run->area;
@@ -1840,13 +1840,12 @@ static int isis_run_spf_cb(struct thread *thread)
        int have_run = 0;
 
        XFREE(MTYPE_ISIS_SPF_RUN, run);
-       area->spf_timer[level - 1] = NULL;
 
        if (!(area->is_type & level)) {
                if (IS_DEBUG_SPF_EVENTS)
                        zlog_warn("ISIS-SPF (%s) area does not share level",
                                  area->area_tag);
-               return ISIS_WARNING;
+               return;
        }
 
        isis_area_delete_backup_adj_sids(area, level);
@@ -1884,8 +1883,6 @@ static int isis_run_spf_cb(struct thread *thread)
                UNSET_FLAG(circuit->flags, ISIS_CIRCUIT_FLAPPED_AFTER_SPF);
 
        fabricd_run_spf(area);
-
-       return 0;
 }
 
 static struct isis_spf_run *isis_run_spf_arg(struct isis_area *area, int level)
@@ -2686,3 +2683,15 @@ void isis_spf_print(struct isis_spftree *spftree, struct vty *vty)
 
        vty_out(vty, "      run count         : %u\n", spftree->runcount);
 }
+void isis_spf_print_json(struct isis_spftree *spftree, struct json_object *json)
+{
+       char uptime[MONOTIME_STRLEN];
+       time_t cur;
+       cur = time(NULL);
+       cur -= spftree->last_run_timestamp;
+       frrtime_to_interval(cur, uptime, sizeof(uptime));
+       json_object_string_add(json, "last-run-elapsed", uptime);
+       json_object_int_add(json, "last-run-duration-usec",
+                           spftree->last_run_duration);
+       json_object_int_add(json, "last-run-count", spftree->runcount);
+}