* [PATCH net-next v2] net/sched: cls_flower: validate ct_state for invalid and reply flags
@ 2021-02-23 7:11 wenxu
2021-02-23 12:05 ` Marcelo Ricardo Leitner
0 siblings, 1 reply; 3+ messages in thread
From: wenxu @ 2021-02-23 7:11 UTC (permalink / raw)
To: kuba, mleitner; +Cc: netdev, jhs
From: wenxu <wenxu@ucloud.cn>
Add invalid and reply flags validate in the fl_validate_ct_state.
This makes the checking complete if compared to ovs'
validate_ct_state().
Signed-off-by: wenxu <wenxu@ucloud.cn>
---
net/sched/cls_flower.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 2409e52..18430db 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -1417,6 +1417,21 @@ static int fl_validate_ct_state(u16 state, struct nlattr *tb,
return -EINVAL;
}
+ if (state & TCA_FLOWER_KEY_CT_FLAGS_INVALID &&
+ state & ~(TCA_FLOWER_KEY_CT_FLAGS_TRACKED |
+ TCA_FLOWER_KEY_CT_FLAGS_INVALID)) {
+ NL_SET_ERR_MSG_ATTR(extack, tb,
+ "when inv is set, only trk may be set");
+ return -EINVAL;
+ }
+
+ if (state & TCA_FLOWER_KEY_CT_FLAGS_NEW &&
+ state & TCA_FLOWER_KEY_CT_FLAGS_REPLY) {
+ NL_SET_ERR_MSG_ATTR(extack, tb,
+ "new and rpl are mutually exclusive");
+ return -EINVAL;
+ }
+
return 0;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] net/sched: cls_flower: validate ct_state for invalid and reply flags
2021-02-23 7:11 [PATCH net-next v2] net/sched: cls_flower: validate ct_state for invalid and reply flags wenxu
@ 2021-02-23 12:05 ` Marcelo Ricardo Leitner
2021-02-23 20:26 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Ricardo Leitner @ 2021-02-23 12:05 UTC (permalink / raw)
To: wenxu; +Cc: kuba, netdev, jhs, Oz Shlomo, Paul Blakey
On Tue, Feb 23, 2021 at 03:11:55PM +0800, wenxu@ucloud.cn wrote:
> From: wenxu <wenxu@ucloud.cn>
>
> Add invalid and reply flags validate in the fl_validate_ct_state.
> This makes the checking complete if compared to ovs'
> validate_ct_state().
>
> Signed-off-by: wenxu <wenxu@ucloud.cn>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] net/sched: cls_flower: validate ct_state for invalid and reply flags
2021-02-23 12:05 ` Marcelo Ricardo Leitner
@ 2021-02-23 20:26 ` Jakub Kicinski
0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2021-02-23 20:26 UTC (permalink / raw)
To: Marcelo Ricardo Leitner, wenxu; +Cc: netdev, jhs, Oz Shlomo, Paul Blakey
On Tue, 23 Feb 2021 09:05:47 -0300 Marcelo Ricardo Leitner wrote:
> On Tue, Feb 23, 2021 at 03:11:55PM +0800, wenxu@ucloud.cn wrote:
> > From: wenxu <wenxu@ucloud.cn>
> >
> > Add invalid and reply flags validate in the fl_validate_ct_state.
> > This makes the checking complete if compared to ovs'
> > validate_ct_state().
> >
> > Signed-off-by: wenxu <wenxu@ucloud.cn>
>
> Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Applied, thank you!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-23 20:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 7:11 [PATCH net-next v2] net/sched: cls_flower: validate ct_state for invalid and reply flags wenxu
2021-02-23 12:05 ` Marcelo Ricardo Leitner
2021-02-23 20:26 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).