summaryrefslogtreecommitdiff
path: root/proto/ospf/lsupd.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-12-14 20:37:32 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2009-12-14 20:37:32 +0100
commit63542845dfb6d2277f93f77ad9ca3ad8bbaddd09 (patch)
treef65e7c59057a3db2bd80126ac5095d37a42fc2ce /proto/ospf/lsupd.c
parent34a877ccac25d38172716d3d2488449c870cad0b (diff)
parent8a7fb8858fa87bce6f2f15ee2bbb77704b5fff4e (diff)
Merge branch 'dev' into ospf3
Conflicts: proto/ospf/lsreq.c proto/ospf/lsupd.c proto/ospf/rt.c
Diffstat (limited to 'proto/ospf/lsupd.c')
-rw-r--r--proto/ospf/lsupd.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c
index 8780e700..9bed374e 100644
--- a/proto/ospf/lsupd.c
+++ b/proto/ospf/lsupd.c
@@ -549,27 +549,35 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
/* pg 145 (5f) - premature aging of self originated lsa */
if (self)
{
- struct top_hash_entry *en;
-
if ((lsatmp.age == LSA_MAXAGE) && (lsatmp.sn == LSA_MAXSEQNO))
{
ospf_lsack_enqueue(n, lsa, ACKL_DIRECT);
continue;
}
- lsatmp.age = LSA_MAXAGE;
- lsatmp.sn = LSA_MAXSEQNO;
- lsa->age = htons(LSA_MAXAGE);
- lsa->sn = htonl(LSA_MAXSEQNO);
- OSPF_TRACE(D_EVENTS, "Premature aging self originated LSA.");
- OSPF_TRACE(D_EVENTS, "Type: %04x, Id: %R, Rt: %R",
+ OSPF_TRACE(D_EVENTS, "Received old self-originated LSA (Type: %04x, Id: %R, Rt: %R)",
lsatmp.type, lsatmp.id, lsatmp.rt);
- lsasum_check(lsa, (lsa + 1)); /* It also calculates chsum! */
- lsatmp.checksum = ntohs(lsa->checksum);
- ospf_lsupd_flood(po, NULL, lsa, &lsatmp, domain, 0);
- if (en = ospf_hash_find_header(po->gr, domain, &lsatmp))
- { /* FIXME verify hacks */
- ospf_lsupd_flood(po, NULL, NULL, &en->lsa, domain, 1);
+
+ if (lsadb)
+ {
+ OSPF_TRACE(D_EVENTS, "Reflooding new self-originated LSA with newer sequence number");
+ lsadb->lsa.sn = lsatmp.sn + 1;
+ lsadb->lsa.age = 0;
+ lsadb->inst_t = now;
+ lsadb->ini_age = 0;
+ lsasum_calculate(&lsadb->lsa, lsadb->lsa_body);
+ ospf_lsupd_flood(po, NULL, NULL, &lsadb->lsa, domain, 1);
+ }
+ else
+ {
+ OSPF_TRACE(D_EVENTS, "Premature aging it");
+ lsatmp.age = LSA_MAXAGE;
+ lsatmp.sn = LSA_MAXSEQNO;
+ lsa->age = htons(LSA_MAXAGE);
+ lsa->sn = htonl(LSA_MAXSEQNO);
+ lsasum_check(lsa, (lsa + 1)); /* It also calculates chsum! */
+ lsatmp.checksum = ntohs(lsa->checksum);
+ ospf_lsupd_flood(po, NULL, lsa, &lsatmp, domain, 0);
}
continue;
}
@@ -577,7 +585,7 @@ ospf_lsupd_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
/* pg 144 (5a) */
if (lsadb && ((now - lsadb->inst_t) <= MINLSARRIVAL)) /* FIXME: test for flooding? */
{
- DBG("I got it in less that MINLSARRIVAL\n");
+ OSPF_TRACE(D_EVENTS, "Skipping LSA received in less that MINLSARRIVAL");
sendreq = 0;
continue;
}