From: Rafael Zalamena Date: Wed, 20 Nov 2019 18:10:10 +0000 (-0300) Subject: bfdd: fix multiple VRF handling X-Git-Tag: frr-7.2.1~18^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=c05c48621c94582bce6ddb6e3f316f8a010c9bb0;p=mirror%2Ffrr.git bfdd: fix multiple VRF handling Use the interface VRF information instead of relying on the VRF specific socket information. Signed-off-by: Rafael Zalamena --- diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 948a94007d..875b41e7f7 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -400,12 +400,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); - if (vrfid != VRF_DEFAULT) - vrf = vrf_lookup_by_id(vrfid); - else - vrf = NULL; + /* + * 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);