summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-04-11 07:09:16 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-04-11 07:09:16 +0000
commit6560dbae0f96949c880a7aa3bc653ec1325f6cc4 (patch)
tree4b9e318ad428c580a73978687306488379354c1a
parent2d4da12467f33870a58a9cec4acf92529f845d21 (diff)
Simplify rde_summary_update(). The route entry has a valid/invalid flag
so there is no need to loop over the nexthops and we no longer need to pass the rt_nexthop to the summary LSA generation (a flag is enough). OK norby@ pyr@
-rw-r--r--usr.sbin/ospfd/rde.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/usr.sbin/ospfd/rde.c b/usr.sbin/ospfd/rde.c
index 66e1b7a6102..1c0ad91bb52 100644
--- a/usr.sbin/ospfd/rde.c
+++ b/usr.sbin/ospfd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.65 2007/04/10 13:26:39 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.66 2007/04/11 07:09:15 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -60,7 +60,7 @@ struct lsa *rde_asext_get(struct rroute *);
struct lsa *rde_asext_put(struct rroute *);
struct lsa *orig_asext_lsa(struct rroute *, u_int16_t);
-struct lsa *orig_sum_lsa(struct rt_node *, struct rt_nexthop *, u_int8_t);
+struct lsa *orig_sum_lsa(struct rt_node *, u_int8_t, int);
struct ospfd_conf *rdeconf = NULL, *nconf = NULL;
struct imsgbuf *ibuf_ospfe;
@@ -1040,16 +1040,8 @@ rde_summary_update(struct rt_node *rte, struct area *area)
{
struct vertex *v = NULL;
struct lsa *lsa;
- struct rt_nexthop *rn;
u_int8_t type = 0;
- TAILQ_FOREACH(rn, &rte->nexthop, entry) {
- if (!rn->invalid)
- break;
- }
- if (!rn)
- rn = TAILQ_FIRST(&rte->nexthop);
-
/* first check if we actually need to announce this route */
if (!(rte->d_type == DT_NET || rte->flags & OSPF_RTR_E))
return;
@@ -1078,7 +1070,7 @@ rde_summary_update(struct rt_node *rte, struct area *area)
/* update lsa but only if it was changed */
v = lsa_find(area, type, rte->prefix.s_addr, rde_router_id());
- lsa = orig_sum_lsa(rte, rn, type);
+ lsa = orig_sum_lsa(rte, type, rte->invalid);
lsa_merge(rde_nbr_self(area), lsa, v);
if (v == NULL)
@@ -1143,7 +1135,7 @@ orig_asext_lsa(struct rroute *rr, u_int16_t age)
}
struct lsa *
-orig_sum_lsa(struct rt_node *rte, struct rt_nexthop *rn, u_int8_t type)
+orig_sum_lsa(struct rt_node *rte, u_int8_t type, int invalid)
{
struct lsa *lsa;
u_int16_t len;
@@ -1153,7 +1145,7 @@ orig_sum_lsa(struct rt_node *rte, struct rt_nexthop *rn, u_int8_t type)
fatal("orig_sum_lsa");
/* LSA header */
- lsa->hdr.age = htons(rn->invalid ? MAX_AGE : DEFAULT_AGE);
+ lsa->hdr.age = htons(invalid ? MAX_AGE : DEFAULT_AGE);
lsa->hdr.opts = rdeconf->options; /* XXX not updated */
lsa->hdr.type = type;
lsa->hdr.adv_rtr = rdeconf->rtr_id.s_addr;
@@ -1180,4 +1172,3 @@ orig_sum_lsa(struct rt_node *rte, struct rt_nexthop *rn, u_int8_t type)
return (lsa);
}
-