summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2000-05-30 17:01:51 +0200
committerOndrej Filip <feela@network.cz>2000-05-30 17:01:51 +0200
commitef6f26b417060f9ac6c26224469b909a0c3aa933 (patch)
treee3ecd9d46d41a273817de400c0ea3c18243640c0
parent2aa476a535c878a412bb732eae16d97848f07ff3 (diff)
downloadbird-ef6f26b417060f9ac6c26224469b909a0c3aa933.tar
bird-ef6f26b417060f9ac6c26224469b909a0c3aa933.zip
Bug in lsa comparision.
-rw-r--r--proto/ospf/lsalib.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c
index 020ca62..ac56a10 100644
--- a/proto/ospf/lsalib.c
+++ b/proto/ospf/lsalib.c
@@ -340,17 +340,19 @@ 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)
- {
- if(l1->checksum=!l2->checksum)
- 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(abs(l1->age-l2->age)>LSA_MAXAGEDIFF)
- return l1->age<l2->age ? CMP_NEWER : CMP_OLDER;
- }
- return CMP_SAME;
+ if(l1->sn>l2->sn) return CMP_NEWER;
+ if(l1->sn<l2->sn) return CMP_OLDER;
+
+ if(l1->checksum=!l2->checksum)
+ return l1->checksum<l2->checksum ? CMP_OLDER : CMP_NEWER;
+
+ if((l1->age==LSA_MAXAGE)&&(l2->age!=LSA_MAXAGE)) return CMP_NEWER;
+ if((l2->age==LSA_MAXAGE)&&(l1->age!=LSA_MAXAGE)) return CMP_OLDER;
+
+ if(abs(l1->age-l2->age)>LSA_MAXAGEDIFF)
+ return l1->age<l2->age ? CMP_NEWER : CMP_OLDER;
+
+ return CMP_SAME;
}
/* LSA can be temporarrily, but body must be mb_alloced. */