mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 22:21:21 +00:00
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>
This commit is contained in:
parent
e7428e95a0
commit
024ec3deac
4 changed files with 20 additions and 36 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue