From: Vlad Yasevich <vladislav.yasevich@hp.com>
To: nickolay@protei.ru
Cc: David Miller <davem@davemloft.net>,
linux-kernel@vger.kernel.org, linux-sctp@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: SCTP checksum patch for 2.6.26.5
Date: Mon, 22 Sep 2008 16:36:58 -0400 [thread overview]
Message-ID: <48D801EA.7060308@hp.com> (raw)
In-Reply-To: <20080922.131245.193705447.davem@davemloft.net>
David Miller wrote:
> From: Nickolay Vinogradov <nickolay@protei.ru>
> Date: Mon, 22 Sep 2008 19:58:26 +0400
>
> CC:'ing correct mailing lists...
>
>> SCTP checksum calculation fix for BigEndian.
>> ntohl() doesn't do anything on BigEndian.
>>
>> diff --git a/Makefile b/Makefile
>> diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
>> index ba75c67..2f0ed64 100644
>> --- a/include/net/sctp/checksum.h
>> +++ b/include/net/sctp/checksum.h
>> @@ -74,5 +74,19 @@ static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
>>
>> static inline __u32 sctp_end_cksum(__u32 crc32)
>> {
>> - return ntohl(~crc32);
>> + __u32 result;
>> + __u8 byte0, byte1, byte2, byte3;
>> +
>> + result = ~crc32;
>> +
>> + byte0 = result & 0xff;
>> + byte1 = (result>>8) & 0xff;
>> + byte2 = (result>>16) & 0xff;
>> + byte3 = (result>>24) & 0xff;
>> +
>> + crc32 = ((byte0 << 24) |
>> + (byte1 << 16) |
>> + (byte2 << 8) |
>> + byte3);
>> + return crc32;
>> }
>> diff --git a/net/sctp/output.c b/net/sctp/output.c
Was this tested? I remember running tests with that code between
big and little endian arches and it worked. So, the old code worked
correclty.
I changed in 2.6.27 series to do all the calculations in network order anyway.
-vlad
>>
>>
>> -- Nickolay Vinogradov
>> Protei Research and Development Center
>> St.Petersburg, 194044, Russia
>> Tel.: +7 812 449 47 27
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2008-09-22 20:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <48D7C0A2.9090406@protei.ru>
2008-09-22 20:12 ` SCTP checksum patch for 2.6.26.5 David Miller
2008-09-22 20:36 ` Vlad Yasevich [this message]
2008-09-23 5:19 ` Willy Tarreau
2008-09-23 5:45 ` Harvey Harrison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48D801EA.7060308@hp.com \
--to=vladislav.yasevich@hp.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nickolay@protei.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).