]> git.ipfire.org Git - thirdparty/iproute2.git/commit
tc: Fix binding of gact action by index.
authorRoman Mashak <mrv@mojatatu.com>
Thu, 6 Jun 2019 21:32:09 +0000 (17:32 -0400)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 6 Jun 2019 21:41:31 +0000 (14:41 -0700)
commitfa495889731430ebf3f4d054cec221b9a8eb483e
tree2caeab56a0e241e13fcd8a20ed256a42aeced092
parent2cc10ce81d22676a3eff02dd57dd524828489449
tc: Fix binding of gact action by index.

The following operation fails:
% sudo tc actions add action pipe index 1
% sudo tc filter add dev lo parent ffff: \
       protocol ip pref 10 u32 match ip src 127.0.0.2 \
       flowid 1:10 action gact index 1

Bad action type index
Usage: ... gact <ACTION> [RAND] [INDEX]
Where:  ACTION := reclassify | drop | continue | pass | pipe |
                  goto chain <CHAIN_INDEX> | jump <JUMP_COUNT>
        RAND := random <RANDTYPE> <ACTION> <VAL>
        RANDTYPE := netrand | determ
        VAL : = value not exceeding 10000
        JUMP_COUNT := Absolute jump from start of action list
        INDEX := index value used

However, passing a control action of gact rule during filter binding works:

% sudo tc filter add dev lo parent ffff: \
       protocol ip pref 10 u32 match ip src 127.0.0.2 \
       flowid 1:10 action gact pipe index 1

Binding by reference, i.e. by index, has to consistently work with
any tc action.

Since tc is sensitive to the order of keywords passed on the command line,
we can teach gact to skip parsing arguments as soon as it sees 'gact'
followed by 'index' keyword.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/m_gact.c