summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospfd/rde_spf.c
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2005-09-01 19:09:34 +0000
committerclaudio <claudio@openbsd.org>2005-09-01 19:09:34 +0000
commit1f637b3161e5b3bb70d8847aba1103b8ed09e7f7 (patch)
tree35dc1ade0eb2efd12c9bfacbd0a31df5cbc42a05 /usr.sbin/ospfd/rde_spf.c
parentComment fix and make description of -c and -w match reality more (diff)
downloadwireguard-openbsd-1f637b3161e5b3bb70d8847aba1103b8ed09e7f7.tar.xz
wireguard-openbsd-1f637b3161e5b3bb70d8847aba1103b8ed09e7f7.zip
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@
Diffstat (limited to 'usr.sbin/ospfd/rde_spf.c')
-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);