If we need to make a copy we add a little bit extra to the headroom
that we think we need in order to avoid future copies. Previously we
would always just allocate max(headroom, 64) which is generally
enough space. However, if we are using IPsec our expected headroom
is large and there is no extra. Instead, it is better to just tack on
a few extra bytes so we'll always have a cushion.
check_headroom(struct sk_buff *skb, int headroom)
{
if (skb_headroom(skb) < headroom || skb_header_cloned(skb)) {
- struct sk_buff *nskb = skb_realloc_headroom(skb, max(headroom, 64));
+ struct sk_buff *nskb = skb_realloc_headroom(skb, headroom + 16);
if (!nskb) {
kfree_skb(skb);
return ERR_PTR(-ENOMEM);