summaryrefslogtreecommitdiffstats
path: root/bfdd/bfd.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-03-10 15:31:57 +0100
committerIgor Ryzhov <iryzhov@nfware.com>2021-03-16 20:14:57 +0100
commit4df3e31c3d09f83340e7c1a0d7645d0bdddcb68f (patch)
tree01b36a351e9a10d91d25d5dd802bb7f09a69108c /bfdd/bfd.c
parentMerge pull request #8260 from volta-networks/fix_isis_snmp_test (diff)
downloadfrr-4df3e31c3d09f83340e7c1a0d7645d0bdddcb68f.tar.xz
frr-4df3e31c3d09f83340e7c1a0d7645d0bdddcb68f.zip
bfdd: separate echo rx/tx timers
Currently there is a single interval for both RX and TX echo functions. This commit introduces separate RX and TX timers for echo packets. The main advantage is to be able to set the receive interval to zero when we don't want to receive echo packets from the remote system. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'bfdd/bfd.c')
-rw-r--r--bfdd/bfd.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c
index 3cbb3691e..aa30ca8ad 100644
--- a/bfdd/bfd.c
+++ b/bfdd/bfd.c
@@ -90,7 +90,8 @@ static void bfd_profile_set_default(struct bfd_profile *bp)
bp->echo_mode = false;
bp->passive = false;
bp->minimum_ttl = BFD_DEF_MHOP_TTL;
- bp->min_echo_rx = BFD_DEF_REQ_MIN_ECHO;
+ bp->min_echo_rx = BFD_DEF_REQ_MIN_ECHO_RX;
+ bp->min_echo_tx = BFD_DEF_DES_MIN_ECHO_TX;
bp->min_rx = BFD_DEFREQUIREDMINRX;
bp->min_tx = BFD_DEFDESIREDMINTX;
}
@@ -179,13 +180,19 @@ void bfd_session_apply(struct bfd_session *bs)
/* We can only apply echo options on single hop sessions. */
if (!CHECK_FLAG(bs->flags, BFD_SESS_FLAG_MH)) {
- /* Configure remote echo if it was default. */
- if (bs->peer_profile.min_echo_rx == BFD_DEF_REQ_MIN_ECHO)
- bs->timers.required_min_echo = bp->min_echo_rx;
+ /* Configure echo timers if they were default. */
+ if (bs->peer_profile.min_echo_rx == BFD_DEF_REQ_MIN_ECHO_RX)
+ bs->timers.required_min_echo_rx = bp->min_echo_rx;
else
- bs->timers.required_min_echo =
+ bs->timers.required_min_echo_rx =
bs->peer_profile.min_echo_rx;
+ if (bs->peer_profile.min_echo_tx == BFD_DEF_DES_MIN_ECHO_TX)
+ bs->timers.desired_min_echo_tx = bp->min_echo_tx;
+ else
+ bs->timers.desired_min_echo_tx =
+ bs->peer_profile.min_echo_tx;
+
/* Toggle echo if default value. */
if (bs->peer_profile.echo_mode == false)
bfd_set_echo(bs, bp->echo_mode);
@@ -700,7 +707,8 @@ struct bfd_session *bfd_session_new(void)
bs->timers.desired_min_tx = BFD_DEFDESIREDMINTX;
bs->timers.required_min_rx = BFD_DEFREQUIREDMINRX;
- bs->timers.required_min_echo = BFD_DEF_REQ_MIN_ECHO;
+ bs->timers.required_min_echo_rx = BFD_DEF_REQ_MIN_ECHO_RX;
+ bs->timers.desired_min_echo_tx = BFD_DEF_DES_MIN_ECHO_TX;
bs->detect_mult = BFD_DEFDETECTMULT;
bs->mh_ttl = BFD_DEF_MHOP_TTL;
bs->ses_state = PTM_BFD_DOWN;
@@ -769,9 +777,14 @@ static void _bfd_session_update(struct bfd_session *bs,
bs->peer_profile.detection_multiplier = bs->detect_mult;
}
- if (bpc->bpc_has_echointerval) {
- bs->timers.required_min_echo = bpc->bpc_echointerval * 1000;
- bs->peer_profile.min_echo_rx = bs->timers.required_min_echo;
+ if (bpc->bpc_has_echorecvinterval) {
+ bs->timers.required_min_echo_rx = bpc->bpc_echorecvinterval * 1000;
+ bs->peer_profile.min_echo_rx = bs->timers.required_min_echo_rx;
+ }
+
+ if (bpc->bpc_has_echotxinterval) {
+ bs->timers.desired_min_echo_tx = bpc->bpc_echotxinterval * 1000;
+ bs->peer_profile.min_echo_tx = bs->timers.desired_min_echo_tx;
}
if (bpc->bpc_has_label)
@@ -1189,10 +1202,10 @@ void bs_echo_timer_handler(struct bfd_session *bs)
* RFC 5880, Section 6.8.9.
*/
old_timer = bs->echo_xmt_TO;
- if (bs->remote_timers.required_min_echo > bs->timers.required_min_echo)
+ if (bs->remote_timers.required_min_echo > bs->timers.desired_min_echo_tx)
bs->echo_xmt_TO = bs->remote_timers.required_min_echo;
else
- bs->echo_xmt_TO = bs->timers.required_min_echo;
+ bs->echo_xmt_TO = bs->timers.desired_min_echo_tx;
if (CHECK_FLAG(bs->flags, BFD_SESS_FLAG_ECHO_ACTIVE) == 0
|| old_timer != bs->echo_xmt_TO)