]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Minor fixes in OSPF.
authorOndrej Zajicek <santiago@crfreenet.org>
Sat, 12 Dec 2009 00:35:51 +0000 (01:35 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Sat, 12 Dec 2009 00:35:51 +0000 (01:35 +0100)
proto/ospf/lsreq.c
proto/ospf/lsupd.c

index 5eeb06f0ad0be15f0805d245d8b5d272048b1eea..e7d7af247cfaa2839fe210b1583b9912156596b6 100644 (file)
@@ -18,7 +18,7 @@ static void ospf_dump_lsreq(struct proto *p, struct ospf_lsreq_packet *pkt)
   struct ospf_lsreq_header *plsr = (void *) (pkt + 1);
   int i, j;
 
-  j = (ntohs(op->length) - sizeof(struct ospf_dbdes_packet)) /
+  j = (ntohs(op->length) - sizeof(struct ospf_lsreq_packet)) /
     sizeof(struct ospf_lsreq_header);
 
   for (i = 0; i < j; i++)
index ba09fec0b2ecc8a084ee7f1156930a0d5f56328c..f8195dcd30de067c2310fdc8511b084be7f25300 100644 (file)
@@ -456,27 +456,34 @@ ospf_lsupd_receive(struct ospf_lsupd_packet *ps,
 
       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: %d, 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(NULL, lsa, &lsatmp, NULL, oa, 0);
-       if (en = ospf_hash_find_header(po->gr, oa->areaid, &lsatmp))
+       OSPF_TRACE(D_EVENTS, "Received old self-originated LSA (Type: %04x, Id: %R, Rt: %R)", lsatmp.type, lsatmp.id, lsatmp.rt);
+
+       if (lsadb)
+       {
+         OSPF_TRACE(D_EVENTS, "Reflooding new self-originated LSA with newer SN");
+         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(NULL, NULL, &lsadb->lsa, NULL, oa, 1);
+       }
+       else
        {
-         ospf_lsupd_flood(NULL, NULL, &en->lsa, NULL, oa, 1);
+         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(NULL, lsa, &lsatmp, NULL, oa, 0);
        }
        continue;
       }
@@ -484,7 +491,7 @@ ospf_lsupd_receive(struct ospf_lsupd_packet *ps,
       /* 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;
       }