From: zmw12306 Date: Sat, 5 Apr 2025 23:02:31 +0000 (-0400) Subject: bfdd: Fix demultiplexing to rely solely on Your Discriminator as per RFC 5880. X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b2ab620121603d22ebf12bde6e8a9d1eb024e02c;p=mirror%2Ffrr.git bfdd: Fix demultiplexing to rely solely on Your Discriminator as per RFC 5880. According to RFC 5880 Section 6.3, once the remote peer reflects back the local discriminator, the receiver MUST demultiplex subsequent BFD packets based solely on the Your Discriminator field. The source IP or interface MUST NOT be used in demultiplexing once the session is established. Signed-off-by: zmw12306 --- diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 8d5306aaaf..3cee2565f3 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -755,26 +755,7 @@ void ptm_sbfd_echo_sess_dn(struct bfd_session *bfd, uint8_t diag) static struct bfd_session *bfd_find_disc(struct sockaddr_any *sa, uint32_t ldisc) { - struct bfd_session *bs; - - bs = bfd_id_lookup(ldisc); - if (bs == NULL) - return NULL; - - switch (bs->key.family) { - case AF_INET: - if (memcmp(&sa->sa_sin.sin_addr, &bs->key.peer, - sizeof(sa->sa_sin.sin_addr))) - return NULL; - break; - case AF_INET6: - if (memcmp(&sa->sa_sin6.sin6_addr, &bs->key.peer, - sizeof(sa->sa_sin6.sin6_addr))) - return NULL; - break; - } - - return bs; + return bfd_id_lookup(ldisc); } struct bfd_session *ptm_bfd_sess_find(struct bfd_pkt *cp,