Skip to content

Commit 08303c1

Browse files
Ilya Lesokhindavem330
authored andcommitted
net: Rename and export copy_skb_header
copy_skb_header is renamed to skb_copy_header and exported. Exposing this function give more flexibility in copying SKBs. skb_copy and skb_copy_expand do not give enough control over which parts are copied. Signed-off-by: Ilya Lesokhin <[email protected]> Signed-off-by: Boris Pismenny <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6dac152 commit 08303c1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

include/linux/skbuff.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,7 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
10341034
struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
10351035
int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
10361036
struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority);
1037+
void skb_copy_header(struct sk_buff *new, const struct sk_buff *old);
10371038
struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority);
10381039
struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom,
10391040
gfp_t gfp_mask, bool fclone);

net/core/skbuff.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,14 +1305,15 @@ static void skb_headers_offset_update(struct sk_buff *skb, int off)
13051305
skb->inner_mac_header += off;
13061306
}
13071307

1308-
static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
1308+
void skb_copy_header(struct sk_buff *new, const struct sk_buff *old)
13091309
{
13101310
__copy_skb_header(new, old);
13111311

13121312
skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size;
13131313
skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs;
13141314
skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type;
13151315
}
1316+
EXPORT_SYMBOL(skb_copy_header);
13161317

13171318
static inline int skb_alloc_rx_flag(const struct sk_buff *skb)
13181319
{
@@ -1355,7 +1356,7 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
13551356

13561357
BUG_ON(skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len));
13571358

1358-
copy_skb_header(n, skb);
1359+
skb_copy_header(n, skb);
13591360
return n;
13601361
}
13611362
EXPORT_SYMBOL(skb_copy);
@@ -1419,7 +1420,7 @@ struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom,
14191420
skb_clone_fraglist(n);
14201421
}
14211422

1422-
copy_skb_header(n, skb);
1423+
skb_copy_header(n, skb);
14231424
out:
14241425
return n;
14251426
}
@@ -1599,7 +1600,7 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
15991600
BUG_ON(skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
16001601
skb->len + head_copy_len));
16011602

1602-
copy_skb_header(n, skb);
1603+
skb_copy_header(n, skb);
16031604

16041605
skb_headers_offset_update(n, newheadroom - oldheadroom);
16051606

0 commit comments

Comments
 (0)