summaryrefslogtreecommitdiff
path: root/net/sctp
diff options
context:
space:
mode:
authorJoe Stringer <joe@wand.net.nz>2013-07-25 10:52:05 +0900
committerDavid S. Miller <davem@davemloft.net>2013-07-27 20:07:15 -0700
commit024ec3deac33ddbd81f3c887506f132b24ea21a7 (patch)
tree32e21519a6180435415dc89628929d0e6ed56ecf /net/sctp
parente7428e95a06fb516fac1308bd0e176e27c0b9287 (diff)
net/sctp: Refactor SCTP skb checksum computation
This patch consolidates the SCTP checksum calculation code from various places to a single new function, sctp_compute_cksum(skb, offset). Signed-off-by: Joe Stringer <joe@wand.net.nz> Reviewed-by: Julian Anastasov <ja@ssi.bg> Acked-by: Simon Horman <horms@verge.net.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/input.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 7993495a4c0f..fa91aff02388 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -87,15 +87,7 @@ static inline int sctp_rcv_checksum(struct net *net, struct sk_buff *skb)
{
struct sctphdr *sh = sctp_hdr(skb);
__le32 cmp = sh->checksum;
- struct sk_buff *list;
- __le32 val;
- __u32 tmp = sctp_start_cksum((__u8 *)sh, skb_headlen(skb));
-
- skb_walk_frags(skb, list)
- tmp = sctp_update_cksum((__u8 *)list->data, skb_headlen(list),
- tmp);
-
- val = sctp_end_cksum(tmp);
+ __le32 val = sctp_compute_cksum(skb, 0);
if (val != cmp) {
/* CRC failure, dump it. */