summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-07-28 11:45:35 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2010-07-28 11:45:35 +0200
commit1b180121a90ef98f3adce1a355d48d64c6fc3c4f (patch)
treeea7e2474aef579a585b4e82fa3098ed5ee8b416d /proto
parentc477f48916d74c2db6156145851f9536ae0a0a6c (diff)
Use link-local addresses in recursive next hops for IPv6 BGP.
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/packets.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index ba43cd28..632c564e 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -805,11 +805,17 @@ static inline int
bgp_set_next_hop(struct bgp_proto *p, rta *a)
{
struct eattr *nh = ea_find(a->eattrs, EA_CODE(EAP_BGP, BA_NEXT_HOP));
- ip_addr nexthop = *(ip_addr *) nh->u.ptr->data;
+ ip_addr *nexthop = (ip_addr *) nh->u.ptr->data;
+
+#ifdef IPV6
+ int second = (nh->u.ptr->length == NEXT_HOP_LENGTH);
+#else
+ int second = 0;
+#endif
if (p->cf->gw_mode == GW_DIRECT)
{
- neighbor *ng = neigh_find(&p->p, &nexthop, 0) ? : p->neigh;
+ neighbor *ng = neigh_find(&p->p, nexthop, 0) ? : p->neigh;
if (ng->scope == SCOPE_HOST)
return 0;
@@ -819,7 +825,7 @@ bgp_set_next_hop(struct bgp_proto *p, rta *a)
a->hostentry = NULL;
}
else /* GW_RECURSIVE */
- rta_set_recursive_next_hop(p->p.table, a, p->igp_table, &nexthop);
+ rta_set_recursive_next_hop(p->p.table, a, p->igp_table, nexthop, nexthop + second);
return 1;
}