]> git.puffer.fish Git - mirror/frr.git/commitdiff
bfdd: fix single hop IPv6 configurations
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 6 Mar 2019 20:50:04 +0000 (17:50 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 6 Mar 2019 20:50:04 +0000 (17:50 -0300)
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>
bfdd/bfd.c

index be6f2caa44862aa0d365518d158e85125d0ca5bb..36133f572711c3caaf3ed17274338f6f8b80f807 100644 (file)
@@ -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