summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-03-21 08:36:28 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-03-21 08:36:28 +0000
commit83191f2daa4c95eef4649133e3c7d14cea75937f (patch)
tree7aa3a9e89ac6ee8154c51c04952c3a057d539bfa /usr.sbin/ospfd
parentba0f5e8d8af9fd84762412ce25068eb3fa4f25ac (diff)
Invalidating the full RIB and then only recalculating part of it is not
that smart. Kill the global rt_invalidate() instead clear only that part of the RIB that is actually recalculated. OK norby@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r--usr.sbin/ospfd/rde_spf.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/usr.sbin/ospfd/rde_spf.c b/usr.sbin/ospfd/rde_spf.c
index e6d51a11051..c07fcf3e648 100644
--- a/usr.sbin/ospfd/rde_spf.c
+++ b/usr.sbin/ospfd/rde_spf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_spf.c,v 1.50 2006/03/13 09:36:06 claudio Exp $ */
+/* $OpenBSD: rde_spf.c,v 1.51 2006/03/21 08:36:27 claudio Exp $ */
/*
* Copyright (c) 2005 Esben Norby <norby@openbsd.org>
@@ -42,7 +42,7 @@ void rt_update(struct in_addr, u_int8_t, struct in_addr, u_int32_t,
u_int32_t, struct in_addr, struct in_addr, enum path_type,
enum dst_type, u_int8_t, u_int8_t);
struct rt_node *rt_lookup(enum dst_type, in_addr_t);
-void rt_invalidate(void);
+void rt_invalidate(struct area *);
int linked(struct vertex *, struct vertex *);
void
@@ -536,10 +536,11 @@ spf_timer(int fd, short event, void *arg)
conf->spf_state = SPF_DELAY;
/* FALLTHROUGH */
case SPF_DELAY:
- rt_invalidate();
-
LIST_FOREACH(area, &conf->area_list, entry) {
if (area->dirty) {
+ /* invalidate RIB entries of this area */
+ rt_invalidate(area);
+
/* calculate SPF tree */
spf_calc(area);
@@ -552,7 +553,8 @@ spf_timer(int fd, short event, void *arg)
}
}
- /* calculate as-external routes */
+ /* calculate as-external routes, first invalidate them */
+ rt_invalidate(NULL);
RB_FOREACH(v, lsa_tree, &conf->lsa_tree) {
asext_calc(v);
}
@@ -707,12 +709,22 @@ rt_remove(struct rt_node *r)
}
void
-rt_invalidate(void)
+rt_invalidate(struct area *area)
{
struct rt_node *r, *nr;
for (r = RB_MIN(rt_tree, &rt); r != NULL; r = nr) {
nr = RB_NEXT(rt_tree, &rt, r);
+ if (area == NULL) {
+ /* look only at as_ext routes */
+ if (r->p_type != PT_TYPE1_EXT &&
+ r->p_type != PT_TYPE2_EXT)
+ continue;
+ } else {
+ /* look only at routes matching the area */
+ if (r->area.s_addr != area->id.s_addr)
+ continue;
+ }
if (r->invalid)
rt_remove(r);
else