summaryrefslogtreecommitdiff
path: root/bfdd/bfd.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2018-07-25 22:44:41 -0300
committerRafael Zalamena <rzalamena@opensourcerouting.org>2018-08-08 18:25:08 -0300
commit43adc702e15d9cd11a74e27a5355dbaa5a4ff30b (patch)
treef100c34e5614644b3bf963053ddb85c09bf665bd /bfdd/bfd.c
parent788378fefac03d0a51be8409b4d0d20b723ca234 (diff)
bfdd: fix IPv6 peers using link-local address
When using link-local address we must specify the scope-id for the address in order to bind to the interface. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'bfdd/bfd.c')
-rw-r--r--bfdd/bfd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c
index ff62cd356b..28b6beadcb 100644
--- a/bfdd/bfd.c
+++ b/bfdd/bfd.c
@@ -605,9 +605,16 @@ struct bfd_session *ptm_bfd_sess_new(struct bfd_peer_cfg *bpc)
if (bpc->bpc_has_vxlan)
BFD_SET_FLAG(bfd->flags, BFD_SESS_FLAG_VXLAN);
- if (bpc->bpc_ipv4 == false)
+ if (bpc->bpc_ipv4 == false) {
BFD_SET_FLAG(bfd->flags, BFD_SESS_FLAG_IPV6);
+ /* Set the IPv6 scope id for link-local addresses. */
+ if (IN6_IS_ADDR_LINKLOCAL(&bpc->bpc_local.sa_sin6.sin6_addr))
+ bpc->bpc_local.sa_sin6.sin6_scope_id = bfd->ifindex;
+ if (IN6_IS_ADDR_LINKLOCAL(&bpc->bpc_peer.sa_sin6.sin6_addr))
+ bpc->bpc_peer.sa_sin6.sin6_scope_id = bfd->ifindex;
+ }
+
/* Initialize the session */
bfd->ses_state = PTM_BFD_DOWN;
bfd->discrs.my_discr = ptm_bfd_gen_ID();