AC_MSG_RESULT([$kversion])
if test "$version" -ge 4; then
- if test "$version" = 4 && test "$patchlevel" -le 3; then
+ if test "$version" = 4 && test "$patchlevel" -le 4; then
: # Linux 4.x
else
- AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.3.x is not supported (please refer to the FAQ for advice)])
+ AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.4.x is not supported (please refer to the FAQ for advice)])
fi
elif test "$version" = 3 && test "$patchlevel" -ge 10; then
: # Linux 3.x
OVS_FIND_PARAM_IFELSE([$KSRC/include/net/ip.h],
[ip_do_fragment], [net],
[OVS_DEFINE([HAVE_IP_DO_FRAGMENT_TAKES_NET])])
+ OVS_FIND_PARAM_IFELSE([$KSRC/include/net/ip.h],
+ [ip_local_out], [net],
+ [OVS_DEFINE([HAVE_IP_LOCAL_OUT_TAKES_NET])])
+
OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_skb_dst_mtu])
OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [IPSKB_FRAG_PMTU],
OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_register_net_hook])
OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hookfn.*nf_hook_ops],
[OVS_DEFINE([HAVE_NF_HOOKFN_ARG_OPS])])
+ OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hookfn], [priv],
+ [OVS_DEFINE([HAVE_NF_HOOKFN_ARG_PRIV])])
+ OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_ops],
+ [owner], [OVS_DEFINE([HAVE_NF_HOOKS_OPS_OWNER])])
+
OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter_ipv6.h], [nf_ipv6_ops],
[fragment.*sock], [OVS_DEFINE([HAVE_NF_IPV6_OPS_FRAGMENT])])
OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genlmsg_parse])
OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genl_notify.*family],
[OVS_DEFINE([HAVE_GENL_NOTIFY_TAKES_FAMILY])])
+ OVS_FIND_PARAM_IFELSE([$KSRC/include/net/genetlink.h],
+ [genl_notify], [net],
+ [OVS_DEFINE([HAVE_GENL_NOTIFY_TAKES_NET])])
+
OVS_FIND_FIELD_IFELSE([$KSRC/include/net/genetlink.h],
[genl_multicast_group], [id])
orig_dst = (unsigned long) skb_dst(skb);
skb_dst_set_noref(skb, &ovs_rt.dst);
IP6CB(skb)->frag_max_size = mru;
-
+#ifdef HAVE_IP_LOCAL_OUT_TAKES_NET
+ v6ops->fragment(net, skb->sk, skb, ovs_vport_output);
+#else
v6ops->fragment(skb->sk, skb, ovs_vport_output);
+#endif
refdst_drop(orig_dst);
} else {
WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.",
vport = ovs_vport_rcu(dp, nla_get_u32(a));
if (vport) {
- int err;
-
err = dev_fill_metadata_dst(vport->dev, skb);
if (!err)
upcall.egress_tun_info = skb_tunnel_info(skb);
static void ovs_notify(struct genl_family *family, struct genl_multicast_group *grp,
struct sk_buff *skb, struct genl_info *info)
{
- genl_notify(family, skb, genl_info_net(info),
- info->snd_portid, GROUP_ID(grp), info->nlhdr, GFP_KERNEL);
+ genl_notify(family, skb, info, GROUP_ID(grp), GFP_KERNEL);
}
/**
#include <linux/version.h>
#ifndef HAVE_GENL_NOTIFY_TAKES_FAMILY
-
-#undef genl_notify
-
-void rpl_genl_notify(struct rpl_genl_family *family, struct sk_buff *skb,
- struct net *net, u32 portid, u32 group,
- struct nlmsghdr *nlh, gfp_t flags)
-{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
- struct sock *sk = net->genl_sock;
- int report = 0;
-
- if (nlh)
- report = nlmsg_report(nlh);
-
- nlmsg_notify(sk, skb, portid, group, report, flags);
-#else
- genl_notify(skb, net, portid, group, nlh, flags);
-#endif
-}
-EXPORT_SYMBOL_GPL(rpl_genl_notify);
-
int rpl___genl_register_family(struct rpl_genl_family *f)
{
int err;
}
EXPORT_SYMBOL_GPL(rpl___genl_register_family);
+#endif /* HAVE_GENL_NOTIFY_TAKES_FAMILY */
+
+#ifdef HAVE_GENL_NOTIFY_TAKES_NET
+
+#undef genl_notify
+
+void rpl_genl_notify(struct genl_family *family, struct sk_buff *skb,
+ struct genl_info *info, u32 group, gfp_t flags)
+{
+ struct net *net = genl_info_net(info);
+ u32 portid = info->snd_portid;
+ struct nlmsghdr *nlh = info->nlhdr;
-#endif /* kernel version < 3.13.0 */
+#ifdef HAVE_GENL_NOTIFY_TAKES_FAMILY
+ genl_notify(family, skb, net, portid, group, nlh, flags);
+#else
+ genl_notify(skb, net, portid, group, nlh, flags);
+#endif
+}
+#endif /* HAVE_GENL_NOTIFY_TAKES_NET */
return ret;
}
-int rpl_ip_local_out(struct sk_buff *skb)
+int rpl_ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
{
int ret = NETDEV_TX_OK;
int id = -1;
return ret;
}
-int rpl_ip6_local_out(struct sk_buff *skb)
+int rpl_ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
{
int ret = NETDEV_TX_OK;
#endif /* HAVE_INNER_PROTOCOL */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
-#define ip_local_out rpl_ip_local_out
-int rpl_ip_local_out(struct sk_buff *skb);
-
static inline int skb_inner_mac_offset(const struct sk_buff *skb)
{
return skb_inner_mac_header(skb) - skb->data;
}
+#define ip_local_out rpl_ip_local_out
+int rpl_ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
+
#define ip6_local_out rpl_ip6_local_out
-int rpl_ip6_local_out(struct sk_buff *skb);
+int rpl_ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
#else
-static inline int rpl_ip_local_out(struct sk_buff *skb)
+static inline int rpl_ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
{
memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
+#ifdef HAVE_IP_LOCAL_OUT_TAKES_NET
+ /* net and sk parameters are added at same time. */
+ return ip_local_out(net, sk, skb);
+#else
return ip_local_out(skb);
+#endif
}
#define ip_local_out rpl_ip_local_out
-static inline int rpl_ip6_local_out(struct sk_buff *skb)
+static inline int rpl_ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
{
memset(IP6CB(skb), 0, sizeof (*IP6CB(skb)));
+#ifdef HAVE_IP_LOCAL_OUT_TAKES_NET
+ return ip6_local_out(net, sk, skb);
+#else
return ip6_local_out(skb);
+#endif
}
#define ip6_local_out rpl_ip6_local_out
};
#define genl_family rpl_genl_family
-#define genl_notify rpl_genl_notify
-void rpl_genl_notify(struct genl_family *family,
- struct sk_buff *skb, struct net *net, u32 portid, u32 group,
- struct nlmsghdr *nlh, gfp_t flags);
-
static inline void *rpl_genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
struct genl_family *family, int flags, u8 cmd)
{
family->module = THIS_MODULE;
return rpl___genl_register_family(family);
}
+#endif
+#ifdef HAVE_GENL_NOTIFY_TAKES_NET
+#define genl_notify rpl_genl_notify
+void rpl_genl_notify(struct genl_family *family, struct sk_buff *skb,
+ struct genl_info *info , u32 group, gfp_t flags);
#endif
#ifndef HAVE_GENL_HAS_LISTENERS
#endif /* HAVE_IP_SKB_DST_MTU */
#ifdef HAVE_IP_FRAGMENT_TAKES_SOCK
+#ifdef HAVE_IP_LOCAL_OUT_TAKES_NET
+#define OVS_VPORT_OUTPUT_PARAMS struct net *net, struct sock *sock, struct sk_buff *skb
+#else
#define OVS_VPORT_OUTPUT_PARAMS struct sock *sock, struct sk_buff *skb
+#endif
#else
#define OVS_VPORT_OUTPUT_PARAMS struct sk_buff *skb
#endif
#include <linux/ip6_tunnel.h>
#include_next <net/ip6_tunnel.h>
-#include "gso.h"
-
#define ip6tunnel_xmit rpl_ip6tunnel_xmit
-static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
- struct net_device *dev)
-{
- int pkt_len, err;
-
- pkt_len = skb->len - skb_inner_network_offset(skb);
-#ifdef HAVE_IP6_LOCAL_OUT_SK
- err = ip6_local_out_sk(sk, skb);
-#else
- err = ip6_local_out(skb);
-#endif
- if (net_xmit_eval(err))
- pkt_len = -1;
-
- iptunnel_xmit_stats(dev, pkt_len);
-}
+void rpl_ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
+ struct net_device *dev);
#endif
#define ip_tunnel_get_link_net rpl_ip_tunnel_get_link_net
struct net *rpl_ip_tunnel_get_link_net(const struct net_device *dev);
-#ifndef HAVE___IP_TUNNEL_CHANGE_MTU
#define __ip_tunnel_change_mtu rpl___ip_tunnel_change_mtu
int rpl___ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict);
-#endif
static inline int iptunnel_pull_offloads(struct sk_buff *skb)
{
#define nf_connlabels_put rpl_nf_connlabels_put
#else /* CONFIG_NF_CONNTRACK_LABELS */
+#define nf_connlabels_get rpl_nf_connlabels_get
static inline int nf_connlabels_get(struct net *net, unsigned int bits)
{
return -ERANGE;
}
+#define nf_connlabels_put rpl_nf_connlabels_put
static inline void nf_connlabels_put(struct net *net) { }
#endif /* CONFIG_NF_CONNTRACK_LABELS */
#endif /* HAVE_NF_CONNLABELS_GET_TAKES_BIT */
#include <linux/workqueue.h>
#include <linux/rculist.h>
#include <net/ip_tunnels.h>
+#include <net/ip6_tunnel.h>
#include <net/route.h>
#include <net/xfrm.h>
__ip_select_ident(iph, skb_shinfo(skb)->gso_segs ?: 1);
#endif
- err = ip_local_out(skb);
+ err = ip_local_out(dev_net(rt->dst.dev), sk, skb);
if (unlikely(net_xmit_eval(err)))
pkt_len = 0;
iptunnel_xmit_stats(dev, pkt_len);
return tot;
}
#endif
+
+void rpl_ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
+ struct net_device *dev)
+{
+ int pkt_len, err;
+
+ pkt_len = skb->len - skb_inner_network_offset(skb);
+#ifdef HAVE_IP6_LOCAL_OUT_SK
+ err = ip6_local_out_sk(sk, skb);
+#else
+ err = ip6_local_out(dev_net(skb_dst(skb)->dev), sk, skb);
+#endif
+ if (net_xmit_eval(err))
+ pkt_len = -1;
+
+ iptunnel_xmit_stats(dev, pkt_len);
+}
+EXPORT_SYMBOL_GPL(rpl_ip6tunnel_xmit);
#endif
#ifdef HAVE_NF_HOOKFN_ARG_OPS
#define FIRST_PARAM const struct nf_hook_ops *ops
#else
+#ifdef HAVE_NF_HOOKFN_ARG_PRIV
+#define FIRST_PARAM void *priv
+#else
#define FIRST_PARAM unsigned int hooknum
#endif
+#endif
#ifdef HAVE_NF_HOOK_STATE
#if RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(7,0)
static struct nf_hook_ops nf_hook_ops __read_mostly = {
.hook = nf_ip_hook,
+#ifdef HAVE_NF_HOOKS_OPS_OWNER
.owner = THIS_MODULE,
+#endif
.pf = NFPROTO_IPV4,
.hooknum = NF_INET_LOCAL_IN,
.priority = INT_MAX,
#include <net/ip6_checksum.h>
#include <net/ip6_tunnel.h>
+#include "gso.h"
int rpl_udp_sock_create4(struct net *net, struct udp_port_cfg *cfg,
struct socket **sockp)
#include <net/inet_ecn.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
-#include <net/vxlan.h>
#include <net/protocol.h>
#if IS_ENABLED(CONFIG_IPV6)
#include <net/ip6_route.h>
#endif
+#include <net/vxlan.h>
#include "gso.h"
#include "vport-netdev.h"
#include "compat.h"
static int vxlan_fdb_create(struct vxlan_dev *vxlan,
const u8 *mac, union vxlan_addr *ip,
__u16 state, __u16 flags,
- __be16 port, __u32 vni, __u32 ifindex,
+ __be16 port, __be32 vni, __u32 ifindex,
__u8 ndm_flags)
{
return -EINVAL;