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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180713135941.3791c3ff@xeon-e3>
Date:   Fri, 13 Jul 2018 13:59:41 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc:     alexei.starovoitov@...il.com, daniel@...earbox.net,
        dsahern@...il.com, netdev@...r.kernel.org,
        oss-drivers@...ronome.com
Subject: Re: [PATCH iproute2-next] iplink: add support for reporting
 multiple XDP programs

On Fri, 13 Jul 2018 13:43:59 -0700
Jakub Kicinski <jakub.kicinski@...ronome.com> wrote:

>  
> +static void xdp_dump_prog_one(FILE *fp, struct rtattr *tb[IFLA_XDP_MAX + 1],
> +			      __u32 attr, bool link, bool details, char *pfx)
> +{
> +	__u32 prog_id;
> +
> +	if (!tb[attr])
> +		return;
> +
> +	prog_id = rta_getattr_u32(tb[attr]);
> +	if (!details) {
> +		if (prog_id && !link && attr == IFLA_XDP_PROG_ID)
> +			fprintf(fp, "/id:%u", prog_id);
> +		return;
> +	}
> +
> +	if (prog_id) {
> +		fprintf(fp, "%s    prog/xdp%s ", _SL_, pfx);
> +		bpf_dump_prog_info(fp, prog_id);
> +	}

Maybe const char *pfx.

I prefer to not use "printf(fp," and use print_string(PRINT_FP, NULL, "%s", ...)
because otherwise you end up mixing strings and json format output in the
same result.

You should be able to do
	tc -j ... 
and always get valid JSON output.

One quick way to test json validation is to pipe it into python:
	tc -j ... | python -mjson.tool

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ