diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/skbuff.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 1e71764be4a4..a48b08681261 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -448,11 +448,12 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask) | |||
448 | 448 | ||
449 | static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | 449 | static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) |
450 | { | 450 | { |
451 | #ifndef NET_SKBUFF_DATA_USES_OFFSET | ||
451 | /* | 452 | /* |
452 | * Shift between the two data areas in bytes | 453 | * Shift between the two data areas in bytes |
453 | */ | 454 | */ |
454 | unsigned long offset = new->data - old->data; | 455 | unsigned long offset = new->data - old->data; |
455 | 456 | #endif | |
456 | new->sk = NULL; | 457 | new->sk = NULL; |
457 | new->dev = old->dev; | 458 | new->dev = old->dev; |
458 | new->priority = old->priority; | 459 | new->priority = old->priority; |
@@ -461,9 +462,15 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
461 | #ifdef CONFIG_INET | 462 | #ifdef CONFIG_INET |
462 | new->sp = secpath_get(old->sp); | 463 | new->sp = secpath_get(old->sp); |
463 | #endif | 464 | #endif |
464 | new->transport_header = old->transport_header + offset; | 465 | new->transport_header = old->transport_header; |
465 | new->network_header = old->network_header + offset; | 466 | new->network_header = old->network_header; |
466 | new->mac_header = old->mac_header + offset; | 467 | new->mac_header = old->mac_header; |
468 | #ifndef NET_SKBUFF_DATA_USES_OFFSET | ||
469 | /* {transport,network,mac}_header are relative to skb->head */ | ||
470 | new->transport_header += offset; | ||
471 | new->network_header += offset; | ||
472 | new->mac_header += offset; | ||
473 | #endif | ||
467 | memcpy(new->cb, old->cb, sizeof(old->cb)); | 474 | memcpy(new->cb, old->cb, sizeof(old->cb)); |
468 | new->local_df = old->local_df; | 475 | new->local_df = old->local_df; |
469 | new->fclone = SKB_FCLONE_UNAVAILABLE; | 476 | new->fclone = SKB_FCLONE_UNAVAILABLE; |
@@ -639,9 +646,12 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | |||
639 | skb->end = data + size; | 646 | skb->end = data + size; |
640 | skb->data += off; | 647 | skb->data += off; |
641 | skb->tail += off; | 648 | skb->tail += off; |
649 | #ifndef NET_SKBUFF_DATA_USES_OFFSET | ||
650 | /* {transport,network,mac}_header are relative to skb->head */ | ||
642 | skb->transport_header += off; | 651 | skb->transport_header += off; |
643 | skb->network_header += off; | 652 | skb->network_header += off; |
644 | skb->mac_header += off; | 653 | skb->mac_header += off; |
654 | #endif | ||
645 | skb->cloned = 0; | 655 | skb->cloned = 0; |
646 | skb->nohdr = 0; | 656 | skb->nohdr = 0; |
647 | atomic_set(&skb_shinfo(skb)->dataref, 1); | 657 | atomic_set(&skb_shinfo(skb)->dataref, 1); |