lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201029131718.39b87b03@hermes.local>
Date:   Thu, 29 Oct 2020 13:17:18 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Puneet Sharma <pusharma@...mai.com>
Cc:     dsahern@...nel.org, netdev@...r.kernel.org
Subject: Re: [PATCH iproute2] tc: add print options to fix json output

On Wed, 28 Oct 2020 14:35:54 -0400
Puneet Sharma <pusharma@...mai.com> wrote:

> Currently, json for basic rules output does not produce correct json
> syntax. The following fixes were done to correct it for extended
> matches for use with "basic" filters.
> 
> tc/f_basic.c: replace fprintf with print_uint to support json output.
> fixing this prints "handle" tag correctly in json output.
> 
> tc/m_ematch.c: replace various fprintf with correct print.
> add new "ematch" tag for json output which represents
> "tc filter add ... basic match '()'" string. Added print_raw_string
> to print raw string instead of key value for json.
> 
> lib/json_writer.c: add jsonw_raw_string to print raw text in json.
> 
> lib/json_print.c: add print_color_raw_string to print string
> depending on context.
> 
> example:
> $ tc -s -d -j filter show dev <eth_name> ingress
> Before:
> ...
> "options": {handle 0x2
>   (
>     cmp(u8 at 9 layer 1 eq 6)
>     OR cmp(u8 at 9 layer 1 eq 17)
>   ) AND ipset(test-ipv4 src)
> 
>             "actions": [{
> ...
> 
> After:
> [{
> ...
> "options": {
>     "handle": 1,
>     "ematch": "(cmp(u8 at 9 layer 1 eq 6)OR cmp(u8 at 9 layer 1 eq 17)) AND ipset(test-ipv4 src)",
> ...
> ]
> 
> Signed-off-by: Puneet Sharma <pusharma@...mai.com>
> ---

What is the point of introducing raw string?
The JSON standard says that string fields must use proper escapes.

Please  don't emit invalid JSON. It will break consumption by other libraries.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ