xfrm: Use frag list abstraction interfaces.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2009-06-09 00:22:47 -07:00
parent 1b003be39e
commit d4fd3bc101

View file

@ -696,8 +696,9 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc,
{ {
int start = skb_headlen(skb); int start = skb_headlen(skb);
int i, copy = start - offset; int i, copy = start - offset;
int err; struct sk_buff *frag_iter;
struct scatterlist sg; struct scatterlist sg;
int err;
/* Checksum header. */ /* Checksum header. */
if (copy > 0) { if (copy > 0) {
@ -742,28 +743,24 @@ int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc,
start = end; start = end;
} }
if (skb_shinfo(skb)->frag_list) { skb_walk_frags(skb, frag_iter) {
struct sk_buff *list = skb_shinfo(skb)->frag_list; int end;
for (; list; list = list->next) { WARN_ON(start > offset + len);
int end;
WARN_ON(start > offset + len); end = start + frag_iter->len;
if ((copy = end - offset) > 0) {
end = start + list->len; if (copy > len)
if ((copy = end - offset) > 0) { copy = len;
if (copy > len) err = skb_icv_walk(frag_iter, desc, offset-start,
copy = len; copy, icv_update);
err = skb_icv_walk(list, desc, offset-start, if (unlikely(err))
copy, icv_update); return err;
if (unlikely(err)) if ((len -= copy) == 0)
return err; return 0;
if ((len -= copy) == 0) offset += copy;
return 0;
offset += copy;
}
start = end;
} }
start = end;
} }
BUG_ON(len); BUG_ON(len);
return 0; return 0;