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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 6 Mar 2018 17:51:49 -0800
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Jesus Sanchez-Palencia <jesus.sanchez-palencia@...el.com>
Cc:     netdev@...r.kernel.org, jhs@...atatu.com, xiyou.wangcong@...il.com,
        jiri@...nulli.us, Vinicius Costa Gomes <vinicius.gomes@...el.com>
Subject: Re: [RFC v3 iproute2 3/3] tc: Add support for the TBS Qdisc

On Tue,  6 Mar 2018 17:16:08 -0800
Jesus Sanchez-Palencia <jesus.sanchez-palencia@...el.com> wrote:

> atic int tbs_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
> +{
> +	struct rtattr *tb[TCA_TBS_MAX+1];
> +	struct tc_tbs_qopt *qopt;
> +
> +	if (opt == NULL)
> +		return 0;
> +
> +	parse_rtattr_nested(tb, TCA_TBS_MAX, opt);
> +
> +	if (tb[TCA_TBS_PARMS] == NULL)
> +		return -1;
> +
> +	qopt = RTA_DATA(tb[TCA_TBS_PARMS]);
> +	if (RTA_PAYLOAD(tb[TCA_TBS_PARMS])  < sizeof(*qopt))
> +		return -1;
> +
> +	fprintf(f, "clockid ");
> +	if (qopt->clockid == CLOCKID_INVALID)
> +		fprintf(f, "invalid ");
> +	else
> +		fprintf(f, "%d ", qopt->clockid);
> +
> +	fprintf(f, "delta %d ", qopt->delta);
> +	fprintf(f, "offload %s ", (qopt->flags & TC_TBS_OFFLOAD_ON) ?
> +					"on" : "off");
> +	fprintf(f, "sorting %s", (qopt->flags & TC_TBS_SORTING_ON) ?
> +					"on" : "off");
> +
> +	return 0;
> +}

All new print code in iproute2 should support JSON output.
Look at other code using json_print.h for simple way to handle this.

Powered by blists - more mailing lists