diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2021-11-24 15:01:41 +0300 | 
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-12-03 18:30:24 +0300 | 
| commit | 074f76812bb1961a5d8a4e7b01d7f70f5da1978b (patch) | |
| tree | d6f26f0b9cf72add9be23cc16ae278cd41d43cd3 /bfdd/bfd_packet.c | |
| parent | 6e5532187f9e11d10f364fdac9f8e4efb16ff9be (diff) | |
bfdd: fix detection timeout update
Per RFC 5880 section 6.8.12, the use of a Poll Sequence is not necessary
when the Detect Multiplier is changed. Currently, we update the Detection
Timeout only when a Poll Sequence is terminated, therefore we ignore the
Detect Multiplier change if it's not accompanied with RX/TX timer change.
To fix the problem, we should update the Detection Timeout on every
received packet.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'bfdd/bfd_packet.c')
| -rw-r--r-- | bfdd/bfd_packet.c | 21 | 
1 files changed, 18 insertions, 3 deletions
diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c index 5b1329fa37..652b914118 100644 --- a/bfdd/bfd_packet.c +++ b/bfdd/bfd_packet.c @@ -697,11 +697,26 @@ int bfd_recv_cb(struct thread *t)  		/* Handle poll finalization. */  		bs_final_handler(bfd); -	} else { -		/* Received a packet, lets update the receive timer. */ -		bfd_recvtimer_update(bfd);  	} +	/* +	 * Detection timeout calculation: +	 * The minimum detection timeout is the remote detection +	 * multipler (number of packets to be missed) times the agreed +	 * transmission interval. +	 * +	 * RFC 5880, Section 6.8.4. +	 */ +	if (bfd->cur_timers.required_min_rx > bfd->remote_timers.desired_min_tx) +		bfd->detect_TO = bfd->remote_detect_mult +				 * bfd->cur_timers.required_min_rx; +	else +		bfd->detect_TO = bfd->remote_detect_mult +				 * bfd->remote_timers.desired_min_tx; + +	/* Apply new receive timer immediately. */ +	bfd_recvtimer_update(bfd); +  	/* Handle echo timers changes. */  	bs_echo_timer_handler(bfd);  | 
