[ovs-dev] [PATCHv2] gre: Fix GRE loading bug by separating ERSPAN from tunnel

Gregory Rose gvrose8192 at gmail.com
Fri Jun 29 17:06:02 UTC 2018


On 6/28/2018 6:40 AM, Yifeng Sun wrote:
> On kernel versions (for example, 3.10) where upstream provides GRE
> functionality but no ERSPAN, GRE can fail to initialize. Because
> there is no ERSPAN feature in kernel, openvswitch kernel module will
> try to register its own IPPROTO_GRE, instead of using the upstream
> GRE functionality. But GRE could already be added by kernel's gre
> module. As a result, there will be GRE-related failures.
>
> This patch separates the detection of tunnel and ERSPAN so that the
> result of ERSPAN detection in kernel doesn't affect tunnel functionality.
>
> This fix passed the travis for different kernel versions:
> https://travis-ci.org/yifsun/ovs-travis/builds/397915843
>
> Signed-off-by: Yifeng Sun <pkusunyifeng at gmail.com>

Yifeng,

Thanks for the patch and attempting to fix this issue.  This is not 
quite what we need though because
it disables ERSPAN support on RHEL 7.x kernels entirely!

You're running into the same problem I've been dealing with in which we 
need so support ERSPAN over
GRE tunnels but also need to deal with conflicts from previous versions 
of OVS that used the RHEL 7.x
built-in kernel GRE protocol drivers.

It's a difficult issue.  But a solution where we can still support 
ERSPAN over GRE tunnels is required.
Let's take this offline and talk about it some more.

Thanks,

- Greg
> ---
> v1 -> v2: remove linux version checking and add HAVE_METADATA_IP_TUNNEL
>            checking according to Greg's review.
>
>   acinclude.m4                                     | 7 +++++--
>   datapath/linux/compat/include/net/dst_metadata.h | 6 ++++++
>   datapath/linux/compat/include/net/erspan.h       | 2 +-
>   3 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/acinclude.m4 b/acinclude.m4
> index 991a6275b978..e58de8f81210 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -531,9 +531,12 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
>                           [OVS_GREP_IFELSE([$KSRC/include/net/ip_tunnels.h],
>                                            [iptunnel_pull_offloads],
>                           [OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], [dst_cache],
> -                        [OVS_GREP_IFELSE([$KSRC/include/net/erspan.h], [erspan_md2],
> -                                         [OVS_DEFINE([USE_UPSTREAM_TUNNEL])])])])])
> +                                         [OVS_DEFINE([USE_UPSTREAM_TUNNEL])])])])
>   
> +  OVS_GREP_IFELSE([$KSRC/include/net/erspan.h], [erspan_md2],
> +                  [OVS_DEFINE([USE_UPSTREAM_ERSPAN])])
> +  OVS_GREP_IFELSE([$KSRC/include/net/dst_metadata.h], [enum metadata_type],
> +                  [OVS_DEFINE([HAVE_METADATA_IP_TUNNEL])])
>     OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], [dst_cache],
>                     [OVS_DEFINE([USE_BUILTIN_DST_CACHE])])
>     OVS_GREP_IFELSE([$KSRC/include/net/mpls.h], [mpls_hdr],
> diff --git a/datapath/linux/compat/include/net/dst_metadata.h b/datapath/linux/compat/include/net/dst_metadata.h
> index e53a29ed2222..54f3ffb0aa11 100644
> --- a/datapath/linux/compat/include/net/dst_metadata.h
> +++ b/datapath/linux/compat/include/net/dst_metadata.h
> @@ -1,10 +1,12 @@
>   #ifndef __NET_DST_METADATA_WRAPPER_H
>   #define __NET_DST_METADATA_WRAPPER_H 1
>   
> +#ifndef HAVE_METADATA_IP_TUNNEL
>   enum metadata_type {
>   	METADATA_IP_TUNNEL,
>   	METADATA_HW_PORT_MUX,
>   };
> +#endif
>   
>   #ifdef USE_UPSTREAM_TUNNEL
>   #include_next <net/dst_metadata.h>
> @@ -119,7 +121,11 @@ void ovs_ip_tunnel_rcv(struct net_device *dev, struct sk_buff *skb,
>   static inline struct metadata_dst *
>   rpl_metadata_dst_alloc(u8 optslen, enum metadata_type type, gfp_t flags)
>   {
> +#ifdef HAVE_METADATA_IP_TUNNEL
> +	return metadata_dst_alloc(optslen, type, flags);
> +#else
>   	return metadata_dst_alloc(optslen, flags);
> +#endif
>   }
>   #define metadata_dst_alloc rpl_metadata_dst_alloc
>   
> diff --git a/datapath/linux/compat/include/net/erspan.h b/datapath/linux/compat/include/net/erspan.h
> index 9fdae97b5fc4..f3035b678e87 100644
> --- a/datapath/linux/compat/include/net/erspan.h
> +++ b/datapath/linux/compat/include/net/erspan.h
> @@ -1,4 +1,4 @@
> -#ifndef USE_UPSTREAM_TUNNEL
> +#ifndef USE_UPSTREAM_ERSPAN
>   #ifndef __LINUX_ERSPAN_H
>   #define __LINUX_ERSPAN_H
>   



More information about the dev mailing list