On 29 January 2016 at 15:44, pravin shelar <pshe...@ovn.org> wrote:
> On Mon, Jan 11, 2016 at 5:53 PM, Joe Stringer <j...@ovn.org> wrote:
>> This function is a likely candidate for backporting, and currently
>> relies on version checks to include the source or not. Grep for the
>> appropriate functions instead, and include the backport based on that.
>>
>> Signed-off-by: Joe Stringer <j...@ovn.org>
>> ---
>>  acinclude.m4                                               |  4 ++++
>>  .../compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h     | 14 
>> ++++++++++++--
>>  datapath/linux/compat/nf_conntrack_reasm.c                 |  6 +++---
>>  3 files changed, 19 insertions(+), 5 deletions(-)
>>
>> diff --git a/acinclude.m4 b/acinclude.m4
>> index f0ea2fcea62d..7357a9fdfc74 100644
>> --- a/acinclude.m4
>> +++ b/acinclude.m4
>> @@ -404,6 +404,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
>>                    [nf_ct_zone_init])
>>    OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_labels.h],
>>                    [nf_connlabels_get])
>> +  OVS_GREP_IFELSE([$KSRC/include/net/netfilter/ipv6/nf_defrag_ipv6.h],
>> +                  [nf_ct_frag6_consume_orig])
>> +  OVS_GREP_IFELSE([$KSRC/include/net/netfilter/ipv6/nf_defrag_ipv6.h],
>> +                  [nf_ct_frag6_output])
>>
>>    OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32])
>>    OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max])
>> diff --git 
>> a/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h 
>> b/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h
>> index 7d51491a9c1b..97052ccc4d99 100644
>> --- a/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h
>> +++ b/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h
>> @@ -7,8 +7,14 @@
>>  #include_next <net/netfilter/ipv6/nf_defrag_ipv6.h>
>>  #endif
>>
>> -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
>> +/* Upstream commit 029f7f3b8701 ("netfilter: ipv6: nf_defrag: avoid/free 
>> clone
>> + * operations") changed the semantics of nf_ct_frag6_gather(), so we 
>> backport
>> + * it for all prior kernels.
>> + */
>> +#if defined(HAVE_NF_CT_FRAG6_CONSUME_ORIG) || \
>> +    defined(HAVE_NF_CT_FRAG6_OUTPUT)
>>  #if defined(OVS_FRAGMENT_BACKPORT)
>> +#define OVS_NF_DEFRAG6_BACKPORT 1
>>  struct sk_buff *rpl_nf_ct_frag6_gather(struct sk_buff *skb, u32 user);
>>  int __init rpl_nf_ct_frag6_init(void);
>>  void rpl_nf_ct_frag6_cleanup(void);
>> @@ -24,9 +30,13 @@ static inline void rpl_nf_ct_frag6_cleanup(void) { }
>>  static inline void rpl_nf_ct_frag6_consume_orig(struct sk_buff *skb) { }
>>  #endif /* OVS_FRAGMENT_BACKPORT */
>>  #define nf_ct_frag6_gather rpl_nf_ct_frag6_gather
>> +#else /* HAVE_NF_CT_FRAG6_CONSUME_ORIG */
>> +static inline int __init rpl_nf_ct_frag6_init(void) { return 0; }
>> +static inline void rpl_nf_ct_frag6_cleanup(void) { }
>> +static inline void rpl_nf_ct_frag6_consume_orig(struct sk_buff *skb) { }
>> +#endif /* HAVE_NF_CT_FRAG6_CONSUME_ORIG */
>>  #define nf_ct_frag6_init rpl_nf_ct_frag6_init
>>  #define nf_ct_frag6_cleanup rpl_nf_ct_frag6_cleanup
>>  #define nf_ct_frag6_consume_orig rpl_nf_ct_frag6_consume_orig
>> -#endif /* < 4.3 */
>>
>>  #endif /* __NF_DEFRAG_IPV6_WRAPPER_H */
>> diff --git a/datapath/linux/compat/nf_conntrack_reasm.c 
>> b/datapath/linux/compat/nf_conntrack_reasm.c
>> index 89a39789d322..fec9e5794f88 100644
>> --- a/datapath/linux/compat/nf_conntrack_reasm.c
>> +++ b/datapath/linux/compat/nf_conntrack_reasm.c
>> @@ -21,8 +21,6 @@
>>
>>  #include <linux/version.h>
>>
>> -#ifdef OVS_FRAGMENT_BACKPORT
>> -
>>  #include <linux/errno.h>
>>  #include <linux/types.h>
>>  #include <linux/string.h>
>> @@ -56,6 +54,8 @@
>>  #include <linux/module.h>
>>  #include <net/netfilter/ipv6/nf_defrag_ipv6.h>
>>
>> +#ifdef OVS_NF_DEFRAG6_BACKPORT
>> +
>>  static const char nf_frags_cache_name[] = "nf-frags";
>>
>
> This is not related to this patch, But we should use different cache
> name to avoid confusion in case both kmem caches are created.

Sure, I will follow up on this.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to