Skip to content

Commit

Permalink
bfdd: fix BGP unnumbered peer setup
Browse files Browse the repository at this point in the history
The session key uses the scope id to figure out which interface we are
using with that link-local address, so if we don't set it when
registering a session we'll end up with multiple IPv6 sessions.

This bug was spotted by Sandro Bolliger.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
  • Loading branch information
rzalamena committed Nov 3, 2018
1 parent d0ca6a3 commit de61f25
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bfdd/ptm_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,21 @@ static int _ptm_msg_read(struct stream *msg, int command,
if (bpc->bpc_has_localif) {
STREAM_GET(bpc->bpc_localif, msg, ifnamelen);
bpc->bpc_localif[ifnamelen] = 0;

/*
* IPv6 link-local addresses must use scope id,
* otherwise the session lookup will always fail
* and we'll have multiple sessions showing up.
*
* This problem only happens with single hop
* since it is not possible to have link-local
* address for multi hop sessions.
*/
if (bpc->bpc_ipv4 == false
&& IN6_IS_ADDR_LINKLOCAL(
&bpc->bpc_peer.sa_sin6.sin6_addr))
bpc->bpc_peer.sa_sin6.sin6_scope_id =
ptm_bfd_fetch_ifindex(bpc->bpc_localif);
}
}

Expand Down

0 comments on commit de61f25

Please sign in to comment.