diff options
-rw-r--r-- | proto/ospf/lsack.c | 2 | ||||
-rw-r--r-- | proto/ospf/lsalib.c | 9 | ||||
-rw-r--r-- | proto/ospf/lsupd.c | 15 |
3 files changed, 18 insertions, 8 deletions
diff --git a/proto/ospf/lsack.c b/proto/ospf/lsack.c index 89397288..8b6b280c 100644 --- a/proto/ospf/lsack.c +++ b/proto/ospf/lsack.c @@ -191,6 +191,8 @@ ospf_lsack_rx(struct ospf_lsack_packet *ps, struct proto *p, if(lsa_comp(&lsa,&en->lsa)!=CMP_SAME) { + if((lsa.sn==LSA_MAXSEQNO)&&(lsa.age==LSA_MAXAGE)) continue; + debug("%s: Strange LS acknoledgement from %I\n",p->name,n->ip); debug("%s: Id: %I, Rt: %I, Type: %u\n",p->name,lsa.id,lsa.rt,lsa.type); debug("%s: I have: Age: %4u, Seqno: 0x%08x\n",p->name,en->lsa.age, diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c index 62ea0b86..d6317125 100644 --- a/proto/ospf/lsalib.c +++ b/proto/ospf/lsalib.c @@ -349,8 +349,13 @@ int lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2) /* Return codes from point of view of l1 */ { - if(l1->sn>l2->sn) return CMP_NEWER; - if(l1->sn<l2->sn) return CMP_OLDER; + u32 sn1,sn2; + + sn1=l1->sn-LSA_INITSEQNO+1; + sn2=l2->sn-LSA_INITSEQNO+1; + + if(sn1>sn2) return CMP_NEWER; + if(sn1<sn2) return CMP_OLDER; if(l1->checksum=!l2->checksum) return l1->checksum<l2->checksum ? CMP_OLDER : CMP_NEWER; diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index 19a663b8..798aa1e3 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -44,7 +44,6 @@ flood_lsa(struct ospf_neighbor *n, struct ospf_lsa_header *hn, if(nn->state<NEIGHBOR_EXCHANGE) continue; if(nn->state<NEIGHBOR_FULL) { - if((en=ospf_hash_find_header(nn->lsrqh,hh))!=NULL) { switch(lsa_comp(hh,&en->lsa)) @@ -93,9 +92,12 @@ flood_lsa(struct ospf_neighbor *n, struct ospf_lsa_header *hn, s_rem_node(SNODE en); ospf_hash_delete(nn->lsrth, en); } + ret=1; } } + if(ret==0) continue; + if(ifa==iff) { if((n->rid==iff->drid)||n->rid==iff->bdrid) continue; @@ -307,8 +309,8 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p, continue; } ntohlsah(lsa,&lsatmp); - DBG("Processing update Type: %u ID: %I RT: %I\n",lsatmp.type, - lsatmp.id, lsatmp.rt); + DBG("Processing update Type: %u ID: %I RT: %I, Sn: 0x%08x\n",lsatmp.type, + lsatmp.id, lsatmp.rt, lsatmp.sn); lsadb=ospf_hash_find_header(oa->gr, &lsatmp); /* pg 143 (4) */ @@ -358,14 +360,15 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p, { struct top_hash_entry *en; + if((lsatmp.age==LSA_MAXAGE)&&(lsatmp.sn==LSA_MAXSEQNO)) continue; + lsatmp.age=LSA_MAXAGE; lsatmp.sn=LSA_MAXSEQNO; + lsa->age=htons(LSA_MAXAGE); + lsa->sn=htonl(LSA_MAXSEQNO); debug("%s: Premature aging self originated lsa.\n",p->name); debug("%s: Type: %d, Id: %I, Rt: %I\n", p->name, lsatmp.type, lsatmp.id, lsatmp.rt); - body=mb_alloc(p->pool,lsatmp.length-sizeof(struct ospf_lsa_header)); - ntohlsab(lsa+1,body,lsatmp.type, - lsatmp.length-sizeof(struct ospf_lsa_header)); lsasum_check(lsa,(lsa+1),po); lsatmp.checksum=ntohs(lsa->checksum); flood_lsa(NULL,lsa,&lsatmp,po,NULL,oa,0); |