[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210907122914.34b5b1a1@hermes.local>
Date: Tue, 7 Sep 2021 12:29:14 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Wen Liang <liangwen12year@...il.com>
Cc: netdev@...r.kernel.org, dsahern@...il.com, aclaudi@...hat.com
Subject: Re: [PATCH iproute2 1/2] tc: u32: add support for json output
On Mon, 6 Sep 2021 21:57:50 -0400
Wen Liang <liangwen12year@...il.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
Powered by blists - more mailing lists