diff options
author | David S. Miller <davem@davemloft.net> | 2010-10-05 03:27:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-05 03:27:05 -0400 |
commit | 13f5bf18ba657d2d17c8fcf584e50359c718dd4b (patch) | |
tree | 8921d653cd6943ee66b69d04d8707df044ff714c | |
parent | 24824a09e35402b8d58dcc5be803a5ad3937bdba (diff) |
ipvs: Use frag walker helper in SCTP proto support.
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | net/netfilter/ipvs/ip_vs_proto_sctp.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c index 4c0855cb006e..2f982a4c4770 100644 --- a/net/netfilter/ipvs/ip_vs_proto_sctp.c +++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c | |||
@@ -61,6 +61,7 @@ sctp_snat_handler(struct sk_buff *skb, | |||
61 | { | 61 | { |
62 | sctp_sctphdr_t *sctph; | 62 | sctp_sctphdr_t *sctph; |
63 | unsigned int sctphoff; | 63 | unsigned int sctphoff; |
64 | struct sk_buff *iter; | ||
64 | __be32 crc32; | 65 | __be32 crc32; |
65 | 66 | ||
66 | #ifdef CONFIG_IP_VS_IPV6 | 67 | #ifdef CONFIG_IP_VS_IPV6 |
@@ -89,8 +90,8 @@ sctp_snat_handler(struct sk_buff *skb, | |||
89 | 90 | ||
90 | /* Calculate the checksum */ | 91 | /* Calculate the checksum */ |
91 | crc32 = sctp_start_cksum((u8 *) sctph, skb_headlen(skb) - sctphoff); | 92 | crc32 = sctp_start_cksum((u8 *) sctph, skb_headlen(skb) - sctphoff); |
92 | for (skb = skb_shinfo(skb)->frag_list; skb; skb = skb->next) | 93 | skb_walk_frags(skb, iter) |
93 | crc32 = sctp_update_cksum((u8 *) skb->data, skb_headlen(skb), | 94 | crc32 = sctp_update_cksum((u8 *) iter->data, skb_headlen(iter), |
94 | crc32); | 95 | crc32); |
95 | crc32 = sctp_end_cksum(crc32); | 96 | crc32 = sctp_end_cksum(crc32); |
96 | sctph->checksum = crc32; | 97 | sctph->checksum = crc32; |
@@ -102,9 +103,9 @@ static int | |||
102 | sctp_dnat_handler(struct sk_buff *skb, | 103 | sctp_dnat_handler(struct sk_buff *skb, |
103 | struct ip_vs_protocol *pp, struct ip_vs_conn *cp) | 104 | struct ip_vs_protocol *pp, struct ip_vs_conn *cp) |
104 | { | 105 | { |
105 | |||
106 | sctp_sctphdr_t *sctph; | 106 | sctp_sctphdr_t *sctph; |
107 | unsigned int sctphoff; | 107 | unsigned int sctphoff; |
108 | struct sk_buff *iter; | ||
108 | __be32 crc32; | 109 | __be32 crc32; |
109 | 110 | ||
110 | #ifdef CONFIG_IP_VS_IPV6 | 111 | #ifdef CONFIG_IP_VS_IPV6 |
@@ -133,8 +134,8 @@ sctp_dnat_handler(struct sk_buff *skb, | |||
133 | 134 | ||
134 | /* Calculate the checksum */ | 135 | /* Calculate the checksum */ |
135 | crc32 = sctp_start_cksum((u8 *) sctph, skb_headlen(skb) - sctphoff); | 136 | crc32 = sctp_start_cksum((u8 *) sctph, skb_headlen(skb) - sctphoff); |
136 | for (skb = skb_shinfo(skb)->frag_list; skb; skb = skb->next) | 137 | skb_walk_frags(skb, iter) |
137 | crc32 = sctp_update_cksum((u8 *) skb->data, skb_headlen(skb), | 138 | crc32 = sctp_update_cksum((u8 *) iter->data, skb_headlen(iter), |
138 | crc32); | 139 | crc32); |
139 | crc32 = sctp_end_cksum(crc32); | 140 | crc32 = sctp_end_cksum(crc32); |
140 | sctph->checksum = crc32; | 141 | sctph->checksum = crc32; |
@@ -145,9 +146,9 @@ sctp_dnat_handler(struct sk_buff *skb, | |||
145 | static int | 146 | static int |
146 | sctp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp) | 147 | sctp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp) |
147 | { | 148 | { |
148 | struct sk_buff *list = skb_shinfo(skb)->frag_list; | ||
149 | unsigned int sctphoff; | 149 | unsigned int sctphoff; |
150 | struct sctphdr *sh, _sctph; | 150 | struct sctphdr *sh, _sctph; |
151 | struct sk_buff *iter; | ||
151 | __le32 cmp; | 152 | __le32 cmp; |
152 | __le32 val; | 153 | __le32 val; |
153 | __u32 tmp; | 154 | __u32 tmp; |
@@ -166,9 +167,9 @@ sctp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp) | |||
166 | cmp = sh->checksum; | 167 | cmp = sh->checksum; |
167 | 168 | ||
168 | tmp = sctp_start_cksum((__u8 *) sh, skb_headlen(skb)); | 169 | tmp = sctp_start_cksum((__u8 *) sh, skb_headlen(skb)); |
169 | for (; list; list = list->next) | 170 | skb_walk_frags(skb, iter) |
170 | tmp = sctp_update_cksum((__u8 *) list->data, | 171 | tmp = sctp_update_cksum((__u8 *) iter->data, |
171 | skb_headlen(list), tmp); | 172 | skb_headlen(iter), tmp); |
172 | 173 | ||
173 | val = sctp_end_cksum(tmp); | 174 | val = sctp_end_cksum(tmp); |
174 | 175 | ||