Most patches for 4.1 are no longer needed, only a minor patch to fix a missing WAIT_ANY constant. 2.5.0 depends on nf_conntrack (ipv4 and ipv6) Signed-off-by: Jeroen van Bemmel <jvb127@gmail.com>lilik-openwrt-22.03
@ -1,35 +0,0 @@ | |||||
From 5919cb26c631b1dd77a745a3c546f9d117ed34b3 Mon Sep 17 00:00:00 2001 | |||||
From: Hauke Mehrtens <hauke@hauke-m.de> | |||||
Date: Sat, 23 May 2015 18:12:09 +0200 | |||||
Subject: [PATCH] datapath: do not add vlan_hwaccel_push_inside() for kernel >= | |||||
3.18.13 | |||||
The vlan_hwaccel_push_inside() function was backported in this commit | |||||
to kernel 3.18.13: | |||||
commit a67e2e88342accd49587d9bad72f6dabd7673f7c | |||||
Author: Jiri Pirko <jiri@resnulli.us> | |||||
Date: Wed Nov 19 14:04:59 2014 +0100 | |||||
vlan: introduce *vlan_hwaccel_push_inside helpers | |||||
[ Upstream commit 5968250c868ceee680aa77395b24e6ddcae17d36 ] | |||||
Without this patch compilation breaks on kernel >= 3.18.13 | |||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> | |||||
--- | |||||
datapath/linux/compat/include/linux/if_vlan.h | 2 +- | |||||
1 file changed, 1 insertion(+), 1 deletion(-) | |||||
--- a/datapath/linux/compat/include/linux/if_vlan.h | |||||
+++ b/datapath/linux/compat/include/linux/if_vlan.h | |||||
@@ -52,7 +52,7 @@ static inline struct sk_buff *rpl_vlan_i | |||||
} | |||||
#endif | |||||
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) | |||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,13) | |||||
/* | |||||
* __vlan_hwaccel_push_inside - pushes vlan tag to the payload | |||||
* @skb: skbuff to tag |
@ -1,34 +0,0 @@ | |||||
From 554daf066bf4a8eb7bbc8edc1a877a3afc0de38d Mon Sep 17 00:00:00 2001 | |||||
From: =?UTF-8?q?Jason=20K=C3=B6lker?= <jason@koelker.net> | |||||
Date: Wed, 2 Sep 2015 22:40:24 +0000 | |||||
Subject: [PATCH] datapath: Add net/ip6_checksum.h to stt.c | |||||
MIME-Version: 1.0 | |||||
Content-Type: text/plain; charset=UTF-8 | |||||
Content-Transfer-Encoding: 8bit | |||||
`csum_ipv6_magic` is an asm inline on most platforms. However if it is | |||||
not defined (like on ppc64le) including <net/ip6_checksum.h> will fall | |||||
back to the c implementation by wrapping it in an | |||||
`#ifndef _HAVE_ARCH_IPV6_CSUM`. | |||||
Signed-off-by: Jason Kölker <jason@koelker.net> | |||||
Signed-off-by: Jesse Gross <jesse@nicira.com> | |||||
--- | |||||
datapath/linux/compat/stt.c | 1 + | |||||
1 file changed, 1 insertion(+) | |||||
diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c | |||||
index b44f470..dd21753 100644 | |||||
--- a/datapath/linux/compat/stt.c | |||||
+++ b/datapath/linux/compat/stt.c | |||||
@@ -30,6 +30,7 @@ | |||||
#include <net/icmp.h> | |||||
#include <net/inet_ecn.h> | |||||
#include <net/ip.h> | |||||
+#include <net/ip6_checksum.h> | |||||
#include <net/net_namespace.h> | |||||
#include <net/netns/generic.h> | |||||
#include <net/sock.h> | |||||
-- | |||||
2.1.4 | |||||
@ -1,17 +0,0 @@ | |||||
diff --git a/acinclude.m4 b/acinclude.m4 | |||||
index 45cfaf6..42866de 100644 | |||||
--- a/acinclude.m4 | |||||
+++ b/acinclude.m4 | |||||
@@ -134,10 +134,10 @@ AC_DEFUN([OVS_CHECK_LINUX], [ | |||||
AC_MSG_RESULT([$kversion]) | |||||
if test "$version" -ge 4; then | |||||
- if test "$version" = 4 && test "$patchlevel" -le 0; then | |||||
+ if test "$version" = 4 && test "$patchlevel" -le 1; then | |||||
: # Linux 4.x | |||||
else | |||||
- AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.0.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.1.x is not supported (please refer to the FAQ for advice)]) | |||||
fi | |||||
elif test "$version" = 3; then | |||||
: # Linux 3.x |
@ -1,93 +0,0 @@ | |||||
diff --git a/datapath/datapath.h b/datapath/datapath.h | |||||
index fdf35f0..02be8be 100644 | |||||
--- a/datapath/datapath.h | |||||
+++ b/datapath/datapath.h | |||||
@@ -86,10 +86,8 @@ struct datapath { | |||||
/* Stats. */ | |||||
struct dp_stats_percpu __percpu *stats_percpu; | |||||
-#ifdef CONFIG_NET_NS | |||||
/* Network namespace ref. */ | |||||
- struct net *net; | |||||
-#endif | |||||
+ possible_net_t net; | |||||
u32 user_features; | |||||
}; | |||||
@@ -154,12 +152,12 @@ int lockdep_ovsl_is_held(void); | |||||
static inline struct net *ovs_dp_get_net(const struct datapath *dp) | |||||
{ | |||||
- return read_pnet(&dp->net); | |||||
+ return ovs_compat_read_pnet(&dp->net); | |||||
} | |||||
static inline void ovs_dp_set_net(struct datapath *dp, struct net *net) | |||||
{ | |||||
- write_pnet(&dp->net, net); | |||||
+ ovs_compat_write_pnet(&dp->net, net); | |||||
} | |||||
struct vport *ovs_lookup_vport(const struct datapath *dp, u16 port_no); | |||||
diff --git a/datapath/linux/compat/include/net/net_namespace.h b/datapath/linux/compat/include/net/net_namespace.h | |||||
index b7dbfe3..7763584 100644 | |||||
--- a/datapath/linux/compat/include/net/net_namespace.h | |||||
+++ b/datapath/linux/compat/include/net/net_namespace.h | |||||
@@ -51,4 +51,57 @@ static void rpl_unregister_pernet_gen_##TYPE(struct rpl_pernet_operations *rpl_p | |||||
#define DEFINE_COMPAT_PNET_REG_FUNC(TYPE) | |||||
#endif /* 2.6.33 */ | |||||
+/* In recent kernel versions (4.1) this type is defined ; for older versions we have to define it */ | |||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) | |||||
+#define ovs_compat_read_pnet read_pnet | |||||
+#define ovs_compat_write_pnet write_pnet | |||||
+ | |||||
+#if defined(CONFIG_NET_NS) && defined(NETNS_REFCNT_DEBUG) | |||||
+static inline struct net *hold_net(struct net *net) | |||||
+{ | |||||
+ if (net) | |||||
+ atomic_inc(&net->use_count); | |||||
+ return net; | |||||
+} | |||||
+ | |||||
+static inline void release_net(struct net *net) | |||||
+{ | |||||
+ if (net) | |||||
+ atomic_dec(&net->use_count); | |||||
+} | |||||
+#else | |||||
+static inline struct net *hold_net(struct net *net) | |||||
+{ | |||||
+ return net; | |||||
+} | |||||
+ | |||||
+static inline void release_net(struct net *net) | |||||
+{ | |||||
+} | |||||
+#endif | |||||
+ | |||||
+#else /* lower than 4.1 */ | |||||
+typedef struct { | |||||
+#ifdef CONFIG_NET_NS | |||||
+ struct net *net; | |||||
+#endif | |||||
+} possible_net_t; | |||||
+ | |||||
+static inline void ovs_compat_write_pnet(possible_net_t *pnet, struct net *net) | |||||
+{ | |||||
+#ifdef CONFIG_NET_NS | |||||
+ pnet->net = net; | |||||
+#endif | |||||
+} | |||||
+ | |||||
+static inline struct net *ovs_compat_read_pnet(const possible_net_t *pnet) | |||||
+{ | |||||
+#ifdef CONFIG_NET_NS | |||||
+ return pnet->net; | |||||
+#else | |||||
+ return &init_net; | |||||
+#endif | |||||
+} | |||||
+#endif /* 4.1.0 */ | |||||
+ | |||||
#endif /* net/net_namespace.h wrapper */ |
@ -0,0 +1,11 @@ | |||||
--- a/tests/test-ovn.c | |||||
+++ b/tests/test-ovn.c | |||||
@@ -1043,7 +1043,7 @@ wait_pid(pid_t *pids, int *n) | |||||
int status; | |||||
pid_t pid; | |||||
- pid = waitpid(WAIT_ANY, &status, 0); | |||||
+ pid = waitpid(-1, &status, 0); | |||||
if (pid < 0) { | |||||
ovs_fatal(errno, "waitpid failed"); | |||||
} else if (WIFEXITED(status)) { |
@ -1,20 +0,0 @@ | |||||
diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c | |||||
index b44f470..f95416e 100644 | |||||
--- a/datapath/linux/compat/stt.c | |||||
+++ b/datapath/linux/compat/stt.c | |||||
@@ -1326,9 +1326,14 @@ static void clean_percpu(struct work_struct *work) | |||||
static unsigned int nf_ip_hook(FIRST_PARAM | |||||
struct sk_buff *skb, | |||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) | |||||
+ const struct nf_hook_state *state | |||||
+#else | |||||
const struct net_device *in, | |||||
const struct net_device *out, | |||||
- int (*okfn)(struct sk_buff *)) | |||||
+ int (*okfn)(struct sk_buff *) | |||||
+#endif | |||||
+ ) | |||||
{ | |||||
struct stt_sock *stt_sock; | |||||
int ip_hdr_len; |
@ -1,18 +0,0 @@ | |||||
diff --git a/datapath/linux/compat/include/net/vxlan.h b/datapath/linux/compat/include/net/vxlan.h | |||||
index 0d60c18..db4dfb6 100644 | |||||
--- a/datapath/linux/compat/include/net/vxlan.h | |||||
+++ b/datapath/linux/compat/include/net/vxlan.h | |||||
@@ -99,8 +99,13 @@ static inline int rpl_vxlan_xmit_skb(struct vxlan_sock *vs, | |||||
return -ENOSYS; | |||||
} | |||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) | |||||
+ return vxlan_xmit_skb(rt, vs->sock->sk, skb, src, dst, tos, ttl, df, | |||||
+ src_port, dst_port, md, xnet, vxflags); | |||||
+#else | |||||
return vxlan_xmit_skb(rt, skb, src, dst, tos, ttl, df, | |||||
src_port, dst_port, md, xnet, vxflags); | |||||
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */ | |||||
} | |||||
#define vxlan_xmit_skb rpl_vxlan_xmit_skb |
@ -1,16 +0,0 @@ | |||||
diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c | |||||
index 0024eb4..ce1c3a8 100644 | |||||
--- a/datapath/vport-lisp.c | |||||
+++ b/datapath/vport-lisp.c | |||||
@@ -455,7 +455,11 @@ static int lisp_send(struct vport *vport, struct sk_buff *skb) | |||||
ovs_skb_set_inner_protocol(skb, skb->protocol); | |||||
df = tun_key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; | |||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) | |||||
+ sent_len = udp_tunnel_xmit_skb(rt, lisp_port->lisp_rcv_socket->sk, skb, saddr, tun_key->ipv4_dst, | |||||
+#else | |||||
sent_len = udp_tunnel_xmit_skb(rt, skb, saddr, tun_key->ipv4_dst, | |||||
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */ | |||||
tun_key->ipv4_tos, tun_key->ipv4_ttl, | |||||
df, src_port, dst_port, false, true); | |||||