added backport for skb_put_padto

added backport for skb_put_padto to support kernel versions <= 3.19.x
This commit is contained in:
Sven Paulsen 2016-11-01 16:12:09 +01:00 committed by GitHub
parent bb9573f565
commit 5a8550c00e

View File

@ -20,4 +20,19 @@ struct udphdr;
# define skb_secmark(skb) 0
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)
{
unsigned int size = skb->len;
if (unlikely(size < len)) {
len -= size;
if (skb_pad(skb, len)) return -ENOMEM;
__skb_put(skb, len);
}
return 0;
}
#endif
#endif /* COMPAT_SKBUFF_H */