mbox series

[v3,0/5] genetlink per-op policy export

Message ID 20201003084446.59042-1-johannes@sipsolutions.net
Headers show
Series genetlink per-op policy export | expand

Message

Johannes Berg Oct. 3, 2020, 8:44 a.m. UTC
Hi,

Here's a respin, now including Jakub's patch last so that it will
do the right thing from the start.

The first patch remains the same, of course; the others have mostly
some rebasing going on, except for the actual export patch (patch 4)
which is adjusted per Jakub's review comments about exporting the
policy only if it's actually used for do/dump.

To see that, the dump for "nlctrl" (i.e. the generic netlink control)
is instructive, because the ops are this:

        {
                .cmd            = CTRL_CMD_GETFAMILY,
                .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
                .policy         = ctrl_policy_family,
                .maxattr        = ARRAY_SIZE(ctrl_policy_family) - 1,
                .doit           = ctrl_getfamily,
                .dumpit         = ctrl_dumpfamily,
        },
        {
                .cmd            = CTRL_CMD_GETPOLICY,
                .policy         = ctrl_policy_policy,
                .maxattr        = ARRAY_SIZE(ctrl_policy_policy) - 1,
                .start          = ctrl_dumppolicy_start,
                .dumpit         = ctrl_dumppolicy,
                .done           = ctrl_dumppolicy_done,
        },

So we exercise both "don't have doit" and "GENL_DONT_VALIDATE_DUMP"
parts, and get (with the current genl patch):

$ genl ctrl policy name nlctrl
	ID: 0x10  op 3 policies: do=0
	ID: 0x10  op 10 policies: dump=1
	ID: 0x10  policy[0]:attr[1]: type=U16 range:[0,65535]
	ID: 0x10  policy[0]:attr[2]: type=NUL_STRING max len:15
	ID: 0x10  policy[1]:attr[1]: type=U16 range:[0,65535]
	ID: 0x10  policy[1]:attr[2]: type=NUL_STRING max len:15
	ID: 0x10  policy[1]:attr[10]: type=U32 range:[0,4294967295]

johannes

Comments

Jakub Kicinski Oct. 3, 2020, 3:15 p.m. UTC | #1
On Sat,  3 Oct 2020 10:44:41 +0200 Johannes Berg wrote:
> Here's a respin, now including Jakub's patch last so that it will
> do the right thing from the start.
> 
> The first patch remains the same, of course; the others have mostly
> some rebasing going on, except for the actual export patch (patch 4)
> which is adjusted per Jakub's review comments about exporting the
> policy only if it's actually used for do/dump.

Reviewed-by: Jakub Kicinski <kuba@kernel.org>

Thanks!
David Miller Oct. 3, 2020, 9:18 p.m. UTC | #2
From: Jakub Kicinski <kuba@kernel.org>
Date: Sat, 3 Oct 2020 08:15:26 -0700

> On Sat,  3 Oct 2020 10:44:41 +0200 Johannes Berg wrote:
>> Here's a respin, now including Jakub's patch last so that it will
>> do the right thing from the start.
>> 
>> The first patch remains the same, of course; the others have mostly
>> some rebasing going on, except for the actual export patch (patch 4)
>> which is adjusted per Jakub's review comments about exporting the
>> policy only if it's actually used for do/dump.
> 
> Reviewed-by: Jakub Kicinski <kuba@kernel.org>

Series applied, thanks everyone.