diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-12-22 17:54:05 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-12-22 17:54:05 +0000 |
commit | 58331f8d9840ab7984560e6661dafa60514ea67c (patch) | |
tree | 1cf8fc2bd5c969f5dd8a2030ed4ccbb503eb3b48 /usr.sbin | |
parent | f9691be43cc156e74654c1792401d51aedb0c3d3 (diff) |
Link local addressing strikes again. Include ifindex in all nexthop
definitions so that we have a chance to build a correct nexthop.
Insane that a struct in6_addr is unable to fully specify an IPv6 address.
kroute.c still needs fixing but now the rib is starting to make sense.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ospf6d/ospf6d.h | 3 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde.h | 5 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde_spf.c | 21 |
3 files changed, 13 insertions, 16 deletions
diff --git a/usr.sbin/ospf6d/ospf6d.h b/usr.sbin/ospf6d/ospf6d.h index 9bd71a4f0a9..2a0cfaa63bc 100644 --- a/usr.sbin/ospf6d/ospf6d.h +++ b/usr.sbin/ospf6d/ospf6d.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf6d.h,v 1.17 2009/11/02 20:24:58 claudio Exp $ */ +/* $OpenBSD: ospf6d.h,v 1.18 2009/12/22 17:54:04 claudio Exp $ */ /* * Copyright (c) 2004, 2007 Esben Norby <norby@openbsd.org> @@ -458,6 +458,7 @@ struct ctl_rt { time_t uptime; u_int32_t cost; u_int32_t cost2; + unsigned int ifindex; /* scope of nexthop */ enum path_type p_type; enum dst_type d_type; u_int8_t flags; diff --git a/usr.sbin/ospf6d/rde.h b/usr.sbin/ospf6d/rde.h index 8d2f2820c60..95d1449ebba 100644 --- a/usr.sbin/ospf6d/rde.h +++ b/usr.sbin/ospf6d/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.17 2009/03/29 21:42:30 stsp Exp $ */ +/* $OpenBSD: rde.h,v 1.18 2009/12/22 17:54:04 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -30,7 +30,7 @@ struct v_nexthop { TAILQ_ENTRY(v_nexthop) entry; struct vertex *prev; struct in6_addr nexthop; - u_int32_t ifindex; + unsigned int ifindex; }; TAILQ_HEAD(v_nexthead, v_nexthop); @@ -91,6 +91,7 @@ struct rt_nexthop { TAILQ_ENTRY(rt_nexthop) entry; struct in6_addr nexthop; struct in_addr adv_rtr; + unsigned int ifindex; time_t uptime; u_int8_t connected; u_int8_t invalid; diff --git a/usr.sbin/ospf6d/rde_spf.c b/usr.sbin/ospf6d/rde_spf.c index 9be065be3b2..42e0fae846f 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.17 2009/12/22 17:42:46 claudio Exp $ */ +/* $OpenBSD: rde_spf.c,v 1.18 2009/12/22 17:54:04 claudio Exp $ */ /* * Copyright (c) 2005 Esben Norby <norby@openbsd.org> @@ -40,9 +40,9 @@ 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 *, - u_int32_t); + unsigned int); void calc_nexthop_transit_nbr(struct vertex *, struct vertex *, - u_int32_t); + unsigned int); void calc_nexthop(struct vertex *, struct vertex *, struct area *, struct lsa_rtr_link *); void rt_nexthop_clear(struct rt_node *); @@ -213,7 +213,6 @@ rt_calc(struct vertex *v, struct area *area, struct ospfd_conf *conf) struct in6_addr ia6; u_int16_t i, off; u_int8_t flags; - enum path_type type; lsa_age(v); if (ntohs(v->lsa->hdr.age) == MAX_AGE) @@ -270,15 +269,9 @@ rt_calc(struct vertex *v, struct area *area, struct ospfd_conf *conf) adv_rtr.s_addr = htonl(w->adv_rtr); - if (prefix->prefixlen == 128 || - prefix->options & OSPF_PREFIX_LA) - type = DT_RTR; - else - type = DT_NET; - rt_update(&ia6, prefix->prefixlen, &w->nexthop, w->cost + ntohs(prefix->metric), 0, - area->id, adv_rtr, PT_INTRA_AREA, type, + area->id, adv_rtr, PT_INTRA_AREA, DT_NET, flags, 0); } off += sizeof(struct lsa_prefix) @@ -412,7 +405,7 @@ calc_nexthop_add(struct vertex *dst, struct vertex *parent, struct in6_addr * calc_nexthop_lladdr(struct vertex *dst, struct lsa_rtr_link *rtr_link, - u_int32_t ifindex) + unsigned int ifindex) { struct iface *iface; struct vertex *link; @@ -446,7 +439,7 @@ calc_nexthop_lladdr(struct vertex *dst, struct lsa_rtr_link *rtr_link, void calc_nexthop_transit_nbr(struct vertex *dst, struct vertex *parent, - u_int32_t ifindex) + unsigned int ifindex) { struct lsa_rtr_link *rtr_link; unsigned int i; @@ -846,6 +839,7 @@ rt_nexthop_add(struct rt_node *r, struct v_nexthead *vnh, clock_gettime(CLOCK_MONOTONIC, &now); rn->nexthop = vn->nexthop; + rn->ifindex = vn->ifindex; rn->adv_rtr.s_addr = adv_rtr.s_addr; rn->uptime = now.tv_sec; rn->connected = vn->prev == spf_root; @@ -909,6 +903,7 @@ rt_dump(struct in_addr area, pid_t pid, u_int8_t r_type) rtctl.prefix = r->prefix; rtctl.nexthop = rn->nexthop; + rtctl.ifindex = rn->ifindex; rtctl.area.s_addr = r->area.s_addr; rtctl.adv_rtr.s_addr = rn->adv_rtr.s_addr; rtctl.cost = r->cost; |