diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2021-01-08 10:38:04 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2021-01-09 14:29:45 +0100 |
commit | 134a53ec48255a492787a711a65693c7201201c7 (patch) | |
tree | e638ebe143dddfbb2c73fa3e1b34f98fea188032 /bfdd | |
parent | bfdd: enable bfd session if vrf interface available (diff) | |
download | frr-134a53ec48255a492787a711a65693c7201201c7.tar.xz frr-134a53ec48255a492787a711a65693c7201201c7.zip |
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 <philippe.guibert@6wind.com>
Diffstat (limited to 'bfdd')
-rw-r--r-- | bfdd/bfd_packet.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c index 10b99a62a..076318e6c 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, |