aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-07-19 02:07:09 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-19 02:07:09 -0400
commit336d3262df71fcd2661180bb35d5ea41b4cbca58 (patch)
tree54078334c9c3706a003d4b54a8e9e9b23aa01cef /net
parent4e54064e0a13b7a7d4a481123c1783f770538e30 (diff)
sctp: remove unnecessary byteshifting, calculate directly in big-endian
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_sctp.c4
-rw-r--r--net/sctp/input.c4
-rw-r--r--net/sctp/output.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/netfilter/nf_nat_proto_sctp.c b/net/ipv4/netfilter/nf_nat_proto_sctp.c
index 82e4c0e286b8..65e470bc6123 100644
--- a/net/ipv4/netfilter/nf_nat_proto_sctp.c
+++ b/net/ipv4/netfilter/nf_nat_proto_sctp.c
@@ -36,7 +36,7 @@ sctp_manip_pkt(struct sk_buff *skb,
36 sctp_sctphdr_t *hdr; 36 sctp_sctphdr_t *hdr;
37 unsigned int hdroff = iphdroff + iph->ihl*4; 37 unsigned int hdroff = iphdroff + iph->ihl*4;
38 __be32 oldip, newip; 38 __be32 oldip, newip;
39 u32 crc32; 39 __be32 crc32;
40 40
41 if (!skb_make_writable(skb, hdroff + sizeof(*hdr))) 41 if (!skb_make_writable(skb, hdroff + sizeof(*hdr)))
42 return false; 42 return false;
@@ -61,7 +61,7 @@ sctp_manip_pkt(struct sk_buff *skb,
61 crc32 = sctp_update_cksum((u8 *)skb->data, skb_headlen(skb), 61 crc32 = sctp_update_cksum((u8 *)skb->data, skb_headlen(skb),
62 crc32); 62 crc32);
63 crc32 = sctp_end_cksum(crc32); 63 crc32 = sctp_end_cksum(crc32);
64 hdr->checksum = htonl(crc32); 64 hdr->checksum = crc32;
65 65
66 return true; 66 return true;
67} 67}
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 5ed93c05c23e..a49fa80b57b9 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -83,8 +83,8 @@ static inline int sctp_rcv_checksum(struct sk_buff *skb)
83{ 83{
84 struct sk_buff *list = skb_shinfo(skb)->frag_list; 84 struct sk_buff *list = skb_shinfo(skb)->frag_list;
85 struct sctphdr *sh = sctp_hdr(skb); 85 struct sctphdr *sh = sctp_hdr(skb);
86 __u32 cmp = ntohl(sh->checksum); 86 __be32 cmp = sh->checksum;
87 __u32 val = sctp_start_cksum((__u8 *)sh, skb_headlen(skb)); 87 __be32 val = sctp_start_cksum((__u8 *)sh, skb_headlen(skb));
88 88
89 for (; list; list = list->next) 89 for (; list; list = list->next)
90 val = sctp_update_cksum((__u8 *)list->data, skb_headlen(list), 90 val = sctp_update_cksum((__u8 *)list->data, skb_headlen(list),
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 9a63a3fb9011..45684646b1db 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -365,7 +365,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
365 struct sctp_transport *tp = packet->transport; 365 struct sctp_transport *tp = packet->transport;
366 struct sctp_association *asoc = tp->asoc; 366 struct sctp_association *asoc = tp->asoc;
367 struct sctphdr *sh; 367 struct sctphdr *sh;
368 __u32 crc32 = 0; 368 __be32 crc32 = __constant_cpu_to_be32(0);
369 struct sk_buff *nskb; 369 struct sk_buff *nskb;
370 struct sctp_chunk *chunk, *tmp; 370 struct sctp_chunk *chunk, *tmp;
371 struct sock *sk; 371 struct sock *sk;
@@ -538,7 +538,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
538 /* 3) Put the resultant value into the checksum field in the 538 /* 3) Put the resultant value into the checksum field in the
539 * common header, and leave the rest of the bits unchanged. 539 * common header, and leave the rest of the bits unchanged.
540 */ 540 */
541 sh->checksum = htonl(crc32); 541 sh->checksum = crc32;
542 542
543 /* IP layer ECN support 543 /* IP layer ECN support
544 * From RFC 2481 544 * From RFC 2481