[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210204133856.GH3399@horizon.localdomain>
Date: Thu, 4 Feb 2021 10:38:56 -0300
From: Marcelo Ricardo Leitner <mleitner@...hat.com>
To: wenxu@...oud.cn
Cc: i.maximets@....org, netdev@...r.kernel.org
Subject: Re: [PATCH net] net/sched: cls_flower: Return invalid for unknown
ct_state flags rules
Hi,
On Thu, Feb 04, 2021 at 12:17:24PM +0800, wenxu@...oud.cn wrote:
> From: wenxu <wenxu@...oud.cn>
>
> Reject the unknown ct_state flags of cls flower rules. This also make
> the userspace like ovs to probe the ct_state flags support in the
> kernel.
That's a good start but it could also do some combination sanity
checks, like ovs does in validate_ct_state(). For example, it does:
if (state && !(state & CS_TRACKED)) {
ds_put_format(ds, "%s: invalid connection state: "
"If \"trk\" is unset, no other flags are set\n",
...
> --- a/net/sched/cls_flower.c
> +++ b/net/sched/cls_flower.c
> @@ -1403,6 +1403,10 @@ static int fl_set_key_ct(struct nlattr **tb,
> fl_set_key_val(tb, &key->ct_state, TCA_FLOWER_KEY_CT_STATE,
> &mask->ct_state, TCA_FLOWER_KEY_CT_STATE_MASK,
> sizeof(key->ct_state));
> + if (TCA_FLOWER_KEY_CT_FLAGS_UNKNOWN(mask->ct_state)) {
> + NL_SET_ERR_MSG(extack, "invalid ct_state flags");
cls_flower is inconsistent on this but please use NL_SET_ERR_MSG_MOD instead.
> + return -EINVAL;
> + }
> }
> if (tb[TCA_FLOWER_KEY_CT_ZONE]) {
> if (!IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES)) {
> --
> 1.8.3.1
>
Powered by blists - more mailing lists