From: Philippe Guibert Date: Fri, 8 Jan 2021 09:38:04 +0000 (+0000) Subject: bfdd: update vrf of received packet X-Git-Tag: base_7.6~21^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=134a53ec48255a492787a711a65693c7201201c7;p=mirror%2Ffrr.git bfdd: update vrf of received packet on vrf-lite environment, all incoming bfd packets are received by the same socket on the default namespace. the vrfid is not relevant and needs to be updated based on the incoming interface where traffic has been received. If the traffic is received from an interface belonging to a separate vrf, update the vrfid value accordingly. Signed-off-by: Philippe Guibert --- diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c index 10b99a62a9..076318e6ca 100644 --- a/bfdd/bfd_packet.c +++ b/bfdd/bfd_packet.c @@ -543,6 +543,7 @@ int bfd_recv_cb(struct thread *t) ifindex_t ifindex = IFINDEX_INTERNAL; struct sockaddr_any local, peer; uint8_t msgbuf[1516]; + struct interface *ifp = NULL; struct bfd_vrf_global *bvrf = THREAD_ARG(t); vrfid = bvrf->vrf->vrf_id; @@ -572,6 +573,15 @@ int bfd_recv_cb(struct thread *t) &local, &peer); } + /* update vrf-id because when in vrf-lite mode, + * the socket is on default namespace + */ + if (ifindex) { + ifp = if_lookup_by_index(ifindex, vrfid); + if (ifp) + vrfid = ifp->vrf_id; + } + /* Implement RFC 5880 6.8.6 */ if (mlen < BFD_PKT_LEN) { cp_debug(is_mhop, &peer, &local, ifindex, vrfid,