diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2021-11-04 15:11:18 +0300 |
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-11-11 14:56:04 +0300 |
| commit | 92f85e656b0814181eb8a473e642b8989086339d (patch) | |
| tree | c109b33ff5bac16de33d9675ddac90d05d5f591e /lib/bfd.c | |
| parent | 0ac8055ca1a9662d6e8197dff9a91759331991e7 (diff) | |
lib: remove confusing bfd TTL API
There are two APIs to control the expected number of hops for a BFD
session – `bfd_sess_set_mininum_ttl` and `bfd_sess_set_hop_count`.
The former is very confusing, as it takes an expected TTL in the
BFD packet which is actually a protocol internal value. The latter is
simple and straightforward – it takes an expected number of hops, which
is always 1 for single-hop and >1 for multi-hop.
As the former API is not used anywhere, just remove it to avoid any
confusion.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/bfd.c')
| -rw-r--r-- | lib/bfd.c | 29 |
1 files changed, 4 insertions, 25 deletions
@@ -646,32 +646,16 @@ void bfd_sess_set_vrf(struct bfd_session_params *bsp, vrf_id_t vrf_id) bsp->args.vrf_id = vrf_id; } -void bfd_sess_set_mininum_ttl(struct bfd_session_params *bsp, uint8_t min_ttl) +void bfd_sess_set_hop_count(struct bfd_session_params *bsp, uint8_t hops) { - assert(min_ttl != 0); - - if (bsp->args.ttl == ((BFD_SINGLE_HOP_TTL + 1) - min_ttl)) - return; - - /* If already installed, remove the old setting. */ - _bfd_sess_remove(bsp); - - /* Invert TTL value: protocol expects number of hops. */ - min_ttl = (BFD_SINGLE_HOP_TTL + 1) - min_ttl; - bsp->args.ttl = min_ttl; - bsp->args.mhop = (min_ttl > 1); -} - -void bfd_sess_set_hop_count(struct bfd_session_params *bsp, uint8_t min_ttl) -{ - if (bsp->args.ttl == min_ttl) + if (bsp->args.ttl == hops) return; /* If already installed, remove the old setting. */ _bfd_sess_remove(bsp); - bsp->args.ttl = min_ttl; - bsp->args.mhop = (min_ttl > 1); + bsp->args.ttl = hops; + bsp->args.mhop = (hops > 1); } @@ -706,11 +690,6 @@ enum bfd_session_state bfd_sess_status(const struct bfd_session_params *bsp) return bsp->bss.state; } -uint8_t bfd_sess_minimum_ttl(const struct bfd_session_params *bsp) -{ - return ((BFD_SINGLE_HOP_TTL + 1) - bsp->args.ttl); -} - uint8_t bfd_sess_hop_count(const struct bfd_session_params *bsp) { return bsp->args.ttl; |
