[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1613974190-12108-1-git-send-email-wenxu@ucloud.cn>
Date: Mon, 22 Feb 2021 14:09:50 +0800
From: wenxu@...oud.cn
To: kuba@...nel.org, mleitner@...hat.com
Cc: netdev@...r.kernel.org, jhs@...atatu.com
Subject: [PATCH net-next] net/sched: cls_flower: validate ct_state for invalid and reply flags
From: wenxu <wenxu@...oud.cn>
Add invalid and reply flags validate in the fl_validate_ct_state.
Signed-off-by: wenxu <wenxu@...oud.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 also 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
Powered by blists - more mailing lists