summaryrefslogtreecommitdiff
path: root/proto/ospf/topology.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-07-31 11:37:30 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2010-07-31 11:37:30 +0200
commitd395fe48553062413a85fd04cda0752f933e70c6 (patch)
treeb7499d07e5c6b8ce257e7b0bab5a166156695b03 /proto/ospf/topology.c
parentd1e146f2f8da303af7bbe0cec363cc15c58c37fd (diff)
Fixes bug in OSPF ext-LSA origination.
Diffstat (limited to 'proto/ospf/topology.c')
-rw-r--r--proto/ospf/topology.c15
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;