[ovs-dev] [PATCH v2] compat: Add compat fix for old kernels

Roi Dayan roid at mellanox.com
Mon Nov 11 16:49:18 UTC 2019



On 2019-11-11 4:08 PM, Roi Dayan wrote:
> 
> 
> On 2019-11-11 3:39 PM, Simon Horman wrote:
>> On Mon, Nov 04, 2019 at 11:49:44AM +0200, Roi Dayan wrote:
>>> 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 at mellanox.com>
>>> ---
>>>
>>> v1->v2:
>>> - fix mix of tabs and spaces in acinclude.m4
>>
>> Thanks, applied to master and branch-2.8 ... branch-2.12
> 
> thanks!
> 

Hi Simon,

sorry for the trouble but there is also v3 for this patch.
it uses ac_check_member instead of ac_compile.
is it possible to take v3 which is a lot cleaner?

Thanks,
Roi


>>
>>>  acinclude.m4            | 8 ++++++++
>>>  include/linux/pkt_cls.h | 2 ++
>>>  2 files changed, 10 insertions(+)
>>>
>>> diff --git a/acinclude.m4 b/acinclude.m4
>>> index a0507cfe019e..1e699191bb8b 100644
>>> --- a/acinclude.m4
>>> +++ b/acinclude.m4
>>> @@ -186,6 +186,14 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [
>>>                 [Define to 1 if TCA_FLOWER_KEY_ENC_IP_TTL_MASK is available.])])
>>>  
>>>    AC_COMPILE_IFELSE([
>>> +    AC_LANG_PROGRAM([#include <linux/pkt_cls.h>], [
>>> +        struct tcf_t x;
>>> +        x.firstuse = 1;
>>> +    ])],
>>> +    [AC_DEFINE([HAVE_TCF_T_FIRSTUSE], [1],
>>> +               [Define to 1 if struct tcf_t have firstuse.])])
>>> +
>>> +  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 4adea59e7c36..b6926a79a0af 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_TCF_T_FIRSTUSE
>>>  	__u64   firstuse;
>>> +#endif
>>>  };
>>>  
>>>  #define tc_gen \
>>> -- 
>>> 2.8.4
>>>


More information about the dev mailing list