diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2017-04-21 15:41:14 -0300 | 
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2017-04-26 10:36:33 -0300 | 
| commit | 095f12f92b198669af5bfe53be9a04a6a28de6f9 (patch) | |
| tree | 532040bcfe3ba54a563e618a96341dcc5359c5fd /ldpd/lde_lib.c | |
| parent | 90989cb30668f46124946a7770b2d148c745b165 (diff) | |
ldpd: be more conservative with labels
On unstable networks, routes can be lost and relearned very often. If
we deallocate the input label every time a route is lost and allocate
a new one when the route is relearned, a lot of changes are made in vain.
This patch introduces a logic in which labels are preserved for at least
five minutes before being deallocated by the LIB garbage collector. This
is consistent with what other implementations do.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd/lde_lib.c')
| -rw-r--r-- | ldpd/lde_lib.c | 19 | 
1 files changed, 11 insertions, 8 deletions
diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c index db2682a173..b074bf3498 100644 --- a/ldpd/lde_lib.c +++ b/ldpd/lde_lib.c @@ -383,20 +383,23 @@ lde_kernel_update(struct fec *fec)  	if (LIST_EMPTY(&fn->nexthops)) {  		RB_FOREACH(ln, nbr_tree, &lde_nbrs)  			lde_send_labelwithdraw(ln, fn, NULL, NULL); -		fn->local_label = NO_LABEL;  		fn->data = NULL; -	} else { -		uint32_t	 previous_label; -		previous_label = fn->local_label; +		/* +		 * Do not deallocate the local label now, do that only in the +		 * LIB garbage collector. This will prevent ldpd from changing +		 * the input label of some prefixes too often when running on +		 * an unstable network. Also, restart the garbage collector +		 * timer so that labels are deallocated only when the network +		 * is stabilized. +		 */ +		lde_gc_start_timer(); +	} else {  		fn->local_label = lde_update_label(fn); - -		if (fn->local_label != NO_LABEL && -		    fn->local_label != previous_label) { +		if (fn->local_label != NO_LABEL && RB_EMPTY(&fn->upstream))  			/* FEC.1: perform lsr label distribution procedure */  			RB_FOREACH(ln, nbr_tree, &lde_nbrs)  				lde_send_labelmapping(ln, fn, 1); -		}  	}  	LIST_FOREACH(fnh, &fn->nexthops, entry) {  | 
