Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Wen Liang <liangwen12year@gmail.com>
Cc: netdev@vger.kernel.org, dsahern@gmail.com, aclaudi@redhat.com
Subject: Re: [PATCH iproute2 1/2] tc: u32: add support for json output
Date: Tue, 7 Sep 2021 12:29:14 -0700 [thread overview]
Message-ID: <20210907122914.34b5b1a1@hermes.local> (raw)
In-Reply-To: <5c4108ba5d3c30a0366ad79b49e1097bd9cc96e1.1630978600.git.liangwen12year@gmail.com>
On Mon, 6 Sep 2021 21:57:50 -0400
Wen Liang <liangwen12year@gmail.com> wrote:
> } else {
> - fprintf(f, "??? ");
> + print_string(PRINT_ANY, NULL, "%s", "??? ");
> }
This would be better handled by printing a real error message
on stderr, rather than continuing this confusing message.
+ print_lluint(PRINT_ANY, "rule hit", "(rule hit %llu ", (unsigned long long) pf->rcnt);
+ print_lluint(PRINT_ANY, "success", "success %llu)", (unsigned long long) pf->rhit);
+ }
There is print_u64 which is better than doing these casts.
+ print_hex(PRINT_ANY, "offset mask", "%04x", ntohs(sel->offmask));
+ print_int(PRINT_ANY, "offset shift", ">>%d ", sel->offshift);
+ print_int(PRINT_ANY, "offset off", "at %d ", sel->offoff);
Space is not valid in JSON tag.
Please test by running the output from your changes into a JSON parser.
Example:
tc -j ... | python3 -m json.tool
next prev parent reply other threads:[~2021-09-07 19:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-07 1:57 [PATCH iproute2 0/2] add json support on tc u32 Wen Liang
2021-09-07 1:57 ` [PATCH iproute2 1/2] tc: u32: add support for json output Wen Liang
2021-09-07 15:46 ` Davide Caratti
2021-09-07 19:29 ` Stephen Hemminger [this message]
2021-09-07 19:32 ` Thorsten Glaser
2021-09-07 20:55 ` Stephen Hemminger
2021-09-08 1:18 ` David Ahern
2021-09-07 1:57 ` [PATCH iproute2 2/2] tc: u32: add json support in `print_raw`, `print_ipv4`, `print_ipv6` Wen Liang
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=20210907122914.34b5b1a1@hermes.local \
--to=stephen@networkplumber.org \
--cc=aclaudi@redhat.com \
--cc=dsahern@gmail.com \
--cc=liangwen12year@gmail.com \
--cc=netdev@vger.kernel.org \
--subject='Re: [PATCH iproute2 1/2] tc: u32: add support for json output' \
/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
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).