diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2010-07-31 11:37:30 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2010-08-03 10:35:02 +0200 |
commit | c756a1c54743b634f65d5e39955cf42514671ec7 (patch) | |
tree | 42af57961c5eb8302ee5fda103be17184fc98fb0 /proto/ospf | |
parent | 1a35a27b64ce2cbef0eb71d874fe41d9b240a2d8 (diff) |
Fixes bug in OSPF ext-LSA origination.
Diffstat (limited to 'proto/ospf')
-rw-r--r-- | proto/ospf/topology.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index ea674e2c..16a06676 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -145,7 +145,7 @@ get_seqnum(struct top_hash_entry *en) if (en->lsa.sn == LSA_MAXSEQNO) { - log(L_WARN, "OSPF: Premature origination of LSA (Type: %04x, Id: %R, Rt: %R)", + log(L_WARN "OSPF: Premature origination of LSA (Type: %04x, Id: %R, Rt: %R)", en->lsa.type, en->lsa.id, en->lsa.rt); return LSA_INITSEQNO; } @@ -657,7 +657,7 @@ check_sum_lsa_same(struct top_hash_entry *en, u32 metric) { /* Netmask already checked in check_sum_net_lsaid_collision() */ struct ospf_lsa_sum *sum = en->lsa_body; - return (sum->metric == metric); + return (en->lsa.sn != LSA_MAXSEQNO) && (sum->metric == metric); } #define check_sum_net_lsa_same(en,metric) \ @@ -700,7 +700,7 @@ check_sum_net_lsa_same(struct top_hash_entry *en, u32 metric) { /* Prefix already checked in check_sum_net_lsaid_collision() */ struct ospf_lsa_sum_net *sum = en->lsa_body; - return (sum->metric == metric); + return (en->lsa.sn != LSA_MAXSEQNO) && (sum->metric == metric); } static inline void * @@ -720,7 +720,8 @@ static inline int check_sum_rt_lsa_same(struct top_hash_entry *en, u32 drid, u32 metric, u32 options) { struct ospf_lsa_sum_rt *sum = en->lsa_body; - return (sum->options == options) && (sum->metric == metric) && (sum->drid == drid); + return (en->lsa.sn != LSA_MAXSEQNO) && (sum->options == options) && + (sum->metric == metric) && (sum->drid == drid); } #endif @@ -886,7 +887,8 @@ check_ext_lsa(struct top_hash_entry *en, struct fib_node *fn, u32 metric, ip_add if (fn->pxlen != ipa_mklen(ext->netmask)) return -1; - return (ext->metric == metric) && (ext->tag == tag) && ipa_equal(ext->fwaddr,fwaddr); + return (en->lsa.sn != LSA_MAXSEQNO) && (ext->metric == metric) && + (ext->tag == tag) && ipa_equal(ext->fwaddr,fwaddr); } #else /* OSPFv3 */ @@ -938,6 +940,9 @@ check_ext_lsa(struct top_hash_entry *en, struct fib_node *fn, u32 metric, ip_add if ((fn->pxlen != pxlen) || !ipa_equal(fn->prefix, prefix)) return -1; + if (en->lsa.sn == LSA_MAXSEQNO) + return 0; + u32 rt_metric = ext->metric & METRIC_MASK; ip_addr rt_fwaddr = IPA_NONE; u32 rt_tag = 0; |