diff options
author | Joe Stringer <joe@wand.net.nz> | 2013-07-25 10:52:05 +0900 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-07-27 20:07:15 -0700 |
commit | 024ec3deac33ddbd81f3c887506f132b24ea21a7 (patch) | |
tree | 32e21519a6180435415dc89628929d0e6ed56ecf /net/netfilter/nf_nat_proto_sctp.c | |
parent | e7428e95a06fb516fac1308bd0e176e27c0b9287 (diff) | |
download | linux-stable-024ec3deac33ddbd81f3c887506f132b24ea21a7.tar.gz linux-stable-024ec3deac33ddbd81f3c887506f132b24ea21a7.tar.bz2 linux-stable-024ec3deac33ddbd81f3c887506f132b24ea21a7.zip |
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/netfilter/nf_nat_proto_sctp.c')
-rw-r--r-- | net/netfilter/nf_nat_proto_sctp.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/net/netfilter/nf_nat_proto_sctp.c b/net/netfilter/nf_nat_proto_sctp.c index 396e55d46f90..754536f2c674 100644 --- a/net/netfilter/nf_nat_proto_sctp.c +++ b/net/netfilter/nf_nat_proto_sctp.c @@ -34,9 +34,7 @@ sctp_manip_pkt(struct sk_buff *skb, const struct nf_conntrack_tuple *tuple, enum nf_nat_manip_type maniptype) { - struct sk_buff *frag; sctp_sctphdr_t *hdr; - __u32 crc32; if (!skb_make_writable(skb, hdroff + sizeof(*hdr))) return false; @@ -51,11 +49,7 @@ sctp_manip_pkt(struct sk_buff *skb, hdr->dest = tuple->dst.u.sctp.port; } - crc32 = sctp_start_cksum((u8 *)hdr, skb_headlen(skb) - hdroff); - skb_walk_frags(skb, frag) - crc32 = sctp_update_cksum((u8 *)frag->data, skb_headlen(frag), - crc32); - hdr->checksum = sctp_end_cksum(crc32); + hdr->checksum = sctp_compute_cksum(skb, hdroff); return true; } |