Small patch to better hash type=2 LSAs.

This commit is contained in:
Ondrej Filip 2000-06-05 03:46:19 +00:00
parent 273fd2c164
commit 88048fb3c9
2 changed files with 18 additions and 1 deletions

View file

@ -126,7 +126,7 @@ ospf_rt_spfa(struct ospf_area *oa)
continue; continue;
break; break;
case LSART_NET: case LSART_NET:
tmp=ospf_hash_find(oa->gr,rtl->data,rtl->id,LSA_T_NET); tmp=ospf_hash_find(oa->gr,rtl->id,rtl->id,LSA_T_NET);
if(tmp==NULL) DBG("Fuck!\n"); if(tmp==NULL) DBG("Fuck!\n");
else DBG("Found. :-)\n"); else DBG("Found. :-)\n");
break; break;

View file

@ -439,7 +439,11 @@ ospf_top_hash_u32(u32 a)
static inline unsigned static inline unsigned
ospf_top_hash(struct top_graph *f, u32 lsaid, u32 rtrid, u32 type) ospf_top_hash(struct top_graph *f, u32 lsaid, u32 rtrid, u32 type)
{ {
#if 1 /* Dirty patch to make rt table calculation work. */
return (ospf_top_hash_u32(lsaid) + ospf_top_hash_u32((type==LSA_T_NET) ? lsaid : rtrid) + type) & f->hash_mask;
#else
return (ospf_top_hash_u32(lsaid) + ospf_top_hash_u32(rtrid) + type) & f->hash_mask; return (ospf_top_hash_u32(lsaid) + ospf_top_hash_u32(rtrid) + type) & f->hash_mask;
#endif
} }
struct top_graph * struct top_graph *
@ -510,8 +514,21 @@ ospf_hash_find(struct top_graph *f, u32 lsa, u32 rtr, u32 type)
{ {
struct top_hash_entry *e = f->hash_table[ospf_top_hash(f, lsa, rtr, type)]; struct top_hash_entry *e = f->hash_table[ospf_top_hash(f, lsa, rtr, type)];
#if 1 /* Dirty patch to make rt table calculation work. */
if(type==LSA_T_NET)
{
while (e && (e->lsa.id != lsa || e->lsa.type != LSA_T_NET ))
e = e->next;
}
else
{
while (e && (e->lsa.id != lsa || e->lsa.type != type || e->lsa.rt != rtr))
e = e->next;
}
#else
while (e && (e->lsa.id != lsa || e->lsa.rt != rtr || e->lsa.type != type)) while (e && (e->lsa.id != lsa || e->lsa.rt != rtr || e->lsa.type != type))
e = e->next; e = e->next;
#endif
return e; return e;
} }