: Fix missing offset adjustment in skb_copy_expand
Subsystems (2)
[SK_BUFF]: Fix missing offset adjustment in skb_copy_expand
skb_copy_expand changes the headroom, so it needs to adjust the header offsets by the difference between the old and the new value.
---
commit 9cb76fae709a9303777286998baa457b0730a225
tree 2ea619c7daf9c5e6829dad6d502386eb9c922700
parent fb98b03719ad23840ca005edbba3c86ef1e3282c
author Patrick McHardy <[email protected]> Sun, 08 Apr 2007 03:36:49 +0200 committer Patrick McHardy <[email protected]> Sun, 08 Apr 2007 03:36:49 +0200
net/core/skbuff.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
net/core/skbuff.c +10 -1
@@ -794,7 +794,9 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,*/ struct sk_buff *n =alloc_skb (newheadroom + skb->len + newtailroom, gfp_mask); +int oldheadroom =skb_headroom (skb);int head_copy_len, head_copy_off; +int off =0 ;if (!n)return NULL ;
@@ -804,7 +806,7 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,/* Set the tail pointer and length */ skb_put (n, skb->len); - head_copy_len =skb_headroom (skb); + head_copy_len = oldheadroom; head_copy_off =0 ;if (newheadroom <= head_copy_len) head_copy_len = newheadroom;
@@ -818,6 +820,13 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,copy_skb_header (n, skb); +#ifdef NET_SKBUFF_DATA_USES_OFFSET + off = newheadroom - oldheadroom; +#endif + n->transport_header += off; + n->network_header += off; + n->mac_header += off; +return n; }
Hi Dave,
Quoted 4 lines · Patrick McHardy
[
SK_BUFF]: Fix missing offset adjustment inskb_copy_expand
skb_copy_expandchanges the headroom, so it needs to adjust the header offsets by the difference between the old and the new value.
it seems like you missed this one. Attached again for your convenience.
[SK_BUFF]: Fix missing offset adjustment in skb_copy_expand
skb_copy_expand changes the headroom, so it needs to adjust the header offsets by the difference between the old and the new value.
---
commit 9cb76fae709a9303777286998baa457b0730a225
tree 2ea619c7daf9c5e6829dad6d502386eb9c922700
parent fb98b03719ad23840ca005edbba3c86ef1e3282c
author Patrick McHardy <[email protected]> Sun, 08 Apr 2007 03:36:49 +0200 committer Patrick McHardy <[email protected]> Sun, 08 Apr 2007 03:36:49 +0200
net/core/skbuff.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
net/core/skbuff.c +10 -1
@@ -794,7 +794,9 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,*/ struct sk_buff *n =alloc_skb (newheadroom + skb->len + newtailroom, gfp_mask); +int oldheadroom =skb_headroom (skb);int head_copy_len, head_copy_off; +int off =0 ;if (!n)return NULL ;
@@ -804,7 +806,7 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,/* Set the tail pointer and length */ skb_put (n, skb->len); - head_copy_len =skb_headroom (skb); + head_copy_len = oldheadroom; head_copy_off =0 ;if (newheadroom <= head_copy_len) head_copy_len = newheadroom;
@@ -818,6 +820,13 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,copy_skb_header (n, skb); +#ifdef NET_SKBUFF_DATA_USES_OFFSET + off = newheadroom - oldheadroom; +#endif + n->transport_header += off; + n->network_header += off; + n->mac_header += off; +return n; }
David Miller
maintainerFrom: Patrick McHardy <[email protected]>
Date: Wed, 11 Apr 2007 02:42:59 +0200
Quoted 10 lines
Hi Dave,
Quoted 4 lines · Patrick McHardy
[
SK_BUFF]: Fix missing offset adjustment inskb_copy_expand
skb_copy_expandchanges the headroom, so it needs to adjust the header offsets by the difference between the old and the new value.it seems like you missed this one. Attached again for your convenience.
Thanks a lot Patrick, applied.
I know what happened, I applied the pskb_copy_expand() patch and then deleted this one by accident since the subject lines looked so similar and I figured I was just getting a second copy of the same patch :-)
Thanks again!