[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0a9050c5-1df8-db55-755b-38239e5fe7af@intel.com>
Date: Thu, 3 Nov 2022 10:38:05 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Jakub Kicinski <kuba@...nel.org>, <davem@...emloft.net>
CC: <netdev@...r.kernel.org>, <edumazet@...gle.com>,
<pabeni@...hat.com>, <jiri@...nulli.us>, <razor@...ckwall.org>,
<nicolas.dichtel@...nd.com>, <gnault@...hat.com>, <fw@...len.de>
Subject: Re: [PATCH net-next v2 06/13] genetlink: add policies for both doit
and dumpit in ctrl_dumppolicy_start()
On 11/2/2022 2:33 PM, Jakub Kicinski wrote:
> Separate adding doit and dumpit policies for CTRL_CMD_GETPOLICY.
> This has no effect until we actually allow do and dump to come
> from different sources as netlink_policy_dump_add_policy()
> does deduplication.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> net/netlink/genetlink.c | 48 ++++++++++++++++++++++++++++++++---------
> 1 file changed, 38 insertions(+), 10 deletions(-)
>
> diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
> index 7c04df1bee2b..d0c35738839b 100644
> --- a/net/netlink/genetlink.c
> +++ b/net/netlink/genetlink.c
> @@ -1260,29 +1260,57 @@ static int ctrl_dumppolicy_start(struct netlink_callback *cb)
> ctx->rt = rt;
>
> if (tb[CTRL_ATTR_OP]) {
> + struct genl_split_ops doit, dump;
> +
> ctx->single_op = true;
> ctx->op = nla_get_u32(tb[CTRL_ATTR_OP]);
>
> - err = genl_get_cmd(ctx->op, rt, &op);
> - if (err) {
> + if (genl_get_cmd_split(ctx->op, GENL_CMD_CAP_DO, rt, &doit) &&
> + genl_get_cmd_split(ctx->op, GENL_CMD_CAP_DUMP, rt, &dump)) {
> NL_SET_BAD_ATTR(cb->extack, tb[CTRL_ATTR_OP]);
> - return err;
> + return -ENOENT;
We do lose the specific error of genl_get_cmd_split here, but honestly
not a big deal since I think it is always ENOENT anyways
Powered by blists - more mailing lists