[ovs-dev] [PATCH V2 03/11] compat: Remove genl_ops policy field for newer kernels

Gregory Rose gvrose8192 at gmail.com
Fri Feb 28 17:04:04 UTC 2020


On 2/27/2020 4:05 PM, Yi-Hung Wei wrote:
> On Wed, Feb 26, 2020 at 9:41 AM Greg Rose <gvrose8192 at gmail.com> wrote:
>> The policy field of the genl_ops structure has been removed in recent
>> kernels.
>>
>> Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
>> ---
>>   acinclude.m4         |  3 +++
>>   datapath/conntrack.c |  8 ++++++++
>>   datapath/datapath.c  | 32 ++++++++++++++++++++++++++++++++
>>   datapath/meter.c     | 10 ++++++++++
>>   4 files changed, 53 insertions(+)
>>
>> diff --git a/acinclude.m4 b/acinclude.m4
>> index cad76c7..a55c905 100644
>> --- a/acinclude.m4
>> +++ b/acinclude.m4
>> @@ -1069,6 +1069,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
>>                     [OVS_DEFINE([HAVE_DST_OPS_CONFIRM_NEIGH])])
>>     OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [fqdir],
>>                     [OVS_DEFINE([HAVE_INET_FRAG_FQDIR])])
>> +  OVS_FIND_FIELD_IFELSE([$KSRC/include/net/genetlink.h], [genl_ops],
>> +                        [policy],
>> +                        [OVS_DEFINE([HAVE_GENL_OPS_POLICY])])
>>
>>     if cmp -s datapath/linux/kcompat.h.new \
>>               datapath/linux/kcompat.h >/dev/null 2>&1; then
>> diff --git a/datapath/conntrack.c b/datapath/conntrack.c
>> index 838cf63..25da2a5 100644
>> --- a/datapath/conntrack.c
>> +++ b/datapath/conntrack.c
>> @@ -134,10 +134,12 @@ struct ovs_ct_limit_info {
>>          struct nf_conncount_data *data;
>>   };
>>
>> +#ifdef HAVE_GENL_OPS_POLICY
>>   static const struct nla_policy ct_limit_policy[OVS_CT_LIMIT_ATTR_MAX + 1] = {
>>          [OVS_CT_LIMIT_ATTR_ZONE_LIMIT] = { .type = NLA_NESTED, },
>>   };
>>   #endif
>> +#endif
>>
>>   static bool labels_nonzero(const struct ovs_key_ct_labels *labels);
>>
>> @@ -2312,7 +2314,9 @@ static struct genl_ops ct_limit_genl_ops[] = {
>>   #endif
>>                  .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN
>>                                             * privilege. */
>> +#ifdef HAVE_GENL_OPS_POLICY
>>                  .policy = ct_limit_policy,
>> +#endif
>>                  .doit = ovs_ct_limit_cmd_set,
>>          },
>>          { .cmd = OVS_CT_LIMIT_CMD_DEL,
>> @@ -2321,7 +2325,9 @@ static struct genl_ops ct_limit_genl_ops[] = {
>>   #endif
>>                  .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN
>>                                             * privilege. */
>> +#ifdef HAVE_GENL_OPS_POLICY
>>                  .policy = ct_limit_policy,
>> +#endif
>>                  .doit = ovs_ct_limit_cmd_del,
>>          },
>>          { .cmd = OVS_CT_LIMIT_CMD_GET,
>> @@ -2329,7 +2335,9 @@ static struct genl_ops ct_limit_genl_ops[] = {
>>                  .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
>>   #endif
>>                  .flags = 0,               /* OK for unprivileged users. */
>> +#ifdef HAVE_GENL_OPS_POLICY
>>                  .policy = ct_limit_policy,
>> +#endif
>>                  .doit = ovs_ct_limit_cmd_get,
>>          },
>>   };
> Hi Greg,
>
> I think this patch is related to upstream patch 3b0f31f2b8c9f
> ("genetlink: make policy common to family") where it moved the generic
> netlink policy from genl_ops to genl_family.
>
> This patch does remove policy from struct genl_ops, but it does not
> add the policy to genl_family. Can you update that part in various
> places as well?
>
> Also, it would be great to include that upstream commit into the
> commit message for reference purpose.

Yep, missed that.  I'll fix that up in the next patch.

Thanks!

- Greg

>
> Thanks,
>
> -Yi-Hung



More information about the dev mailing list