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>
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,