From: Nickolay Vinogradov <nickolay@protei.ru>
To: linux-kernel@vger.kernel.org
Subject: SCTP checksum patch for 2.6.26.5
Date: Mon, 22 Sep 2008 19:58:26 +0400 [thread overview]
Message-ID: <48D7C0A2.9090406@protei.ru> (raw)
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
--
Nickolay Vinogradov
Protei Research and Development Center
St.Petersburg, 194044, Russia
Tel.: +7 812 449 47 27
next reply other threads:[~2008-09-22 16:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-22 15:58 Nickolay Vinogradov [this message]
2008-09-22 20:12 ` SCTP checksum patch for 2.6.26.5 David Miller
2008-09-22 20:12 ` David Miller
2008-09-22 20:36 ` Vlad Yasevich
2008-09-22 20:36 ` Vlad Yasevich
2008-09-23 5:19 ` Willy Tarreau
2008-09-23 5:19 ` Willy Tarreau
2008-09-23 5:45 ` Harvey Harrison
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=48D7C0A2.9090406@protei.ru \
--to=nickolay@protei.ru \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.