diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2019-11-20 15:10:10 -0300 |
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2019-11-22 08:37:18 -0300 |
| commit | d1ca89aead434cd35043f2d3b32dc80514cf9b63 (patch) | |
| tree | 10f27c5748b06f6d51b1a4fe45dffb1669418413 | |
| parent | 2d7ef3bba7eeb00adf2aceeca4747b59f4ac5fc7 (diff) | |
bfdd: fix multiple VRF handling
Use the interface VRF information instead of relying on the VRF specific
socket information.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit c05c48621c94582bce6ddb6e3f316f8a010c9bb0)
| -rw-r--r-- | bfdd/bfd.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c index cc171f2ebf..fc09397c36 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -403,10 +403,21 @@ struct bfd_session *ptm_bfd_sess_find(struct bfd_pkt *cp, if (cp->discrs.remote_discr) return bfd_find_disc(peer, ntohl(cp->discrs.remote_discr)); - /* Search for session without using discriminator. */ - ifp = if_lookup_by_index(ifindex, vrfid); - - vrf = vrf_lookup_by_id(vrfid); + /* + * Search for session without using discriminator. + * + * XXX: we can't trust `vrfid` because the VRF handling is not + * properly implemented. Meanwhile we should use the interface + * VRF to find out which one it belongs. + */ + ifp = if_lookup_by_index_all_vrf(ifindex); + if (ifp == NULL) { + if (vrfid != VRF_DEFAULT) + vrf = vrf_lookup_by_id(vrfid); + else + vrf = NULL; + } else + vrf = vrf_lookup_by_id(ifp->vrf_id); gen_bfd_key(&key, peer, local, is_mhop, ifp ? ifp->name : NULL, vrf ? vrf->name : VRF_DEFAULT_NAME); |
