From: Paul Jakma Date: Thu, 30 Mar 2006 14:34:31 +0000 (+0000) Subject: [ospfd] Fix failure of Fletcher checksum with certain compilers X-Git-Tag: frr-2.0-rc1~2741 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=075c2011bbec618934637ead3fd6dec65cd30a45;p=mirror%2Ffrr.git [ospfd] Fix failure of Fletcher checksum with certain compilers 2006-03-27 Paul Jakma * ospf_lsa.c: (ospf_lsa_checksum) Add an explicit cast to avoid the ambiguities of ANSI and C99 C with respect to type conversion. Detailed problem report and test case with example data supplied by Dmitry Ivanov . --- diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog index e5aa0660d3..265c9c7624 100644 --- a/ospfd/ChangeLog +++ b/ospfd/ChangeLog @@ -1,3 +1,10 @@ +2006-03-27 Paul Jakma + + * ospf_lsa.c: (ospf_lsa_checksum) Add an explicit cast to avoid + the ambiguities of ANSI and C99 C with respect to type + conversion. Detailed problem report and test case with + example data supplied by Dmitry Ivanov . + 2006-03-25 Paul Jakma * ospf_interface.c: (ospf_if_lookup_recv_if) Ignore loopbacks, diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 12959f0488..faae4376d2 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -202,7 +202,7 @@ ospf_lsa_checksum (struct lsa_header *lsa) c1 %= 255; } - x = ((length - LSA_CHECKSUM_OFFSET) * c0 - c1) % 255; + x = (((int)length - LSA_CHECKSUM_OFFSET) * c0 - c1) % 255; if (x <= 0) x += 255; y = 510 - c0 - x;