Subject: Re: [PATCH iproute2-next v4 1/1] police: Add support for json output

From: David Ahern <[email-masked]>
Date: Sun, 11 Jul 2021 10:00:41 -0600

On 7/11/21 4:24 AM, Roi Dayan wrote:
> 
> 
> On 2021-07-08 5:46 PM, David Ahern wrote:
>> On 7/8/21 12:57 AM, Roi Dayan wrote:
>>>
>>>
>>> On 2021-07-07 9:53 AM, Hangbin Liu wrote:
>>>> On Tue, Jul 06, 2021 at 10:27:34AM +0200, Davide Caratti wrote:
>>>>> my 2 cents:
>>>>>
>>>>> what about using PRINT_FP / PRINT_JSON, so we fix the JSON output
>>>>> only to show "index", and
>>>>> preserve the human-readable printout iproute and kselftests? besides
>>>>> avoiding failures because
>>>>> of mismatching kselftests / iproute, this would preserve
>>>>> functionality of scripts that
>>>>> configure / dump the "police" action. WDYT?
>>>>
>>>> +1
>>>>
>>>
>>>
>>> why not fix the kselftest to look for the correct output?
>>
>> That is but 1 user. The general rule is that you do not change the
>> output like you did.
>>
> 
> but the output was "broken" and not consistent with all actions.
> we are not fixing this kind of thing?

It has been in hex since 2004, and you can not decide in 2021 that it is
'broken' and change it.

> so to continue with the suggestion to use print_fp and keep police
> action output broken and print_json for the json output?
> just to be sure before submitting change back to old output for fp.
> 
> 
> ...
>         action order 1:  police 0x1 rate 1Mbit burst 20Kb mtu 2Kb action
> reclassify overhead 0b
> 
> 
> 
> 
> -       print_string(PRINT_ANY, "kind", "%s", "police");
> +       print_string(PRINT_JSON, "kind", "%s", "police");
> 
> -       print_uint(PRINT_ANY, "index", "\tindex %u ", p->index);
> +       print_hex(PRINT_FP, NULL, " police 0x%x ", p->index);
> +       print_uint(PRINT_JSON, "index", NULL, p->index);
> 
> 

Jamal: opinions?