• Paolo Abeni's avatar
    net/sched: user-space can't set unknown tcfa_action values · 802bfb19
    Paolo Abeni authored
    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: default avatarPaolo Abeni <pabeni@redhat.com>
    Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    802bfb19
act_api.c 40.6 KB