summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_lsa.c
diff options
context:
space:
mode:
authorYasuhiro Ohara <yasu@jaist.ac.jp>2009-12-17 06:41:17 +0100
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-05-26 03:14:44 +0200
commit52cf4a5181d11481743f685c38c5711641c52e52 (patch)
tree6e6f58379ac54278b6e876710347bd10a0e5e3f5 /ospf6d/ospf6_lsa.c
parentospfd: invalid MD5 auth_key? (diff)
downloadfrr-52cf4a5181d11481743f685c38c5711641c52e52.tar.xz
frr-52cf4a5181d11481743f685c38c5711641c52e52.zip
Bug in ospf6_lsa_compare()
This fix is probably correct on 32bit systems, but i think it will not work on 64bit systems. sizeof(signed long) would be 8 and therefore the cast from u_int32_t will map all the values to non-negative part of long int. You would like to use int (like in ospfd) and change the type of seqnuma, seqnumb to that. The type int32_t would be even more proper, but sizeof(int) is 4 on relevant platforms. Signed-off: Ondrej Zajicek <santiago@crfreenet.org> Acked-by: Feng Lu <lu.feng@6wind.com> Acked-by: Yasuhiro Ohara <yasu@jaist.ac.jp> (cherry picked from commit bdd8cd70a042473477f9144c9cedb8dde11ba2c1)
Diffstat (limited to 'ospf6d/ospf6_lsa.c')
-rw-r--r--ospf6d/ospf6_lsa.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index 2471f6c59..317e33ba7 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -306,7 +306,7 @@ ospf6_lsa_premature_aging (struct ospf6_lsa *lsa)
int
ospf6_lsa_compare (struct ospf6_lsa *a, struct ospf6_lsa *b)
{
- int seqnuma, seqnumb;
+ int32_t seqnuma, seqnumb;
u_int16_t cksuma, cksumb;
u_int16_t agea, ageb;
@@ -314,8 +314,8 @@ ospf6_lsa_compare (struct ospf6_lsa *a, struct ospf6_lsa *b)
assert (b && b->header);
assert (OSPF6_LSA_IS_SAME (a, b));
- seqnuma = (int) ntohl (a->header->seqnum);
- seqnumb = (int) ntohl (b->header->seqnum);
+ seqnuma = (int32_t) ntohl (a->header->seqnum);
+ seqnumb = (int32_t) ntohl (b->header->seqnum);
/* compare by sequence number */
if (seqnuma > seqnumb)