From 11d4474c17e76e9811dcb32f555fa1c6f3684fab Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 22 Feb 2003 22:47:45 +0000 Subject: Better selection of link-local NLRI addresses, at least for our own address. Need to do it better for the other neighbors -- the current solution works only if they use the standard 64+64 global addresses and the interface identifier in lower 64 bits is the same as for the link-scope addresses. --- proto/bgp/bgp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'proto/bgp/bgp.c') diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index f6cbed4..7069d98 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -434,6 +434,19 @@ bgp_start_neighbor(struct bgp_proto *p) { p->local_addr = p->neigh->iface->addr->ip; DBG("BGP: local=%I remote=%I\n", p->local_addr, p->next_hop); +#ifdef IPV6 + { + struct ifa *a; + p->local_link = ipa_or(ipa_build(0xfe80,0,0,0), ipa_and(p->local_addr, ipa_build(0,0,~0,~0))); + WALK_LIST(a, p->neigh->iface->addrs) + if (a->scope == SCOPE_LINK) + { + p->local_link = a->ip; + break; + } + DBG("BGP: Selected link-level address %I\n", p->local_link); + } +#endif bgp_initiate(p); } -- cgit v1.2.3