And finally, Premature aging works. :-)

This commit is contained in:
Ondrej Filip 2000-05-31 18:21:42 +00:00
parent 31ee3d5f21
commit 3728267827
3 changed files with 18 additions and 8 deletions

View file

@ -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_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: 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: 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, debug("%s: I have: Age: %4u, Seqno: 0x%08x\n",p->name,en->lsa.age,

View file

@ -349,8 +349,13 @@ int
lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2) lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2)
/* Return codes from point of view of l1 */ /* Return codes from point of view of l1 */
{ {
if(l1->sn>l2->sn) return CMP_NEWER; u32 sn1,sn2;
if(l1->sn<l2->sn) return CMP_OLDER;
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) if(l1->checksum=!l2->checksum)
return l1->checksum<l2->checksum ? CMP_OLDER : CMP_NEWER; return l1->checksum<l2->checksum ? CMP_OLDER : CMP_NEWER;

View file

@ -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_EXCHANGE) continue;
if(nn->state<NEIGHBOR_FULL) if(nn->state<NEIGHBOR_FULL)
{ {
if((en=ospf_hash_find_header(nn->lsrqh,hh))!=NULL) if((en=ospf_hash_find_header(nn->lsrqh,hh))!=NULL)
{ {
switch(lsa_comp(hh,&en->lsa)) 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); s_rem_node(SNODE en);
ospf_hash_delete(nn->lsrth, en); ospf_hash_delete(nn->lsrth, en);
} }
ret=1;
} }
} }
if(ret==0) continue; if(ret==0) continue;
if(ifa==iff) if(ifa==iff)
{ {
if((n->rid==iff->drid)||n->rid==iff->bdrid) continue; 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; continue;
} }
ntohlsah(lsa,&lsatmp); ntohlsah(lsa,&lsatmp);
DBG("Processing update Type: %u ID: %I RT: %I\n",lsatmp.type, DBG("Processing update Type: %u ID: %I RT: %I, Sn: 0x%08x\n",lsatmp.type,
lsatmp.id, lsatmp.rt); lsatmp.id, lsatmp.rt, lsatmp.sn);
lsadb=ospf_hash_find_header(oa->gr, &lsatmp); lsadb=ospf_hash_find_header(oa->gr, &lsatmp);
/* pg 143 (4) */ /* pg 143 (4) */
@ -358,14 +360,15 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
{ {
struct top_hash_entry *en; struct top_hash_entry *en;
if((lsatmp.age==LSA_MAXAGE)&&(lsatmp.sn==LSA_MAXSEQNO)) continue;
lsatmp.age=LSA_MAXAGE; lsatmp.age=LSA_MAXAGE;
lsatmp.sn=LSA_MAXSEQNO; 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: Premature aging self originated lsa.\n",p->name);
debug("%s: Type: %d, Id: %I, Rt: %I\n", p->name, lsatmp.type, debug("%s: Type: %d, Id: %I, Rt: %I\n", p->name, lsatmp.type,
lsatmp.id, lsatmp.rt); 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); lsasum_check(lsa,(lsa+1),po);
lsatmp.checksum=ntohs(lsa->checksum); lsatmp.checksum=ntohs(lsa->checksum);
flood_lsa(NULL,lsa,&lsatmp,po,NULL,oa,0); flood_lsa(NULL,lsa,&lsatmp,po,NULL,oa,0);