*/
#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <net/arp.h>
#include <net/ndisc.h>
#include <net/ip.h>
+#include <net/gre.h>
#include <net/ip_tunnels.h>
#include <net/icmp.h>
#include <net/udp.h>
#include "datapath.h"
#include "gso.h"
#include "vlan.h"
+#ifndef USE_KERNEL_TUNNEL_API
#define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
skb->ip_summed = CHECKSUM_NONE;
}
-static int handle_offloads(struct sk_buff *skb)
+static struct sk_buff *handle_offloads(struct sk_buff *skb)
{
- if (skb_is_gso(skb)) {
- OVS_GSO_CB(skb)->fix_segment = vxlan_gso;
- } else {
- if (skb->ip_summed != CHECKSUM_PARTIAL)
- skb->ip_summed = CHECKSUM_NONE;
- }
- return 0;
+ return ovs_iptunnel_handle_offloads(skb, false, vxlan_gso);
}
int vxlan_xmit_skb(struct vxlan_sock *vs,
/* Need space for new headers (invalidates iph ptr) */
err = skb_cow_head(skb, min_headroom);
- if (unlikely(err))
+ if (unlikely(err)) {
+ kfree_skb(skb);
return err;
+ }
if (vlan_tx_tag_present(skb)) {
if (unlikely(!__vlan_put_tag(skb,
vxlan_set_owner(vs->sock->sk, skb);
- err = handle_offloads(skb);
- if (err)
- return err;
+ skb = handle_offloads(skb);
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
- return iptunnel_xmit(rt, skb, src, dst, IPPROTO_UDP, tos, ttl, df, false);
+ return iptunnel_xmit(vs->sock->sk, rt, skb, src, dst, IPPROTO_UDP,
+ tos, ttl, df, false);
}
static void rcu_free_vs(struct rcu_head *rcu)