Skip to content

Commit

Permalink
Merge pull request #10188 from FRRouting/mergify/bp/stable/8.0/pr-10120
Browse files Browse the repository at this point in the history
bfdd: fix detection timeout update (backport #10120)
  • Loading branch information
ton31337 committed Dec 9, 2021
2 parents 085e51c + b32a369 commit 11cf1b9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
21 changes: 0 additions & 21 deletions bfdd/bfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1256,27 +1256,6 @@ void bs_final_handler(struct bfd_session *bs)
/* Apply new transmission timer immediately. */
ptm_bfd_start_xmt_timer(bs, false);

/*
* 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.
*
* TODO: support sending/counting more packets inside detection
* timeout.
*/
if (bs->timers.required_min_rx > bs->remote_timers.desired_min_tx)
bs->detect_TO = bs->remote_detect_mult
* bs->timers.required_min_rx;
else
bs->detect_TO = bs->remote_detect_mult
* bs->remote_timers.desired_min_tx;

/* Apply new receive timer immediately. */
bfd_recvtimer_update(bs);

/* Notify watchers about changed timers. */
control_notify_config(BCM_NOTIFY_CONFIG_UPDATE, bs);
}
Expand Down
21 changes: 18 additions & 3 deletions bfdd/bfd_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,11 +693,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);

Expand Down

0 comments on commit 11cf1b9

Please sign in to comment.