diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-02-05 05:49:54 +0100 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-02-04 13:49:56 +0100 |
commit | f35d9d8aae08940b7fdd1bb8110619da2ece6b28 (patch) | |
tree | 562d8d7a6583d0a0750ec8d996026b73e8315421 /drivers/net/virtio_net.c | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6 (diff) | |
download | linux-f35d9d8aae08940b7fdd1bb8110619da2ece6b28.tar.xz linux-f35d9d8aae08940b7fdd1bb8110619da2ece6b28.zip |
virtio: Implement skb_partial_csum_set, for setting partial csums on untrusted packets.
Use it in virtio_net (replacing buggy version there), it's also going
to be used by TAP for partial csum support.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 5413dbf3d4ac..a60505c8f82a 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -83,17 +83,8 @@ static void receive_skb(struct net_device *dev, struct sk_buff *skb, if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { pr_debug("Needs csum!\n"); - skb->ip_summed = CHECKSUM_PARTIAL; - skb->csum_start = hdr->csum_start; - skb->csum_offset = hdr->csum_offset; - if (skb->csum_start > skb->len - 2 - || skb->csum_offset > skb->len - 2) { - if (net_ratelimit()) - printk(KERN_WARNING "%s: csum=%u/%u len=%u\n", - dev->name, skb->csum_start, - skb->csum_offset, skb->len); + if (!skb_partial_csum_set(skb,hdr->csum_start,hdr->csum_offset)) goto frame_err; - } } if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { |