From 910adaa08bbd416288797505399ab47f990817e6 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Sun, 10 Jan 2021 15:29:02 +0100 Subject: BFD: Dispatch sessions also by interface index Direct BFD sessions needs to be dispatched not only by IP addresses, but also by interfaces, in order to avoid collisions between neighbors with the same IPv6 link-local addresses. Extend BFD session hash_ip key by interface index to handle that. Use 0 for multihop sessions. Thanks to Sebastian Hahn for the original patch. --- proto/bfd/packets.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'proto/bfd/packets.c') diff --git a/proto/bfd/packets.c b/proto/bfd/packets.c index 703c6e28..7618e20f 100644 --- a/proto/bfd/packets.c +++ b/proto/bfd/packets.c @@ -366,7 +366,8 @@ bfd_rx_hook(sock *sk, uint len) if (ps > BFD_STATE_DOWN) DROP("invalid init state", ps); - s = bfd_find_session_by_addr(p, sk->faddr); + uint ifindex = (sk->sport == BFD_CONTROL_PORT) ? sk->lifindex : 0; + s = bfd_find_session_by_addr(p, sk->faddr, ifindex); /* FIXME: better session matching and message */ if (!s) -- cgit v1.2.3