Subject: Re: [PATCH net-next 2/2] ynl: support un-nest sub-type for indexed-array

From: Jakub Kicinski <[email-masked]>
Date: Thu, 28 Mar 2024 09:04:15 -0700

On Thu, 28 Mar 2024 15:41:53 +0800 Hangbin Liu wrote:
> >  # ip link add bond0 type bond mode 1 \
> >    arp_ip_target 192.168.1.1,192.168.1.2 ns_ip6_target 2001::1,2001::2
> >  # ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_link.yaml \
> >    --do getlink --json '{"ifname": "bond0"}' --output-json | jq '.linkinfo'
> > 
> >     "arp-ip-target": [
> >       {
> >         "1": "192.168.1.1"
> >       },
> >       {
> >         "2": "192.168.1.2"
> >       }
> >     ],  
> 
> For index array, do you think if we need to add the index in the result
> like upper example? Or we just omit the index and show it like:

Yes, the index in some funny dumps can actually be non-contiguous.
You should use the value from the attr, like the nest does.