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

Roi Dayan roid at mellanox.com
Wed Nov 6 07:33:07 UTC 2019



On 2019-11-05 11:04 PM, Ben Pfaff wrote:
> On Mon, Nov 04, 2019 at 10:11:05AM +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>
>> ---
>>  acinclude.m4            | 8 ++++++++
>>  include/linux/pkt_cls.h | 2 ++
>>  2 files changed, 10 insertions(+)
>>
>> diff --git a/acinclude.m4 b/acinclude.m4
>> index a0507cfe019e..12513b82747d 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.])])
>> +
> 
> I think you can use AC_CHECK_MEMBERS:
> 
> AC_CHECK_MEMBERS([struct tcf_t.firstuse], [], [], [#include <linux/pkt_cls.h>
> ])
> 

thanks, it works fine. I weren't aware of this macro.
i'll send v3.


More information about the dev mailing list