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: <a745235f-ff64-3f7f-1264-198649795856@nvidia.com>
Date:   Thu, 3 Jun 2021 10:27:55 +0300
From:   Roi Dayan <roid@...dia.com>
To:     David Ahern <dsahern@...il.com>, <netdev@...r.kernel.org>,
        "Stephen Hemminger" <stephen@...workplumber.org>,
        Jamal Hadi Salim <jhs@...atatu.com>
CC:     Paul Blakey <paulb@...dia.com>
Subject: Re: [PATCH iproute2-next] police: Add support for json output



On 2021-06-02 5:29 PM, David Ahern wrote:
> On 5/27/21 7:07 AM, Roi Dayan wrote:
>> @@ -300,13 +300,13 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
>>   	    RTA_PAYLOAD(tb[TCA_POLICE_RATE64]) >= sizeof(rate64))
>>   		rate64 = rta_getattr_u64(tb[TCA_POLICE_RATE64]);
>>   
>> -	fprintf(f, " police 0x%x ", p->index);
>> +	print_int(PRINT_ANY, "police", "police %d ", p->index);
> 
> this changes the output format from hex to decimal.
> 

hmm thanks for the review. actually I see another issue with this.
I missed this but this should actually be split into "kind" and "index".
And index should be unsigned as the other actions.
so we should have kind printed at the top of the function even if arg
is null and index here.

         print_string(PRINT_ANY, "kind", "%s", "police"); 

         if (arg == NULL) 

                 return 0;
...
         print_uint(PRINT_ANY, "index", "\t index %u ", p->index); 



then the json output should be this

            "actions": [ {
                     "order": 1,
                     "kind": "police",
                     "index": 1,


i'll send v2.


> 
>>   	tc_print_rate(PRINT_FP, NULL, "rate %s ", rate64);
>>   	buffer = tc_calc_xmitsize(rate64, p->burst);
>>   	print_size(PRINT_FP, NULL, "burst %s ", buffer);
>>   	print_size(PRINT_FP, NULL, "mtu %s ", p->mtu);
>>   	if (show_raw)
>> -		fprintf(f, "[%08x] ", p->burst);
>> +		print_hex(PRINT_FP, NULL, "[%08x] ", p->burst);
>>   
>>   	prate64 = p->peakrate.rate;
>>   	if (tb[TCA_POLICE_PEAKRATE64] &&
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ