summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2022-05-17 12:13:50 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2022-10-24 14:56:42 +0200
commitfcb8ca9a88b6da8bea71c9ecf606e3623d24e81a (patch)
treeff58a529de8d145d2e06620635a3af4f6de8aacd
parenta90d4c45db8ec7d1353c805443f79727cba76110 (diff)
isisd: fix SPF scheduling on IPv6 only topology
If ISIS is running on an IPv6 only topology, the command "spf interval" has no effect. Only the IPv4 SPF tree timers are taken into account. Base the next SPF scheduling on the last running SPF tree. Fixes: be985ba059 ("isisd: make use of advanced concepts like arrays and loops") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
-rw-r--r--isisd/isis_spf.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index fa29fbd854..0d1a5db0d6 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -1931,9 +1931,19 @@ void isis_spf_timer_free(void *run)
int _isis_spf_schedule(struct isis_area *area, int level,
const char *func, const char *file, int line)
{
- struct isis_spftree *spftree = area->spftree[SPFTREE_IPV4][level - 1];
- time_t now = monotime(NULL);
- int diff = now - spftree->last_run_monotime;
+ struct isis_spftree *spftree;
+ time_t now;
+ long tree_diff, diff;
+ int tree;
+
+ now = monotime(NULL);
+ diff = 0;
+ for (tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) {
+ spftree = area->spftree[tree][level - 1];
+ tree_diff = difftime(now - spftree->last_run_monotime, 0);
+ if (tree_diff != now && (diff == 0 || tree_diff < diff))
+ diff = tree_diff;
+ }
if (CHECK_FLAG(im->options, F_ISIS_UNIT_TEST))
return 0;
@@ -1943,7 +1953,7 @@ int _isis_spf_schedule(struct isis_area *area, int level,
if (IS_DEBUG_SPF_EVENTS) {
zlog_debug(
- "ISIS-SPF (%s) L%d SPF schedule called, lastrun %d sec ago Caller: %s %s:%d",
+ "ISIS-SPF (%s) L%d SPF schedule called, lastrun %ld sec ago Caller: %s %s:%d",
area->area_tag, level, diff, func, file, line);
}