From 54818e9beb6bfcbcb5dcc2b175dca9d174012e6c Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Mon, 3 May 2010 00:10:48 +0200 Subject: A minor bugfix in OSPF ext-LSA processing. --- proto/ospf/rt.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 81eca56..8332ffa 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -1024,6 +1024,23 @@ ospf_rt_abr(struct proto_ospf *po) ospf_check_vlinks(po); } +/* Like fib_route(), but ignores dummy rt entries */ +static void * +ospf_fib_route(struct fib *f, ip_addr a, int len) +{ + ip_addr a0; + ort *nf; + + while (len >= 0) + { + a0 = ipa_and(a, ipa_mkmask(len)); + nf = fib_find(f, &a0, len); + if (nf && nf->n.type) + return nf; + len--; + } + return NULL; +} /* RFC 2328 16.4. calculating external routes */ static void @@ -1124,9 +1141,8 @@ ospf_ext_spf(struct proto_ospf *po) } else { - /* FIXME: what about more specific dummy route? */ - nf2 = fib_route(&po->rtf, rt_fwaddr, MAX_PREFIX_LENGTH); - if (!nf2) /* nf2->n.type is checked later */ + nf2 = ospf_fib_route(&po->rtf, rt_fwaddr, MAX_PREFIX_LENGTH); + if (!nf2) continue; if ((nf2->n.type != RTS_OSPF) && (nf2->n.type != RTS_OSPF_IA)) -- cgit v1.2.3