summaryrefslogtreecommitdiff
path: root/proto/bfd/packets.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2021-01-10 15:29:02 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2021-01-10 15:29:02 +0100
commit910adaa08bbd416288797505399ab47f990817e6 (patch)
tree1bb8dc591845949a87719e4a9e23ab24c012e6cf /proto/bfd/packets.c
parent17663b6a7c505226cfe9ccc0671611075a3dff57 (diff)
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.
Diffstat (limited to 'proto/bfd/packets.c')
-rw-r--r--proto/bfd/packets.c3
1 files changed, 2 insertions, 1 deletions
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)