]> asedeno.scripts.mit.edu Git - linux.git/commit
net/sched: user-space can't set unknown tcfa_action values
authorPaolo Abeni <pabeni@redhat.com>
Mon, 30 Jul 2018 12:30:42 +0000 (14:30 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Jul 2018 16:31:13 +0000 (09:31 -0700)
commit802bfb19152c0fb4137c6ba72bcf042ee023e743
tree0330695824cf2ca9a5f5d270e4a161f7df857abf
parentc87fffc57adf7b772b3778a9521c3f2ff744ae82
net/sched: user-space can't set unknown tcfa_action values

Currently, when initializing an action, the user-space can specify
and use arbitrary values for the tcfa_action field. If the value
is unknown by the kernel, is implicitly threaded as TC_ACT_UNSPEC.

This change explicitly checks for unknown values at action creation
time, and explicitly convert them to TC_ACT_UNSPEC. No functional
changes are introduced, but this will allow introducing tcfa_action
values not exposed to user-space in a later patch.

Note: we can't use the above to hide TC_ACT_REDIRECT from user-space,
as the latter is already part of uAPI.

v3 -> v4:
 - use an helper to check for action validity (JiriP)
 - emit an extack for invalid actions (JiriP)
v4 -> v5:
 - keep messages on a single line, drop net_warn (Marcelo)

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/pkt_cls.h
net/sched/act_api.c