]> git.proxmox.com Git - ovs.git/commitdiff
compat: Fixups for some compile warnings and errors
authorGreg Rose <gvrose8192@gmail.com>
Mon, 5 Mar 2018 18:09:10 +0000 (10:09 -0800)
committerBen Pfaff <blp@ovn.org>
Tue, 22 May 2018 03:33:29 +0000 (20:33 -0700)
A lot of code has been pulled in.  Fix it up to make sure it compiles
correctly.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
datapath/linux/compat/gre.c
datapath/linux/compat/include/net/gre.h
datapath/linux/compat/ip_gre.c

index 08a5a300b50ea24ebc3f38539be0926eb3020aa9..7d16aeed54fb4323c2b900bd04df294397332791 100644 (file)
@@ -82,29 +82,6 @@ static __sum16 check_checksum(struct sk_buff *skb)
        return csum;
 }
 
-#define gre_flags_to_tnl_flags rpl_gre_flags_to_tnl_flags
-static __be16 gre_flags_to_tnl_flags(__be16 flags)
-{
-       __be16 tflags = 0;
-
-       if (flags & GRE_CSUM)
-               tflags |= TUNNEL_CSUM;
-       if (flags & GRE_ROUTING)
-               tflags |= TUNNEL_ROUTING;
-       if (flags & GRE_KEY)
-               tflags |= TUNNEL_KEY;
-       if (flags & GRE_SEQ)
-               tflags |= TUNNEL_SEQ;
-       if (flags & GRE_STRICT)
-               tflags |= TUNNEL_STRICT;
-       if (flags & GRE_REC)
-               tflags |= TUNNEL_REC;
-       if (flags & GRE_VERSION)
-               tflags |= TUNNEL_VERSION;
-
-       return tflags;
-}
-
 static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
                            bool *csum_err)
 {
index e2473f201cd192291c76185766afe522027a17ef..78422c83f256830f93f41d1dbde76d57501ae9e3 100644 (file)
@@ -31,7 +31,52 @@ static inline struct net_device *rpl_gretap_fb_dev_create(
 #include_next <net/gre.h>
 
 #define tnl_flags_to_gre_flags rpl_tnl_flags_to_gre_flags
-static inline __be16 tnl_flags_to_gre_flags(__be16 tflags)
+static inline __be16 rpl_tnl_flags_to_gre_flags(__be16 tflags)
+{
+       __be16 flags = 0;
+
+       if (tflags & TUNNEL_CSUM)
+               flags |= GRE_CSUM;
+       if (tflags & TUNNEL_ROUTING)
+               flags |= GRE_ROUTING;
+       if (tflags & TUNNEL_KEY)
+               flags |= GRE_KEY;
+       if (tflags & TUNNEL_SEQ)
+               flags |= GRE_SEQ;
+       if (tflags & TUNNEL_STRICT)
+               flags |= GRE_STRICT;
+       if (tflags & TUNNEL_REC)
+               flags |= GRE_REC;
+       if (tflags & TUNNEL_VERSION)
+               flags |= GRE_VERSION;
+
+       return flags;
+}
+
+#define gre_flags_to_tnl_flags rpl_gre_flags_to_tnl_flags
+static inline __be16 rpl_gre_flags_to_tnl_flags(__be16 flags)
+{
+       __be16 tflags = 0;
+
+       if (flags & GRE_CSUM)
+               tflags |= TUNNEL_CSUM;
+       if (flags & GRE_ROUTING)
+               tflags |= TUNNEL_ROUTING;
+       if (flags & GRE_KEY)
+               tflags |= TUNNEL_KEY;
+       if (flags & GRE_SEQ)
+               tflags |= TUNNEL_SEQ;
+       if (flags & GRE_STRICT)
+               tflags |= TUNNEL_STRICT;
+       if (flags & GRE_REC)
+               tflags |= TUNNEL_REC;
+       if (flags & GRE_VERSION)
+               tflags |= TUNNEL_VERSION;
+
+       return tflags;
+}
+#define gre_tnl_flags_to_gre_flags rpl_gre_tnl_flags_to_gre_flags
+static inline __be16 rpl_gre_tnl_flags_to_gre_flags(__be16 tflags)
 {
        __be16 flags = 0;
 
index b1493e06df1c69d22c4705d351034a58f83199d1..80600976bf9ca81108e21b1e075f0f58bdf53086 100644 (file)
@@ -190,7 +190,7 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
                      int gre_hdr_len)
 {
        struct net *net = dev_net(skb->dev);
-       struct metadata_dst tun_dst = NULL;
+       struct metadata_dst *tun_dst = NULL;
        struct erspan_base_hdr *ershdr;
        struct erspan_metadata *pkt_md;
        struct ip_tunnel_net *itn;
@@ -200,16 +200,15 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
        int len;
 
        itn = net_generic(net, erspan_net_id);
-       iph = ip_hdr(skb);
        len = gre_hdr_len + sizeof(*ershdr);
 
        /* Check based hdr len */
        if (unlikely(!pskb_may_pull(skb, len)))
-               return -ENOMEM;
+               return PACKET_REJECT;
 
        iph = ip_hdr(skb);
        ershdr = (struct erspan_base_hdr *)(skb->data + gre_hdr_len);
-       ver = (ntohs(ershdr->ver_vlan) & VER_MASK) >> VER_OFFSET;
+       ver = ershdr->ver;
 
        /* The original GRE header does not have key field,
         * Use ERSPAN 10-bit session ID as key.
@@ -1183,7 +1182,9 @@ static void ipgre_tunnel_setup(struct net_device *dev)
 static void ipgre_tap_setup(struct net_device *dev)
 {
        ether_setup(dev);
+#ifdef HAVE_NET_DEVICE_MAX_MTU
        dev->max_mtu = 0;
+#endif
        dev->netdev_ops         = &gre_tap_netdev_ops;
        dev->priv_flags         |= IFF_LIVE_ADDR_CHANGE;
        ip_tunnel_setup(dev, gre_tap_net_id);