summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-12-22 16:29:56 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-12-22 16:29:56 +0000
commitebb69d4d845f35a5d2b012d5bf97fcc114838f13 (patch)
treee766b73c261684237f215e4c7f52b79a8c9907bc /usr.sbin
parentf63ba1ec63eac0b6c295e5cc9e3851505f21edf2 (diff)
Give calc_nexthop_lladdr() a chance to find the correct link local address.
We need to pass our ifindex so that we can find the Link-LSA that has the link local address stored for that router. Don't we all like IPv6 link local addresses and their insanity.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ospf6d/rde_spf.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/usr.sbin/ospf6d/rde_spf.c b/usr.sbin/ospf6d/rde_spf.c
index 35164136c3d..402b1d591ac 100644
--- a/usr.sbin/ospf6d/rde_spf.c
+++ b/usr.sbin/ospf6d/rde_spf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_spf.c,v 1.15 2009/07/28 19:20:40 claudio Exp $ */
+/* $OpenBSD: rde_spf.c,v 1.16 2009/12/22 16:29:55 claudio Exp $ */
/*
* Copyright (c) 2005 Esben Norby <norby@openbsd.org>
@@ -39,9 +39,10 @@ struct vertex *spf_root = NULL;
void calc_nexthop_clear(struct vertex *);
void calc_nexthop_add(struct vertex *, struct vertex *,
const struct in6_addr *, u_int32_t);
-struct in6_addr *calc_nexthop_lladdr(struct vertex *, struct lsa_rtr_link *);
+struct in6_addr *calc_nexthop_lladdr(struct vertex *, struct lsa_rtr_link *,
+ u_int32_t);
void calc_nexthop_transit_nbr(struct vertex *, struct vertex *,
- u_int32_t ifindex);
+ u_int32_t);
void calc_nexthop(struct vertex *, struct vertex *,
struct area *, struct lsa_rtr_link *);
void rt_nexthop_clear(struct rt_node *);
@@ -410,26 +411,28 @@ calc_nexthop_add(struct vertex *dst, struct vertex *parent,
}
struct in6_addr *
-calc_nexthop_lladdr(struct vertex *dst, struct lsa_rtr_link *rtr_link)
+calc_nexthop_lladdr(struct vertex *dst, struct lsa_rtr_link *rtr_link,
+ u_int32_t ifindex)
{
- struct iface *iface;
- struct vertex *link;
- struct rde_nbr *nbr;
+ struct iface *iface;
+ struct vertex *link;
+ struct rde_nbr *nbr;
/* Find outgoing interface, we need its LSA tree */
LIST_FOREACH(iface, &dst->area->iface_list, entry) {
- if (ntohl(rtr_link->iface_id) == iface->ifindex)
+ if (ifindex == iface->ifindex)
break;
}
if (!iface) {
- warnx("calc_nexthop_lladdr: no interface found for ifindex");
+ log_warnx("calc_nexthop_lladdr: no interface found for "
+ "ifindex %d", ntohl(rtr_link->iface_id));
return (NULL);
}
/* Determine neighbor's link-local address.
* Try to get it from link LSA first. */
link = lsa_find_tree(&iface->lsa_tree,
- htons(LSA_TYPE_LINK), rtr_link->nbr_iface_id,
+ htons(LSA_TYPE_LINK), rtr_link->iface_id,
htonl(dst->adv_rtr));
if (link)
return &link->lsa->data.link.lladdr;
@@ -461,7 +464,7 @@ calc_nexthop_transit_nbr(struct vertex *dst, struct vertex *parent,
if (rtr_link->type == LINK_TYPE_TRANSIT_NET &&
rtr_link->nbr_rtr_id == parent->lsa->hdr.adv_rtr &&
rtr_link->nbr_iface_id == parent->lsa->hdr.ls_id) {
- lladdr = calc_nexthop_lladdr(dst, rtr_link);
+ lladdr = calc_nexthop_lladdr(dst, rtr_link, ifindex);
calc_nexthop_add(dst, parent, lladdr, ifindex);
}
}
@@ -480,7 +483,8 @@ calc_nexthop(struct vertex *dst, struct vertex *parent,
case LSA_TYPE_ROUTER:
if (rtr_link->type != LINK_TYPE_POINTTOPOINT)
fatalx("inconsistent SPF tree");
- nexthop = calc_nexthop_lladdr(dst, rtr_link);
+ nexthop = calc_nexthop_lladdr(dst, rtr_link,
+ ntohl(rtr_link->nbr_iface_id));
break;
case LSA_TYPE_NETWORK:
if (rtr_link->type != LINK_TYPE_TRANSIT_NET)