]> git.proxmox.com Git - mirror_iproute2.git/commit
tc: Correct json output for actions
authorYuval Mintz <yuvalm@mellanox.com>
Wed, 4 Apr 2018 12:24:13 +0000 (15:24 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 4 Apr 2018 23:41:36 +0000 (16:41 -0700)
commit0927bf83e7632f5c5a2c0eb77592955d61f8aea4
tree265bb28605a3e7a8210bc19a5a86ad2718b212f4
parent2f75c5cf1af2a090bbc50e34742cb12c426e135d
tc: Correct json output for actions

Commit 9fd3f0b255d9 ("tc: enable json output for actions") added JSON
support for tc-actions at the expense of breaking other use cases that
reach tc_print_action(), as the latter don't expect the 'actions' array
to be a new object.

Consider the following taken duringrun of tc_chain.sh selftest,
and see the latter command output is broken:

$ ./tc/tc -j -p actions list action gact | grep -C 3 actions
[ {
        "total acts": 1
    },{
        "actions": [ {
                "order": 0,

$ ./tc/tc -p -j -s filter show dev enp3s0np2 ingress | grep -C 3 actions
            },
            "skip_hw": true,
            "not_in_hw": true,{
                "actions": [ {
                        "order": 1,
                        "kind": "gact",
                        "control_action": {

Relocate the open/close of the JSON object to declare the object only
for the case that needs it.

Signed-off-by: Yuval Mintz <yuvalm@mellanox.com>
Tested-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/m_action.c