netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Denis Gubin <denis.gubin@gmail.com>, netdev@vger.kernel.org
Subject: Re: tc -j filter show with actions is not json valid
Date: Thu, 13 Aug 2020 11:53:13 +0200	[thread overview]
Message-ID: <87sgcqub1y.fsf@toke.dk> (raw)
In-Reply-To: <CAE_-sd=_2Skp4wY51rerHopU0ZiKPDxQ5Hd0F8qZTOrC7qNYRg@mail.gmail.com>

Denis Gubin <denis.gubin@gmail.com> writes:

> Hello everybody!
>
> Could you help me, please?
>
> I use Debian 10 and iproute2 version iproute2
>
> dpkg -l iproute2
> iproute2       4.20.0-2 amd64
>
> My problem is this:
> I can't convert "tc -j filter show u32" command to  json format.
> Here it is command:
> tc qdisc add dev eno1 ingress
> tc filter add dev eno1 parent ffff: protocol all u32 match u8 0 0
> action mirred egress mirror dev lo
>
> Have a look:
>
> ~$ tc -j filter show parent ffff: dev eno1
> [{
>         "protocol": "all",
>         "pref": 49152,
>         "kind": "u32",
>         "chain": 0
>     },{
>         "protocol": "all",
>         "pref": 49152,
>         "kind": "u32",
>         "chain": 0,
>         "options": {fh 800: ht divisor 1 }
>     },{
>         "protocol": "all",
>         "pref": 49152,
>         "kind": "u32",
>         "chain": 0,
>         "options": {fh 800::800 order 2048 key ht 800 bkt 0 terminal
> flowid ??? not_in_hw
>   match 00000000/00000000 at 0
>             "actions": [{
>                     "order": 1,
>                     "kind": "mirred",
>                     "mirred_action": "mirror",
>                     "direction": "egress",
>                     "to_dev": "lo",
>                     "control_action": {
>                         "type": "pipe"
>                     },
>                     "index": 1,
>                     "ref": 1,
>                     "bind": 1
>                 }]
>         }
>     }
> ]
>
>
> May be problem when there is actions in tc filter the problem is... I
> don't know about it.
> Have a look:
>
> "options": {fh 800::800 order 2048 key ht 800 bkt 0 terminal flowid
> ??? not_in_hw
>   match 00000000/00000000 at 0
>     "actions":

Looks like the u32 filter code hasn't been converted to JSON output at
all, yet.

> The json output is not valid.
> Has somebody made a patch for fix it?

Don't think so. But it's a fairly straight-forward thing to go through
f_u32.c and converting all the fprintf() calls to the various
print_XXX() functions if you want to give it a shot - just look at one
of the other files for how to use those functions :)

-Toke


      reply	other threads:[~2020-08-13  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 21:16 tc -j filter show with actions is not json valid Denis Gubin
2020-08-13  9:53 ` Toke Høiland-Jørgensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgcqub1y.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=denis.gubin@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).