Skip to content

Commit

Permalink
compat: Fixups for Ubuntu 4.4 kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
gvrose8192 committed Oct 26, 2017
1 parent df0f927 commit 85674ac
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 7 deletions.
15 changes: 11 additions & 4 deletions acinclude.m4
Expand Up @@ -511,13 +511,20 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
dnl OVS also does not need dst_cache But this dependency allows us to write
dnl much cleaner code.
OVS_GREP_IFELSE([$KSRC/include/net/ip_tunnels.h], [ip_tunnel_key])
OVS_GREP_IFELSE([$KSRC/include/net/ip_tunnels.h], [iptunnel_pull_offloads],
[OVS_DEFINE([USE_UPSTREAM_TUNNEL])])
OVS_FIND_FIELD_IFELSE([$KSRC/include/net/ip_tunnels.h], [ip_tunnel_key],
[label],
[OVS_GREP_IFELSE([$KSRC/include/net/ip_tunnels.h],
[iptunnel_pull_offloads],
[OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], [dst_cache],
[OVS_DEFINE([USE_UPSTREAM_TUNNEL])])])])
[OVS_DEFINE(USE_IPV6_UPSTREAM_TUNNEL)])
OVS_FIND_PARAM_IFELSE([$KSRC/include/net/ip_tunnels.h],
[iptunnel_xmit_stats], [err],
[OVS_DEFINE([HAVE_IPTUNNEL_XMIT_STATS_ERR])])
OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], [dst_cache],
[OVS_DEFINE([USE_DST_CACHE])])
OVS_GREP_IFELSE([$KSRC/include/net/mpls.h], [mpls_hdr],
[OVS_DEFINE([MPLS_HEADER_IS_L3])])
OVS_GREP_IFELSE([$KSRC/include/linux/net.h], [sock_create_kern.*net],
Expand Down
2 changes: 2 additions & 0 deletions datapath/flow_netlink.c
Expand Up @@ -2209,11 +2209,13 @@ static int validate_and_copy_set_tun(const struct nlattr *attr,
if (!tun_dst)
return -ENOMEM;

#ifdef USE_DST_CACHE
err = dst_cache_init(&tun_dst->u.tun_info.dst_cache, GFP_KERNEL);
if (err) {
dst_release((struct dst_entry *)tun_dst);
return err;
}
#endif
a = __add_action(sfa, OVS_KEY_ATTR_TUNNEL_INFO, NULL,
sizeof(*ovs_tun), log);
if (IS_ERR(a)) {
Expand Down
2 changes: 1 addition & 1 deletion datapath/linux/compat/include/net/dst_cache.h
Expand Up @@ -7,7 +7,7 @@
#include <net/ip6_fib.h>
#endif

#ifdef USE_UPSTREAM_TUNNEL
#ifdef USE_DST_CACHE
#include_next <net/dst_cache.h>

#else
Expand Down
10 changes: 9 additions & 1 deletion datapath/linux/compat/ip_tunnels_core.c
Expand Up @@ -253,6 +253,11 @@ void rpl_ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
struct net_device *dev)
{
int pkt_len, err;
#ifdef HAVE_IPTUNNEL_XMIT_STATS_ERR
struct pcpu_sw_netstats *tstats;

tstats = this_cpu_ptr((struct pcpu_sw_netstats __percpu *)dev->tstats);
#endif

pkt_len = skb->len - skb_inner_network_offset(skb);
#ifdef HAVE_IP6_LOCAL_OUT_SK
Expand All @@ -262,7 +267,10 @@ void rpl_ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
#endif
if (net_xmit_eval(err))
pkt_len = -1;

#ifdef HAVE_IPTUNNEL_XMIT_STATS_ERR
iptunnel_xmit_stats(err, &dev->stats, tstats);
#else
iptunnel_xmit_stats(dev, pkt_len);
#endif
}
EXPORT_SYMBOL_GPL(rpl_ip6tunnel_xmit);
4 changes: 4 additions & 0 deletions datapath/linux/compat/lisp.c
Expand Up @@ -224,8 +224,12 @@ static int lisp_rcv(struct sock *sk, struct sk_buff *skb)
goto error;

lisp_dev = netdev_priv(dev);
#ifndef USE_IPV6_UPSTREAM_TUNNEL
if (iptunnel_pull_header(skb, LISP_HLEN, 0))
#else
if (iptunnel_pull_header(skb, LISP_HLEN, 0,
!net_eq(lisp_dev->net, dev_net(lisp_dev->dev))))
#endif
goto error;

lisph = lisp_hdr(skb);
Expand Down
6 changes: 6 additions & 0 deletions datapath/linux/compat/stt.c
Expand Up @@ -1456,10 +1456,16 @@ static void stt_rcv(struct stt_dev *stt_dev, struct sk_buff *skb)
if (skb->next && coalesce_skb(&skb))
goto drop;

#ifndef USE_IPV6_UPSTREAM_TUNNEL
err = iptunnel_pull_header(skb,
sizeof(struct stthdr) + STT_ETH_PAD,
htons(ETH_P_TEB));
#else
err = iptunnel_pull_header(skb,
sizeof(struct stthdr) + STT_ETH_PAD,
htons(ETH_P_TEB),
!net_eq(stt_dev->net, dev_net(stt_dev->dev)));
#endif
if (unlikely(err))
goto drop;

Expand Down
5 changes: 4 additions & 1 deletion datapath/vport-vxlan.c
Expand Up @@ -60,6 +60,7 @@ static int vxlan_get_options(const struct vport *vport, struct sk_buff *skb)
return -EMSGSIZE;

nla_nest_end(skb, exts);
#ifdef VXLAN_F_GPE
#ifdef HAVE_VXLAN_DEV_CFG
} else if (vxlan->cfg.flags & VXLAN_F_GPE) {
#else
Expand All @@ -78,7 +79,7 @@ static int vxlan_get_options(const struct vport *vport, struct sk_buff *skb)
#endif
nla_put_flag(skb, OVS_VXLAN_EXT_GPE))
return -EMSGSIZE;

#endif /* VXLAN_F_GPE */
nla_nest_end(skb, exts);
}

Expand Down Expand Up @@ -106,8 +107,10 @@ static int vxlan_configure_exts(struct vport *vport, struct nlattr *attr,

if (exts[OVS_VXLAN_EXT_GBP])
conf->flags |= VXLAN_F_GBP;
#ifdef VXLAN_F_GPE
else if (exts[OVS_VXLAN_EXT_GPE])
conf->flags |= VXLAN_F_GPE;
#endif

return 0;
}
Expand Down

0 comments on commit 85674ac

Please sign in to comment.