diff options
author | Joe Stringer <joe@wand.net.nz> | 2013-07-24 21:52:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-07-27 23:07:15 -0400 |
commit | 024ec3deac33ddbd81f3c887506f132b24ea21a7 (patch) | |
tree | 32e21519a6180435415dc89628929d0e6ed56ecf /net/sctp | |
parent | e7428e95a06fb516fac1308bd0e176e27c0b9287 (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.c | 10 |
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) | |||
87 | { | 87 | { |
88 | struct sctphdr *sh = sctp_hdr(skb); | 88 | struct sctphdr *sh = sctp_hdr(skb); |
89 | __le32 cmp = sh->checksum; | 89 | __le32 cmp = sh->checksum; |
90 | struct sk_buff *list; | 90 | __le32 val = sctp_compute_cksum(skb, 0); |
91 | __le32 val; | ||
92 | __u32 tmp = sctp_start_cksum((__u8 *)sh, skb_headlen(skb)); | ||
93 | |||
94 | skb_walk_frags(skb, list) | ||
95 | tmp = sctp_update_cksum((__u8 *)list->data, skb_headlen(list), | ||
96 | tmp); | ||
97 | |||
98 | val = sctp_end_cksum(tmp); | ||
99 | 91 | ||
100 | if (val != cmp) { | 92 | if (val != cmp) { |
101 | /* CRC failure, dump it. */ | 93 | /* CRC failure, dump it. */ |