[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ca16c842-94a3-c081-19f9-59c9349d0cf3@blackwall.org>
Date: Thu, 30 Sep 2021 10:10:36 +0300
From: Nikolay Aleksandrov <razor@...ckwall.org>
To: David Ahern <dsahern@...il.com>, netdev@...r.kernel.org
Cc: roopa@...dia.com, donaldsharp72@...il.com, idosch@...sch.org,
Nikolay Aleksandrov <nikolay@...dia.com>
Subject: Re: [RFC iproute2-next 05/11] ip: nexthop: always parse attributes
for printing
On 30/09/2021 06:37, David Ahern wrote:
> On 9/29/21 9:28 AM, Nikolay Aleksandrov wrote:
>> @@ -481,56 +457,61 @@ int print_nexthop(struct nlmsghdr *n, void *arg)
>> if (filter.proto && filter.proto != nhm->nh_protocol)
>> return 0;
>>
>> - parse_rtattr_flags(tb, NHA_MAX, RTM_NHA(nhm), len, NLA_F_NESTED);
>> -
>> + err = parse_nexthop_rta(fp, nhm, len, &nhe);
>> + if (err) {
>> + close_json_object();
>> + fprintf(stderr, "Error parsing nexthop: %s\n", strerror(err));
>> + return -1;
>> + }
>
> so you are doing that but in reverse order. Re-order the patches such
> that existing code is refactored with the parse functions first.
>
I added the parse functions first without any functional changes and converted
the existing printing code to use them in this patch after that. I don't mind
doing the conversion after each parse function is added, too.
Powered by blists - more mailing lists