The functions to get and set the checksum pointers consistently across
different kernel versions had different interpretations of what the
csum_offset pointer was relative to, which is confusing, to say the least.
This makes the meaning be the same as skb->csum_offset in modern kernels
and updates the caller. For a given function the results were consistent
across kernel versions and the callers knew what the meaning should be, so
this doesn't actually fix any bugs.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
u16 *csum_start, u16 *csum_offset)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
- *csum_start = skb->csum_start - skb_headroom(skb);
+ *csum_start = skb->csum_start;
*csum_offset = skb->csum_offset;
#else
- *csum_start = skb_transport_header(skb) - skb->data;
+ *csum_start = skb_headroom(skb) + skb_transport_offset(skb);
*csum_offset = skb->csum;
#endif
}
u16 csum_start, csum_offset;
get_skb_csum_pointers(skb, &csum_start, &csum_offset);
+ csum_start -= skb_headroom(skb);
+
BUG_ON(csum_start >= skb_headlen(skb));
retval = skb_copy_and_csum_datagram(skb, csum_start, buf + csum_start,
copy_bytes - csum_start, &csum);