diff options
author | Ondrej Filip <feela@network.cz> | 2000-04-04 17:55:55 +0200 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2000-04-04 17:55:55 +0200 |
commit | d8852b362c015db38abf180888e77900f35089de (patch) | |
tree | bb3de1cc7b412260b2347d00e8378e4819debe6a /proto/ospf/lsupd.c | |
parent | 921a93f2176723d235989efe882050c0265bea84 (diff) | |
download | bird-d8852b362c015db38abf180888e77900f35089de.tar bird-d8852b362c015db38abf180888e77900f35089de.zip |
LSupdate processing improved. Now there is some bug in hashing. :-(
Diffstat (limited to 'proto/ospf/lsupd.c')
-rw-r--r-- | proto/ospf/lsupd.c | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index 8ff3959..950a1f8 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -84,7 +84,7 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p, struct ospf_iface *ifa, u16 size) { u32 area,nrid,myrid; - struct ospf_neighbor *n; + struct ospf_neighbor *n,*ntmp; struct ospf_lsa_header *lsa; struct ospf_area *oa; struct proto_ospf *po=(struct proto_ospf *)p; @@ -132,9 +132,24 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p, continue; } ntohlsah(lsa,&lsatmp); - DBG("Processing update Type: %u ID: %u RT: %u\n",lsa->type, - ntohl(lsa->id), ntohl(lsa->rt)); + DBG("Processing update Type: %u ID: %u RT: %u\n",lsatmp.type, + lsatmp.id, lsatmp.rt); lsadb=ospf_hash_find_header(oa->gr, &lsatmp); + + /* Remove it from link state request list */ + WALK_LIST(NODE ifa,po->iface_list) + WALK_LIST(NODE ntmp,ifa->neigh_list) + { + struct top_hash_entry *en; + if((en=ospf_hash_find_header(ntmp->lsrqh,&lsatmp))!=NULL) + { + s_rem_node(SNODE en); + DBG("Removing from lsreq list for neigh %u\n", ntmp->rid); + ospf_hash_delete(ntmp->lsrqh,en); + if(EMPTY_SLIST(ntmp->lsrql)) ospf_neigh_sm(ntmp, INM_LOADDONE); + } + } + if((lsatmp.age==LSA_MAXAGE)&&(lsadb==NULL)) { struct ospf_neighbor *n=NULL; @@ -142,8 +157,9 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p, int flag=0; WALK_LIST(NODE ifa,po->iface_list) - WALK_LIST(NODE n,ifa->neigh_list) - if((n->state==NEIGHBOR_EXCHANGE)&&(n->state==NEIGHBOR_LOADING)) + WALK_LIST(NODE ntmp,ifa->neigh_list) + if((ntmp->state==NEIGHBOR_EXCHANGE)&& + (ntmp->state==NEIGHBOR_LOADING)) flag=1; if(flag==0) @@ -156,30 +172,32 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p, { struct ospf_neighbor *n=NULL; struct ospf_iface *ifa=NULL; + void *body; /* FIXME self originated? */ if(lsadb && ((lsadb->inst_t-now)<MINLSARRIVAL)) continue; /* Remove old from all ret lists */ - WALK_LIST(NODE ifa,po->iface_list) - WALK_LIST(NODE n,ifa->neigh_list) - { - struct top_hash_entry *en; - if((en=ospf_hash_find_header(n->lsrth,&lsadb->lsa))!=NULL) - s_rem_node(SNODE en); - } + if(lsadb) + WALK_LIST(NODE ifa,po->iface_list) + WALK_LIST(NODE ntmp,ifa->neigh_list) + { + struct top_hash_entry *en; + if((en=ospf_hash_find_header(ntmp->lsrth,&lsadb->lsa))!=NULL) + { + s_rem_node(SNODE en); + ospf_hash_delete(ntmp->lsrth,en); + } + } /* Install new */ - memcpy(&lsadb->lsa,&lsatmp,sizeof(struct ospf_lsa_header)); - lsadb->inst_t=now; - if(lsadb->lsa_body!=NULL) mb_free(lsadb->lsa_body); - lsadb->lsa_body=mb_alloc(p->pool,lsadb->lsa.length- - sizeof(struct ospf_lsa_header)); - ntohlsab(lsa+1,lsadb->lsa_body,lsadb->lsa.type,lsadb->lsa.length); - - /* FIXME lsa_flood(n,lsadb) */ - /* FIXME ack_lsa() */ + DBG("Allocatin body, size: %u\n",lsatmp.length-sizeof(struct ospf_lsa_header)); + 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)); + lsadb=lsa_install_new(&lsatmp,body, oa); + DBG("New installed\n"); + continue; } |