diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-08-11 14:43:56 -0300 | 
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-08-11 21:22:39 -0300 | 
| commit | 262e1d2528e866d5608a3cf337c7761e35160926 (patch) | |
| tree | ba8a99ce918626978c4c99d7ffe8ecaf7f58dd0b /bfdd/bfd.c | |
| parent | abd1529680f42bb5857ca11b4d8ede251e3fe903 (diff) | |
bfdd: implement minimum TTL
Initial BFD protocol implementation had a hard coded value of maximum 5
hops, now we have a configurable hop amount with a safe default of 1
hop.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'bfdd/bfd.c')
| -rw-r--r-- | bfdd/bfd.c | 12 | 
1 files changed, 12 insertions, 0 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 1fc9224752..2b3caa6fef 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -89,6 +89,7 @@ static void bfd_profile_set_default(struct bfd_profile *bp)  	bp->detection_multiplier = BFD_DEFDETECTMULT;  	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_rx = BFD_DEFREQUIREDMINRX;  	bp->min_tx = BFD_DEFDESIREDMINTX; @@ -190,6 +191,12 @@ void bfd_session_apply(struct bfd_session *bs)  			bfd_set_echo(bs, bp->echo_mode);  		else  			bfd_set_echo(bs, bs->peer_profile.echo_mode); +	} else { +		/* Configure the TTL packet filter. */ +		if (bs->peer_profile.minimum_ttl == BFD_DEF_MHOP_TTL) +			bs->mh_ttl = bp->minimum_ttl; +		else +			bs->mh_ttl = bs->peer_profile.minimum_ttl;  	}  	/* Toggle 'passive-mode' if default value. */ @@ -752,6 +759,11 @@ static void _bfd_session_update(struct bfd_session *bs,  	else  		UNSET_FLAG(bs->flags, BFD_SESS_FLAG_CBIT); +	if (bpc->bpc_has_minimum_ttl) { +		bs->mh_ttl = bpc->bpc_minimum_ttl; +		bs->peer_profile.minimum_ttl = bpc->bpc_minimum_ttl; +	} +  	bs->peer_profile.echo_mode = bpc->bpc_echo;  	bfd_set_echo(bs, bpc->bpc_echo);  | 
