]> git.puffer.fish Git - matthieu/frr.git/commit
bfdd: fix session lookup
authorIgor Ryzhov <iryzhov@nfware.com>
Tue, 2 Feb 2021 22:02:15 +0000 (01:02 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 16 Feb 2021 18:09:38 +0000 (21:09 +0300)
commitd9a0e9a2934f2f75c64496fe4c724a18aa581fcb
treeaa4c22d0e11a9a35f41c46ec24d7f9352a426d34
parent08afa0a75311a4e8cb2a18116384b603f7f2d751
bfdd: fix session lookup

BFD key has optional fields "local" and "ifname" which can be empty when
the BFD session is created. In this case, the hash key will be calculated
with these fields filled with zeroes.

Later, when we're looking for the BFD session using the key with fields
"local" and "ifname" populated with actual values, the hash key will be
different. To work around this issue, we're doing multiple hash lookups,
first with full key, then with fields "local" and "ifname" filled with
zeroes.

But there may be another case when the initial key has the actual values
for "local" and "ifname", but the key we're using for lookup has empty
values. This case is covered for IPv4 by using additional hash walk with
bfd_key_lookup_ignore_partial_walker function but is not covered for IPv6.

Instead of introducing more hacks and workarounds, the following solution
is proposed:
- the hash key is always calculated in bfd_key_hash_do using only
  required fields
- the hash data is compared in bfd_key_hash_cmp, taking into account the
  fact that fields "local" and "ifname" may be empty

Using this solution, it's enough to make only one hash lookup.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
bfdd/bfd.c