Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/sched: cls_flower: validate ct_state for invalid and reply flags

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>
Link: https://lore.kernel.org/r/1614064315-364-1-git-send-email-wenxu@ucloud.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

wenxu and committed by
Jakub Kicinski
3aed8b63 f3f9be9c

+15
+15
net/sched/cls_flower.c
··· 1417 1417 return -EINVAL; 1418 1418 } 1419 1419 1420 + if (state & TCA_FLOWER_KEY_CT_FLAGS_INVALID && 1421 + state & ~(TCA_FLOWER_KEY_CT_FLAGS_TRACKED | 1422 + TCA_FLOWER_KEY_CT_FLAGS_INVALID)) { 1423 + NL_SET_ERR_MSG_ATTR(extack, tb, 1424 + "when inv is set, only trk may be set"); 1425 + return -EINVAL; 1426 + } 1427 + 1428 + if (state & TCA_FLOWER_KEY_CT_FLAGS_NEW && 1429 + state & TCA_FLOWER_KEY_CT_FLAGS_REPLY) { 1430 + NL_SET_ERR_MSG_ATTR(extack, tb, 1431 + "new and rpl are mutually exclusive"); 1432 + return -EINVAL; 1433 + } 1434 + 1420 1435 return 0; 1421 1436 } 1422 1437