summaryrefslogtreecommitdiffstats
path: root/bfdd
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@users.noreply.github.com>2020-01-22 20:14:21 +0100
committerGitHub <noreply@github.com>2020-01-22 20:14:21 +0100
commitabe5af17744fa1775430aed978ac058dd011a4e1 (patch)
tree40b75657686abba43615cb7546d7244da06b78c1 /bfdd
parentMerge pull request #5710 from opensourcerouting/fix_centos6 (diff)
parentbfdd: fix multiple VRF handling (diff)
downloadfrr-abe5af17744fa1775430aed978ac058dd011a4e1.tar.xz
frr-abe5af17744fa1775430aed978ac058dd011a4e1.zip
Merge pull request #5412 from opensourcerouting/bfdd-vrf-fix
bfdd: fix multiple VRF handling
Diffstat (limited to 'bfdd')
-rw-r--r--bfdd/bfd.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c
index 920e3fdee..222bf32c9 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);