diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-02-04 11:00:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-02-04 11:00:54 -0500 |
commit | 93890b71a34f9490673a6edd56b61c2124215e46 (patch) | |
tree | c5d82620f2cb69f0bf43639e63f54b0c0e2eb744 /net/core | |
parent | f5bb3a5e9dcdb8435471562b6cada89525cf4df1 (diff) | |
parent | 6b35e40767c6c1ac783330109ae8e0c09ea6bc82 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: (25 commits)
virtio: balloon driver
virtio: Use PCI revision field to indicate virtio PCI ABI version
virtio: PCI device
virtio_blk: implement naming for vda-vdz,vdaa-vdzz,vdaaa-vdzzz
virtio_blk: Dont waste major numbers
virtio_blk: provide getgeo
virtio_net: parametrize the napi_weight for virtio receive queue.
virtio: free transmit skbs when notified, not on next xmit.
virtio: flush buffers on open
virtnet: remove double ether_setup
virtio: Allow virtio to be modular and used by modules
virtio: Use the sg_phys convenience function.
virtio: Put the virtio under the virtualization menu
virtio: handle interrupts after callbacks turned off
virtio: reset function
virtio: populate network rings in the probe routine, not open
virtio: Tweak virtio_net defines
virtio: Net header needs hdr_len
virtio: remove unused id field from struct virtio_blk_outhdr
virtio: clarify NO_NOTIFY flag usage
...
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/skbuff.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 98420f9c4b6d..4e354221ec23 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2461,6 +2461,34 @@ int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer) | |||
2461 | return elt; | 2461 | return elt; |
2462 | } | 2462 | } |
2463 | 2463 | ||
2464 | /** | ||
2465 | * skb_partial_csum_set - set up and verify partial csum values for packet | ||
2466 | * @skb: the skb to set | ||
2467 | * @start: the number of bytes after skb->data to start checksumming. | ||
2468 | * @off: the offset from start to place the checksum. | ||
2469 | * | ||
2470 | * For untrusted partially-checksummed packets, we need to make sure the values | ||
2471 | * for skb->csum_start and skb->csum_offset are valid so we don't oops. | ||
2472 | * | ||
2473 | * This function checks and sets those values and skb->ip_summed: if this | ||
2474 | * returns false you should drop the packet. | ||
2475 | */ | ||
2476 | bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off) | ||
2477 | { | ||
2478 | if (unlikely(start > skb->len - 2) || | ||
2479 | unlikely((int)start + off > skb->len - 2)) { | ||
2480 | if (net_ratelimit()) | ||
2481 | printk(KERN_WARNING | ||
2482 | "bad partial csum: csum=%u/%u len=%u\n", | ||
2483 | start, off, skb->len); | ||
2484 | return false; | ||
2485 | } | ||
2486 | skb->ip_summed = CHECKSUM_PARTIAL; | ||
2487 | skb->csum_start = skb_headroom(skb) + start; | ||
2488 | skb->csum_offset = off; | ||
2489 | return true; | ||
2490 | } | ||
2491 | |||
2464 | EXPORT_SYMBOL(___pskb_trim); | 2492 | EXPORT_SYMBOL(___pskb_trim); |
2465 | EXPORT_SYMBOL(__kfree_skb); | 2493 | EXPORT_SYMBOL(__kfree_skb); |
2466 | EXPORT_SYMBOL(kfree_skb); | 2494 | EXPORT_SYMBOL(kfree_skb); |
@@ -2497,3 +2525,4 @@ EXPORT_SYMBOL(skb_append_datato_frags); | |||
2497 | 2525 | ||
2498 | EXPORT_SYMBOL_GPL(skb_to_sgvec); | 2526 | EXPORT_SYMBOL_GPL(skb_to_sgvec); |
2499 | EXPORT_SYMBOL_GPL(skb_cow_data); | 2527 | EXPORT_SYMBOL_GPL(skb_cow_data); |
2528 | EXPORT_SYMBOL_GPL(skb_partial_csum_set); | ||