Skip to content

Commit

Permalink
bfdd: fix single hop IPv6 configurations
Browse files Browse the repository at this point in the history
Don't assume IPv6 will always be multi hop and handle the single hop
link-local address case.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
  • Loading branch information
rzalamena committed Mar 6, 2019
1 parent 0ff3b11 commit 2435b7d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bfdd/bfd.c
Expand Up @@ -208,13 +208,17 @@ int bfd_session_enable(struct bfd_session *bs)

/* Set the IPv6 scope id for link-local addresses. */
if (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_IPV6)) {
sin6 = &bs->mhop.peer.sa_sin6;
sin6 = (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_MH))
? &bs->mhop.peer.sa_sin6
: &bs->shop.peer.sa_sin6;
if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
sin6->sin6_scope_id = bs->ifp != NULL
? bs->ifp->ifindex
: IFINDEX_INTERNAL;

sin6 = &bs->mhop.local.sa_sin6;
sin6 = (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_MH))
? &bs->mhop.local.sa_sin6
: &bs->local_address.sa_sin6;
if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
sin6->sin6_scope_id = bs->ifp != NULL
? bs->ifp->ifindex
Expand Down

0 comments on commit 2435b7d

Please sign in to comment.