From 1f637b3161e5b3bb70d8847aba1103b8ed09e7f7 Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 1 Sep 2005 19:09:34 +0000 Subject: 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@ --- usr.sbin/ospfd/rde_spf.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'usr.sbin/ospfd/rde_spf.c') 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 @@ -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); -- cgit v1.2.3-59-g8ed1b