#include "isis_route.h"
#include "isis_csm.h"
-int isis_run_spf_l1 (struct thread *thread);
-int isis_run_spf_l2 (struct thread *thread);
-
/* 7.2.7 */
static void
remove_excess_adjs (struct list *adjs)
tree->last_run_timestamp = 0;
tree->last_run_duration = 0;
tree->runcount = 0;
- tree->pending = 0;
return tree;
}
void
isis_spftree_del (struct isis_spftree *spftree)
{
- THREAD_TIMER_OFF (spftree->t_spf);
spftree->tents->del = (void (*)(void *)) isis_vertex_del;
list_delete (spftree->tents);
out:
isis_route_validate (area);
- spftree->pending = 0;
spftree->runcount++;
spftree->last_run_timestamp = time (NULL);
monotime(&time_now);
end_time = (end_time * 1000000) + time_now.tv_usec;
spftree->last_run_duration = end_time - start_time;
-
return retval;
}
-int
+static int
isis_run_spf_l1 (struct thread *thread)
{
struct isis_area *area;
area = THREAD_ARG (thread);
assert (area);
- area->spftree[0]->t_spf = NULL;
- area->spftree[0]->pending = 0;
+ area->spf_timer[0] = NULL;
if (!(area->is_type & IS_LEVEL_1))
{
if (area->ip_circuits)
retval = isis_run_spf (area, 1, AF_INET, isis->sysid);
+ if (area->ipv6_circuits)
+ retval = isis_run_spf (area, 1, AF_INET6, isis->sysid);
return retval;
}
-int
+static int
isis_run_spf_l2 (struct thread *thread)
{
struct isis_area *area;
area = THREAD_ARG (thread);
assert (area);
- area->spftree[1]->t_spf = NULL;
- area->spftree[1]->pending = 0;
+ area->spf_timer[1] = NULL;
if (!(area->is_type & IS_LEVEL_2))
{
if (area->ip_circuits)
retval = isis_run_spf (area, 2, AF_INET, isis->sysid);
+ if (area->ipv6_circuits)
+ retval = isis_run_spf (area, 2, AF_INET6, isis->sysid);
return retval;
}
zlog_debug ("ISIS-Spf (%s) L%d SPF schedule called, lastrun %d sec ago",
area->area_tag, level, diff);
- if (spftree->pending)
+ if (area->spf_timer[level -1])
return ISIS_OK;
- THREAD_TIMER_OFF (spftree->t_spf);
-
/* wait configured min_spf_interval before doing the SPF */
if (diff >= area->min_spf_interval[level-1])
- return isis_run_spf (area, level, AF_INET, isis->sysid);
-
- if (level == 1)
- THREAD_TIMER_ON (master, spftree->t_spf, isis_run_spf_l1, area,
- area->min_spf_interval[0] - diff);
- else
- THREAD_TIMER_ON (master, spftree->t_spf, isis_run_spf_l2, area,
- area->min_spf_interval[1] - diff);
-
- if (isis->debugs & DEBUG_SPF_EVENTS)
- zlog_debug ("ISIS-Spf (%s) L%d SPF scheduled %d sec from now",
- area->area_tag, level, area->min_spf_interval[level-1] - diff);
-
- spftree->pending = 1;
-
- return ISIS_OK;
-}
-
-static int
-isis_run_spf6_l1 (struct thread *thread)
-{
- struct isis_area *area;
- int retval = ISIS_OK;
-
- area = THREAD_ARG (thread);
- assert (area);
-
- area->spftree6[0]->t_spf = NULL;
- area->spftree6[0]->pending = 0;
-
- if (!(area->is_type & IS_LEVEL_1))
{
- if (isis->debugs & DEBUG_SPF_EVENTS)
- zlog_warn ("ISIS-SPF (%s) area does not share level", area->area_tag);
- return ISIS_WARNING;
- }
-
- if (isis->debugs & DEBUG_SPF_EVENTS)
- zlog_debug ("ISIS-Spf (%s) L1 SPF needed, periodic SPF", area->area_tag);
-
- if (area->ipv6_circuits)
- retval = isis_run_spf (area, 1, AF_INET6, isis->sysid);
+ int retval = ISIS_OK;
- return retval;
-}
-
-static int
-isis_run_spf6_l2 (struct thread *thread)
-{
- struct isis_area *area;
- int retval = ISIS_OK;
-
- area = THREAD_ARG (thread);
- assert (area);
-
- area->spftree6[1]->t_spf = NULL;
- area->spftree6[1]->pending = 0;
+ if (area->ip_circuits)
+ retval = isis_run_spf (area, level, AF_INET, isis->sysid);
+ if (area->ipv6_circuits)
+ retval = isis_run_spf (area, level, AF_INET6, isis->sysid);
- if (!(area->is_type & IS_LEVEL_2))
- {
- if (isis->debugs & DEBUG_SPF_EVENTS)
- zlog_warn ("ISIS-SPF (%s) area does not share level", area->area_tag);
- return ISIS_WARNING;
+ return retval;
}
- if (isis->debugs & DEBUG_SPF_EVENTS)
- zlog_debug ("ISIS-Spf (%s) L2 SPF needed, periodic SPF.", area->area_tag);
-
- if (area->ipv6_circuits)
- retval = isis_run_spf (area, 2, AF_INET6, isis->sysid);
-
- return retval;
-}
-
-int
-isis_spf_schedule6 (struct isis_area *area, int level)
-{
- int retval = ISIS_OK;
- struct isis_spftree *spftree = area->spftree6[level - 1];
- time_t now = time (NULL);
- time_t diff = now - spftree->last_run_timestamp;
-
- assert (diff >= 0);
- assert (area->is_type & level);
-
- if (isis->debugs & DEBUG_SPF_EVENTS)
- zlog_debug ("ISIS-Spf (%s) L%d SPF schedule called, lastrun %lld sec ago",
- area->area_tag, level, (long long)diff);
-
- if (spftree->pending)
- return ISIS_OK;
-
- THREAD_TIMER_OFF (spftree->t_spf);
-
- /* wait configured min_spf_interval before doing the SPF */
- if (diff >= area->min_spf_interval[level-1])
- return isis_run_spf (area, level, AF_INET6, isis->sysid);
-
if (level == 1)
- THREAD_TIMER_ON (master, spftree->t_spf, isis_run_spf6_l1, area,
+ THREAD_TIMER_ON (master, area->spf_timer[0], isis_run_spf_l1, area,
area->min_spf_interval[0] - diff);
else
- THREAD_TIMER_ON (master, spftree->t_spf, isis_run_spf6_l2, area,
+ THREAD_TIMER_ON (master, area->spf_timer[1], isis_run_spf_l2, area,
area->min_spf_interval[1] - diff);
if (isis->debugs & DEBUG_SPF_EVENTS)
- zlog_debug ("ISIS-Spf (%s) L%d SPF scheduled %lld sec from now",
- area->area_tag, level,
- (long long)(area->min_spf_interval[level-1] - diff));
-
- spftree->pending = 1;
+ zlog_debug ("ISIS-Spf (%s) L%d SPF scheduled %d sec from now",
+ area->area_tag, level, area->min_spf_interval[level-1] - diff);
- return retval;
+ return ISIS_OK;
}
static void
spftree_area_del (area);
+ THREAD_TIMER_OFF(area->spf_timer[0]);
+ THREAD_TIMER_OFF(area->spf_timer[1]);
+
/* invalidate and validate would delete all routes from zebra */
isis_route_invalidate (area);
isis_route_validate (area);
vty_out (vty, " Level-%d:%s", level, VTY_NEWLINE);
spftree = area->spftree[level - 1];
- if (spftree->pending)
- vty_out (vty, " IPv4 SPF: (pending)%s", VTY_NEWLINE);
+ if (area->spf_timer[level - 1])
+ vty_out (vty, " SPF: (pending)%s", VTY_NEWLINE);
else
- vty_out (vty, " IPv4 SPF:%s", VTY_NEWLINE);
+ vty_out (vty, " SPF:%s", VTY_NEWLINE);
- vty_out (vty, " minimum interval : %d%s",
- area->min_spf_interval[level - 1], VTY_NEWLINE);
+ vty_out (vty, " minimum interval : %d",
+ area->min_spf_interval[level - 1]);
+ vty_out (vty, VTY_NEWLINE);
+ vty_out (vty, " IPv4 route computation:%s", VTY_NEWLINE);
vty_out (vty, " last run elapsed : ");
vty_out_timestr(vty, spftree->last_run_timestamp);
vty_out (vty, "%s", VTY_NEWLINE);
spftree->runcount, VTY_NEWLINE);
spftree = area->spftree6[level - 1];
- if (spftree->pending)
- vty_out (vty, " IPv6 SPF: (pending)%s", VTY_NEWLINE);
- else
- vty_out (vty, " IPv6 SPF:%s", VTY_NEWLINE);
-
- vty_out (vty, " minimum interval : %d%s",
- area->min_spf_interval[level - 1], VTY_NEWLINE);
+ vty_out (vty, " IPv6 route computation:%s", VTY_NEWLINE);
vty_out (vty, " last run elapsed : ");
vty_out_timestr(vty, spftree->last_run_timestamp);
isis_spftree_del (area->spftree6[level - 1]);
area->spftree6[level - 1] = NULL;
}
+ THREAD_TIMER_OFF(area->spf_timer[level - 1]);
if (area->route_table[level - 1])
{
route_table_finish (area->route_table[level - 1]);