compat: Backport IPv6 fragmentation.
[cascardo/ovs.git] / datapath / linux / compat / include / linux / netfilter_ipv6.h
1 #ifndef __NETFILTER_IPV6_WRAPPER_H
2 #define __NETFILTER_IPV6_WRAPPER_H 1
3
4 #include_next <linux/netfilter_ipv6.h>
5
6 #include <linux/version.h>
7 #include <net/ip.h>             /* For OVS_VPORT_OUTPUT_PARAMS */
8 #include <net/ip6_route.h>
9
10 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
11 /* Try to minimise changes required to the actions.c code for calling IPv6
12  * fragmentation. We can keep the fragment() API mostly the same, except that
13  * the callback parameter needs to be in the form that older kernels accept.
14  * We don't backport the other ipv6_ops as they're currently unused by OVS. */
15 struct ovs_nf_ipv6_ops {
16         int (*fragment)(struct sock *sk, struct sk_buff *skb,
17                         int (*output)(OVS_VPORT_OUTPUT_PARAMS));
18 };
19 #define nf_ipv6_ops ovs_nf_ipv6_ops
20
21 #if defined(OVS_FRAGMENT_BACKPORT)
22 static struct ovs_nf_ipv6_ops ovs_ipv6_ops = {
23         .fragment = ip6_fragment,
24 };
25
26 static inline struct ovs_nf_ipv6_ops *ovs_nf_get_ipv6_ops(void)
27 {
28         return &ovs_ipv6_ops;
29 }
30 #else /* !OVS_FRAGMENT_BACKPORT || !CONFIG_NETFILTER || || !CONFIG_IPV6 */
31 static inline const struct ovs_nf_ipv6_ops *ovs_nf_get_ipv6_ops(void)
32 {
33         return NULL;
34 }
35 #endif
36 #define nf_get_ipv6_ops ovs_nf_get_ipv6_ops
37
38 #endif /* < 4.3 */
39 #endif /* __NETFILTER_IPV6_WRAPPER_H */