compat: Detect and use nf_ct_frag6_gather().
[cascardo/ovs.git] / datapath / linux / compat / include / net / netfilter / ipv6 / nf_defrag_ipv6.h
1 #ifndef _NF_DEFRAG_IPV6_WRAPPER_H
2 #define _NF_DEFRAG_IPV6_WRAPPER_H
3
4 #include <linux/kconfig.h>
5
6 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
7 #include_next <net/netfilter/ipv6/nf_defrag_ipv6.h>
8 #endif
9
10 /* Upstream commit 029f7f3b8701 ("netfilter: ipv6: nf_defrag: avoid/free clone
11  * operations") changed the semantics of nf_ct_frag6_gather(), so we backport
12  * it for all prior kernels.
13  */
14 #if defined(HAVE_NF_CT_FRAG6_CONSUME_ORIG) || \
15     defined(HAVE_NF_CT_FRAG6_OUTPUT)
16 #if defined(OVS_FRAGMENT_BACKPORT)
17 #define OVS_NF_DEFRAG6_BACKPORT 1
18 struct sk_buff *rpl_nf_ct_frag6_gather(struct sk_buff *skb, u32 user);
19 int __init rpl_nf_ct_frag6_init(void);
20 void rpl_nf_ct_frag6_cleanup(void);
21 void rpl_nf_ct_frag6_consume_orig(struct sk_buff *skb);
22 #else /* !OVS_FRAGMENT_BACKPORT */
23 static inline struct sk_buff *rpl_nf_ct_frag6_gather(struct sk_buff *skb,
24                                                      u32 user)
25 {
26         return skb;
27 }
28 static inline int __init rpl_nf_ct_frag6_init(void) { return 0; }
29 static inline void rpl_nf_ct_frag6_cleanup(void) { }
30 static inline void rpl_nf_ct_frag6_consume_orig(struct sk_buff *skb) { }
31 #endif /* OVS_FRAGMENT_BACKPORT */
32 #define nf_ct_frag6_gather rpl_nf_ct_frag6_gather
33 #else /* HAVE_NF_CT_FRAG6_CONSUME_ORIG */
34 static inline int __init rpl_nf_ct_frag6_init(void) { return 0; }
35 static inline void rpl_nf_ct_frag6_cleanup(void) { }
36 static inline void rpl_nf_ct_frag6_consume_orig(struct sk_buff *skb) { }
37 #endif /* HAVE_NF_CT_FRAG6_CONSUME_ORIG */
38 #define nf_ct_frag6_init rpl_nf_ct_frag6_init
39 #define nf_ct_frag6_cleanup rpl_nf_ct_frag6_cleanup
40 #define nf_ct_frag6_consume_orig rpl_nf_ct_frag6_consume_orig
41
42 #endif /* __NF_DEFRAG_IPV6_WRAPPER_H */