Bug in lsa comparision.
This commit is contained in:
parent
2aa476a535
commit
ef6f26b417
1 changed files with 13 additions and 11 deletions
|
@ -340,17 +340,19 @@ 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;
|
if(l1->sn>l2->sn) return CMP_NEWER;
|
||||||
if(l1->sn==l2->sn)
|
if(l1->sn<l2->sn) 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;
|
||||||
if(l1->age==LSA_MAXAGE) return CMP_NEWER;
|
|
||||||
if(l2->age==LSA_MAXAGE) return CMP_OLDER;
|
if((l1->age==LSA_MAXAGE)&&(l2->age!=LSA_MAXAGE)) return CMP_NEWER;
|
||||||
if(abs(l1->age-l2->age)>LSA_MAXAGEDIFF)
|
if((l2->age==LSA_MAXAGE)&&(l1->age!=LSA_MAXAGE)) return CMP_OLDER;
|
||||||
return l1->age<l2->age ? CMP_NEWER : CMP_OLDER;
|
|
||||||
}
|
if(abs(l1->age-l2->age)>LSA_MAXAGEDIFF)
|
||||||
return CMP_SAME;
|
return l1->age<l2->age ? CMP_NEWER : CMP_OLDER;
|
||||||
|
|
||||||
|
return CMP_SAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LSA can be temporarrily, but body must be mb_alloced. */
|
/* LSA can be temporarrily, but body must be mb_alloced. */
|
||||||
|
|
Loading…
Reference in a new issue