diff options
Diffstat (limited to 'include/linux/filter.h')
-rw-r--r-- | include/linux/filter.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index a7e3c48d73a7..b885dcb7eaca 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -6,6 +6,7 @@ #include <linux/atomic.h> #include <linux/compat.h> +#include <linux/skbuff.h> #include <linux/workqueue.h> #include <uapi/linux/filter.h> @@ -406,6 +407,18 @@ static inline u16 bpf_anc_helper(const struct sock_filter *ftest) } } +void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, + int k, unsigned int size); + +static inline void *bpf_load_pointer(const struct sk_buff *skb, int k, + unsigned int size, void *buffer) +{ + if (k >= 0) + return skb_header_pointer(skb, k, size, buffer); + + return bpf_internal_load_pointer_neg_helper(skb, k, size); +} + #ifdef CONFIG_BPF_JIT #include <stdarg.h> #include <linux/linkage.h> |