diff options
author | Joe Stringer <joe@ovn.org> | 2015-12-24 11:32:38 -0800 |
---|---|---|
committer | Joe Stringer <joe@ovn.org> | 2016-02-02 14:26:46 -0800 |
commit | e4e04c3b6bf5209592d2a6db96c7905d2bb9133e (patch) | |
tree | 3251f166da720c883ae02e62356d10653900d04f /datapath | |
parent | ac9cd0d28a6590136a9f69ad1e3785039b35b39e (diff) | |
download | openvswitch-e4e04c3b6bf5209592d2a6db96c7905d2bb9133e.tar.gz |
compat: Detect and use nf_ipv6_ops->fragment.
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Diffstat (limited to 'datapath')
-rw-r--r-- | datapath/compat.h | 5 | ||||
-rw-r--r-- | datapath/linux/compat/include/linux/netfilter_ipv6.h | 6 | ||||
-rw-r--r-- | datapath/linux/compat/include/net/ip6_route.h | 13 | ||||
-rw-r--r-- | datapath/linux/compat/ip6_output.c | 2 |
4 files changed, 16 insertions, 10 deletions
diff --git a/datapath/compat.h b/datapath/compat.h index 3cbd121f2..0e19051fb 100644 --- a/datapath/compat.h +++ b/datapath/compat.h @@ -55,8 +55,13 @@ static inline bool skb_encapsulation(struct sk_buff *skb) #endif #ifdef OVS_FRAGMENT_BACKPORT +#ifdef HAVE_NF_IPV6_OPS_FRAGMENT +static inline int __init ip6_output_init(void) { return 0; } +static inline void ip6_output_exit(void) { } +#else int __init ip6_output_init(void); void ip6_output_exit(void); +#endif static inline int __init compat_init(void) { diff --git a/datapath/linux/compat/include/linux/netfilter_ipv6.h b/datapath/linux/compat/include/linux/netfilter_ipv6.h index 3026e1fe6..3939e1423 100644 --- a/datapath/linux/compat/include/linux/netfilter_ipv6.h +++ b/datapath/linux/compat/include/linux/netfilter_ipv6.h @@ -7,7 +7,7 @@ #include <net/ip.h> /* For OVS_VPORT_OUTPUT_PARAMS */ #include <net/ip6_route.h> -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) +#ifndef HAVE_NF_IPV6_OPS_FRAGMENT /* Try to minimise changes required to the actions.c code for calling IPv6 * fragmentation. We can keep the fragment() API mostly the same, except that * the callback parameter needs to be in the form that older kernels accept. @@ -27,7 +27,7 @@ static inline struct ovs_nf_ipv6_ops *ovs_nf_get_ipv6_ops(void) { return &ovs_ipv6_ops; } -#else /* !OVS_FRAGMENT_BACKPORT || !CONFIG_NETFILTER || || !CONFIG_IPV6 */ +#else /* !OVS_FRAGMENT_BACKPORT */ static inline const struct ovs_nf_ipv6_ops *ovs_nf_get_ipv6_ops(void) { return NULL; @@ -35,5 +35,5 @@ static inline const struct ovs_nf_ipv6_ops *ovs_nf_get_ipv6_ops(void) #endif #define nf_get_ipv6_ops ovs_nf_get_ipv6_ops -#endif /* < 4.3 */ +#endif /* HAVE_NF_IPV6_OPS_FRAGMENT */ #endif /* __NETFILTER_IPV6_WRAPPER_H */ diff --git a/datapath/linux/compat/include/net/ip6_route.h b/datapath/linux/compat/include/net/ip6_route.h index ba7dcc58f..16027e47e 100644 --- a/datapath/linux/compat/include/net/ip6_route.h +++ b/datapath/linux/compat/include/net/ip6_route.h @@ -30,18 +30,19 @@ struct dst_entry *rpl_ip6_route_output(struct net *net, const struct sock *sk, #endif /* 2.6.39 */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) +#ifndef HAVE_NF_IPV6_OPS_FRAGMENT +#ifdef OVS_FRAGMENT_BACKPORT +int rpl_ip6_fragment(struct sock *sk, struct sk_buff *skb, + int (*output)(OVS_VPORT_OUTPUT_PARAMS)); +#else static inline int rpl_ip6_fragment(struct sock *sk, struct sk_buff *skb, int (*output)(struct sk_buff *)) { kfree_skb(skb); return -ENOTSUPP; } -#define ip6_fragment rpl_ip6_fragment -#elif defined(OVS_FRAGMENT_BACKPORT) -int rpl_ip6_fragment(struct sock *sk, struct sk_buff *skb, - int (*output)(OVS_VPORT_OUTPUT_PARAMS)); -#define ip6_fragment rpl_ip6_fragment #endif /* OVS_FRAGMENT_BACKPORT */ +#define ip6_fragment rpl_ip6_fragment +#endif /* HAVE_NF_IPV6_OPS_FRAGMENT */ #endif /* _NET_IP6_ROUTE_WRAPPER */ diff --git a/datapath/linux/compat/ip6_output.c b/datapath/linux/compat/ip6_output.c index 5c0cdec4b..c3ef46c4a 100644 --- a/datapath/linux/compat/ip6_output.c +++ b/datapath/linux/compat/ip6_output.c @@ -31,7 +31,7 @@ #include <linux/version.h> -#ifdef OVS_FRAGMENT_BACKPORT +#if !defined(HAVE_NF_IPV6_OPS_FRAGMENT) && defined(OVS_FRAGMENT_BACKPORT) #include <linux/errno.h> #include <linux/kernel.h> |