summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-09-01 19:09:35 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-09-01 19:09:35 +0000
commit3863d2f8fedb338ab4e682c37fc2be6e6b93a8a8 (patch)
tree0bc5621e8c9d468e63891df98bd147f1f35fa5d9
parent93c74c75c00f4bf20d299b39f6125f16825bd957 (diff)
rt_lookup() did not respect the route node invalid flag and so AS-ext
routes where not cleared even though the advertising router was no longer reachable. Same problem has the rt_dump() function that is used for ospfctl show rib. Tested by me and norby@ OK norby@ deraadt@
-rw-r--r--usr.sbin/ospfd/rde_spf.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.sbin/ospfd/rde_spf.c b/usr.sbin/ospfd/rde_spf.c
index 1cc372ae21a..c961c86a087 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.32 2005/08/30 21:02:35 claudio Exp $ */
+/* $OpenBSD: rde_spf.c,v 1.33 2005/09/01 19:09:34 claudio Exp $ */
/*
* Copyright (c) 2005 Esben Norby <norby@openbsd.org>
@@ -721,6 +721,9 @@ rt_dump(struct in_addr area, pid_t pid, u_int8_t r_type)
struct rt_node *r;
RB_FOREACH(r, rt_tree, &rt) {
+ if (r->invalid)
+ continue;
+
if (r->area.s_addr != area.s_addr)
continue;
@@ -854,12 +857,17 @@ rt_lookup(enum dst_type type, in_addr_t addr)
struct rt_node *rn;
u_int8_t i = 32;
- if (type == DT_RTR)
- return (rt_find(addr, 32, type));
+ if (type == DT_RTR) {
+ rn = rt_find(addr, 32, type);
+ if (rn && rn->invalid == 0)
+ return (rn);
+ return (NULL);
+ }
/* type == DT_NET */
do {
- if ((rn = rt_find(addr & prefixlen2mask(i), i, type)))
+ if ((rn = rt_find(addr & prefixlen2mask(i), i, type)) &&
+ rn->invalid == 0)
return (rn);
} while (i-- != 0);