diff options
author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2018-11-03 23:08:33 +0100 |
---|---|---|
committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2018-11-09 13:04:34 +0100 |
commit | dcc39aa5101c17d646fdc2c3c7c03966c503c182 (patch) | |
tree | 1a82ff0778ed852cf5d2c2f20f67efefa601f455 /bfdd/ptm_adapter.c | |
parent | OSPF: Add support to multi-area to Router Info. (diff) | |
download | frr-dcc39aa5101c17d646fdc2c3c7c03966c503c182.tar.xz frr-dcc39aa5101c17d646fdc2c3c7c03966c503c182.zip |
bfdd: fix BGP unnumbered peer setup
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>
(cherry picked from commit de61f256d68bc792a3823193fa8a49fdcaf77d3c)
Diffstat (limited to 'bfdd/ptm_adapter.c')
-rw-r--r-- | bfdd/ptm_adapter.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c index a5fae3383..aac4487f3 100644 --- a/bfdd/ptm_adapter.c +++ b/bfdd/ptm_adapter.c @@ -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); } } |