compat: Document nf_defrag_ipv[46] backport.
[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 #define OVS_NF_DEFRAG6_BACKPORT 1
17 int rpl_nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user);
18 #define nf_ct_frag6_gather rpl_nf_ct_frag6_gather
19
20 /* If backporting IPv6 defrag, then init/exit functions need to be called from
21  * compat_{in,ex}it() to prepare the backported fragmentation cache. In this
22  * case we declare the functions which are defined in
23  * datapath/linux/compat/nf_conntrack_reasm.c.
24  *
25  * Otherwise, if we can use upstream defrag then we can rely on the upstream
26  * nf_defrag_ipv6 module to init/exit correctly. In this case the calls in
27  * compat_{in,ex}it() can be no-ops.
28  */
29 int __init rpl_nf_ct_frag6_init(void);
30 void rpl_nf_ct_frag6_cleanup(void);
31 #else /* !OVS_NF_DEFRAG6_BACKPORT */
32 static inline int __init rpl_nf_ct_frag6_init(void) { return 0; }
33 static inline void rpl_nf_ct_frag6_cleanup(void) { }
34 #endif /* OVS_NF_DEFRAG6_BACKPORT */
35 #define nf_ct_frag6_init rpl_nf_ct_frag6_init
36 #define nf_ct_frag6_cleanup rpl_nf_ct_frag6_cleanup
37
38 #endif /* __NF_DEFRAG_IPV6_WRAPPER_H */