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:   Mon, 22 Jul 2019 20:11:49 +0000
From:   "Patel, Vedang" <vedang.patel@...el.com>
To:     David Ahern <dsahern@...il.com>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Jiri Pirko <jiri@...nulli.us>,
        Stephen Hemminger <stephen@...workplumber.org>,
        "Gomes, Vinicius" <vinicius.gomes@...el.com>,
        "Dorileo, Leandro" <leandro.maciel.dorileo@...el.com>
Subject: Re: [PATCH iproute2] etf: make printing of variable JSON friendly



> On Jul 22, 2019, at 11:21 AM, David Ahern <dsahern@...il.com> wrote:
> 
> On 7/19/19 3:40 PM, Vedang Patel wrote:
>> In iproute2 txtime-assist series, it was pointed out that print_bool()
>> should be used to print binary values. This is to make it JSON friendly.
>> 
>> So, make the corresponding changes in ETF.
>> 
>> Fixes: 8ccd49383cdc ("etf: Add skip_sock_check")
>> Reported-by: Stephen Hemminger <stephen@...workplumber.org>
>> Signed-off-by: Vedang Patel <vedang.patel@...el.com>
>> ---
>> tc/q_etf.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>> 
>> diff --git a/tc/q_etf.c b/tc/q_etf.c
>> index c2090589bc64..307c50eed48b 100644
>> --- a/tc/q_etf.c
>> +++ b/tc/q_etf.c
>> @@ -176,12 +176,12 @@ static int etf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
>> 		     get_clock_name(qopt->clockid));
>> 
>> 	print_uint(PRINT_ANY, "delta", "delta %d ", qopt->delta);
>> -	print_string(PRINT_ANY, "offload", "offload %s ",
>> -				(qopt->flags & TC_ETF_OFFLOAD_ON) ? "on" : "off");
>> -	print_string(PRINT_ANY, "deadline_mode", "deadline_mode %s ",
>> -				(qopt->flags & TC_ETF_DEADLINE_MODE_ON) ? "on" : "off");
>> -	print_string(PRINT_ANY, "skip_sock_check", "skip_sock_check %s",
>> -				(qopt->flags & TC_ETF_SKIP_SOCK_CHECK) ? "on" : "off");
>> +	if (qopt->flags & TC_ETF_OFFLOAD_ON)
>> +		print_bool(PRINT_ANY, "offload", "offload ", true);
>> +	if (qopt->flags & TC_ETF_DEADLINE_MODE_ON)
>> +		print_bool(PRINT_ANY, "deadline_mode", "deadline_mode ", true);
>> +	if (qopt->flags & TC_ETF_SKIP_SOCK_CHECK)
>> +		print_bool(PRINT_ANY, "skip_sock_check", "skip_sock_check", true);
>> 
>> 	return 0;
>> }
>> 
> 
> This changes existing output for TC_ETF_OFFLOAD_ON and
> TC_ETF_DEADLINE_MODE_ON which were added a year ago.
Yes, this is a good point. I missed that. 

Another idea is to use is_json_context() and call print_bool() there. But, that will still change values corresponding to the json output for the above flags from “on”/“off” to “true”/“false”. I am not sure if this is a big issue. 

My suggestion is to keep the code as is. what do you think?

Thanks,
Vedang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ