]> git.ipfire.org Git - thirdparty/iproute2.git/commit
tc: simple: don't hardcode the control action
authorDavide Caratti <dcaratti@redhat.com>
Tue, 4 Jun 2019 22:30:16 +0000 (00:30 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 6 Jun 2019 21:43:08 +0000 (14:43 -0700)
commit0ee4d17954f665276e9216c0ec7650ff74b0709d
treef915d73f927801324af00308dd65de3c053018e2
parentfa495889731430ebf3f4d054cec221b9a8eb483e
tc: simple: don't hardcode the control action

the following TDC test case:

 b776 - Replace simple action with invalid goto chain control

checks if the kernel correctly validates the 'goto chain' control action,
when it is specified in 'act_simple' rules. The test systematically fails
because the control action is hardcoded in parse_simple(), i.e. it is not
parsed by command line arguments, so its value is constantly TC_ACT_PIPE.
Because of that, the following command:

 # tc action add action simple sdata "test" drop index 7

installs an 'act_simple' rule that never drops packets, and whose 'index'
is the first IDR available, plus an 'act_gact' rule with 'index' equal to
7, that drops packets.

Use parse_action_control_dflt(), like we did on many other TC actions, to
make the control action configurable also with 'act_simple'. The expected
results of test b776 are summarized below:

 iproute2
   v       kernel->| 5.1-rc2 (and previous)  | 5.1-rc3 (and subsequent)
 ------------------+-------------------------+-------------------------
 5.1.0             | FAIL (bad IDR)          | FAIL (bad IDR)
 5.1.0(patched)    | FAIL (no rule/bad sdata)| PASS

Changes since v1:
 - reword commit message, thanks Stephen Hemminger

Fixes: 087f46ee4ebd ("tc: introduce simple action")
CC: Andrea Claudi <aclaudi@redhat.com>
CC: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/m_simple.c