]> git.puffer.fish Git - mirror/frr.git/commitdiff
bfdd: Fix demultiplexing to rely solely on Your Discriminator as per RFC 5880. 18586/head
authorzmw12306 <zmw12306@gmail.com>
Sat, 5 Apr 2025 23:02:31 +0000 (19:02 -0400)
committerzmw12306 <zmw12306@gmail.com>
Sat, 5 Apr 2025 23:02:31 +0000 (19:02 -0400)
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 <zmw12306@gmail.com>
bfdd/bfd.c

index 8d5306aaafbb68fd1dc04aaeb47d8eee93e0b265..3cee2565f31ba2e73daa4b8552c8c303b4edb2bd 100644 (file)
@@ -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,