openvswitch/compat-Add-compat-fix-for-old-kernels.patch

51 lines
1.6 KiB
Diff
Raw Normal View History

2020-09-01 18:09:31 +08:00
From 3000160ef611af0851014212357e9bfe057dae03 Mon Sep 17 00:00:00 2001
From: Roi Dayan <roid@mellanox.com>
Date: Wed, 6 Nov 2019 09:34:46 +0200
Subject: compat: Add compat fix for old kernels
In kernels older than 4.8, struct tcf_t didn't have the firstuse.
If openvswitch is compiled with the compat pkt_cls.h then there is
a struct size mismatch between openvswitch and the kernel which cause
parsing netlink actions to fail.
After this commit parsing the netlink actions pass even if compiled with
the compat pkt_cls.h.
Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
acinclude.m4 | 2 ++
include/linux/pkt_cls.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/acinclude.m4 b/acinclude.m4
index fcb45c647..a581e1ef2 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -185,6 +185,8 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [
[AC_DEFINE([HAVE_TCA_FLOWER_KEY_ENC_IP_TTL_MASK], [1],
[Define to 1 if TCA_FLOWER_KEY_ENC_IP_TTL_MASK is available.])])
+ AC_CHECK_MEMBERS([struct tcf_t.firstuse], [], [], [#include <linux/pkt_cls.h>])
+
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([#include <linux/tc_act/tc_vlan.h>], [
int x = TCA_VLAN_PUSH_VLAN_PRIORITY;
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 4adea59e7..2f7e328c4 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -64,7 +64,9 @@ struct tcf_t {
__u64 install;
__u64 lastuse;
__u64 expires;
+#ifdef HAVE_STRUCT_TCF_T_FIRSTUSE
__u64 firstuse;
+#endif
};
#define tc_gen \
--
2.14.1