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]
Date: Mon, 12 Feb 2024 20:16:09 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Takanori Hirano <me@...tknr.net>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] tc: Support json option in tc-cgroup, tc-flow and
 tc-route

On Sun, 11 Feb 2024 00:59:41 +0000
Takanori Hirano <me@...tknr.net> wrote:

> +	if (tb[TCA_ROUTE4_TO]) {
> +		open_json_object("to");
> +		print_string(
> +			PRINT_ANY, "name", "to %s ",
> +			rtnl_rtrealm_n2a(rta_getattr_u32(tb[TCA_ROUTE4_TO]), b1,
> +					 sizeof(b1)));
> +		print_uint(PRINT_JSON, "id", NULL,
> +			   rta_getattr_u32(tb[TCA_ROUTE4_TO]));
> +		close_json_object();
> +	}
> +	if (tb[TCA_ROUTE4_FROM]) {
> +		open_json_object("from");
> +		print_string(
> +			PRINT_ANY, "name", "from %s ",
> +			rtnl_rtrealm_n2a(rta_getattr_u32(tb[TCA_ROUTE4_FROM]),
> +					 b1, sizeof(b1)));
> +		print_uint(PRINT_JSON, "id", NULL,
> +			   rta_getattr_u32(tb[TCA_ROUTE4_FROM]));
> +		close_json_object();
>  	}

Both to and from don't need to be sub-objects, simpler to just print
as to and from. Also, avoid unnecessary line breaks in source.

		print_string(PRINT_ANY, "from", "from %s ",
			     rtln_rtrealm_n2a...

> +		print_string(
> +			PRINT_ANY, "fromif", "fromif %s",
> +			ll_index_to_name(rta_getattr_u32(tb[TCA_ROUTE4_IIF])));

This looks like a good place to add color:
		print_color_string(PRINT_ANY, COLOR_IFNAME, "fromif", "fromif %s",
				   ll_indext_to_name...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ