• Pedro Tammela's avatar
    net/sched: act_mpls: fix action bind logic · e88d78a7
    Pedro Tammela authored
    The TC architecture allows filters and actions to be created independently.
    In filters the user can reference action objects using:
    tc action add action mpls ... index 1
    tc filter add ... action mpls index 1
    
    In the current code for act_mpls this is broken as it checks netlink
    attributes for create/update before actually checking if we are binding to an
    existing action.
    
    tdc results:
    1..53
    ok 1 a933 - Add MPLS dec_ttl action with pipe opcode
    ok 2 08d1 - Add mpls dec_ttl action with pass opcode
    ok 3 d786 - Add mpls dec_ttl action with drop opcode
    ok 4 f334 - Add mpls dec_ttl action with reclassify opcode
    ok 5 29bd - Add mpls dec_ttl action with continue opcode
    ok 6 48df - Add mpls dec_ttl action with jump opcode
    ok 7 62eb - Add mpls dec_ttl action with trap opcode
    ok 8 09d2 - Add mpls dec_ttl action with opcode and cookie
    ok 9 c170 - Add mpls dec_ttl action with opcode and cookie of max length
    ok 10 9118 - Add mpls dec_ttl action with invalid opcode
    ok 11 6ce1 - Add mpls dec_ttl action with label (invalid)
    ok 12 352f - Add mpls dec_ttl action with tc (invalid)
    ok 13 fa1c - Add mpls dec_ttl action with ttl (invalid)
    ok 14 6b79 - Add mpls dec_ttl action with bos (invalid)
    ok 15 d4c4 - Add mpls pop action with ip proto
    ok 16 91fb - Add mpls pop action with ip proto and cookie
    ok 17 92fe - Add mpls pop action with mpls proto
    ok 18 7e23 - Add mpls pop action with no protocol (invalid)
    ok 19 6182 - Add mpls pop action with label (invalid)
    ok 20 6475 - Add mpls pop action with tc (invalid)
    ok 21 067b - Add mpls pop action with ttl (invalid)
    ok 22 7316 - Add mpls pop action with bos (invalid)
    ok 23 38cc - Add mpls push action with label
    ok 24 c281 - Add mpls push action with mpls_mc protocol
    ok 25 5db4 - Add mpls push action with label, tc and ttl
    ok 26 7c34 - Add mpls push action with label, tc ttl and cookie of max length
    ok 27 16eb - Add mpls push action with label and bos
    ok 28 d69d - Add mpls push action with no label (invalid)
    ok 29 e8e4 - Add mpls push action with ipv4 protocol (invalid)
    ok 30 ecd0 - Add mpls push action with out of range label (invalid)
    ok 31 d303 - Add mpls push action with out of range tc (invalid)
    ok 32 fd6e - Add mpls push action with ttl of 0 (invalid)
    ok 33 19e9 - Add mpls mod action with mpls label
    ok 34 1fde - Add mpls mod action with max mpls label
    ok 35 0c50 - Add mpls mod action with mpls label exceeding max (invalid)
    ok 36 10b6 - Add mpls mod action with mpls label of MPLS_LABEL_IMPLNULL (invalid)
    ok 37 57c9 - Add mpls mod action with mpls min tc
    ok 38 6872 - Add mpls mod action with mpls max tc
    ok 39 a70a - Add mpls mod action with mpls tc exceeding max (invalid)
    ok 40 6ed5 - Add mpls mod action with mpls ttl
    ok 41 77c1 - Add mpls mod action with mpls ttl and cookie
    ok 42 b80f - Add mpls mod action with mpls max ttl
    ok 43 8864 - Add mpls mod action with mpls min ttl
    ok 44 6c06 - Add mpls mod action with mpls ttl of 0 (invalid)
    ok 45 b5d8 - Add mpls mod action with mpls ttl exceeding max (invalid)
    ok 46 451f - Add mpls mod action with mpls max bos
    ok 47 a1ed - Add mpls mod action with mpls min bos
    ok 48 3dcf - Add mpls mod action with mpls bos exceeding max (invalid)
    ok 49 db7c - Add mpls mod action with protocol (invalid)
    ok 50 b070 - Replace existing mpls push action with new ID
    ok 51 95a9 - Replace existing mpls push action with new label, tc, ttl and cookie
    ok 52 6cce - Delete mpls pop action
    ok 53 d138 - Flush mpls actions
    
    Fixes: 2a2ea508 ("net: sched: add mpls manipulation actions to TC")
    Reviewed-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: default avatarPedro Tammela <pctammela@mojatatu.com>
    Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e88d78a7
act_mpls.c 12.7 KB