diff options
| author | Louis Scalbert <louis.scalbert@6wind.com> | 2022-05-17 12:13:50 +0200 | 
|---|---|---|
| committer | Louis Scalbert <louis.scalbert@6wind.com> | 2022-05-24 10:06:05 +0200 | 
| commit | d95cd33545006004424736d20a0226b5cd9fb47a (patch) | |
| tree | a255e70b6a61ecfa1512685e5fbca8050d486c91 /isisd | |
| parent | e45958e9cfccd6dfc108a7ef5cb73775e8ef2e68 (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>
Diffstat (limited to 'isisd')
| -rw-r--r-- | isisd/isis_spf.c | 18 | 
1 files changed, 14 insertions, 4 deletions
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index d82925536e..ce7bd172ab 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -1940,9 +1940,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; @@ -1952,7 +1962,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);  	}  | 
