[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD4GDZw-pL81FQmgKL9VBQ1pcHra_i-Ceje97y0ajXMoWvEuHw@mail.gmail.com>
Date: Fri, 16 May 2025 12:40:08 +0100
From: Donald Hunter <donald.hunter@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, andrew+netdev@...n.ch, horms@...nel.org,
daniel@...earbox.net, nicolas.dichtel@...nd.com, jacob.e.keller@...el.com,
bpf@...r.kernel.org
Subject: Re: [PATCH net-next 9/9] tools: ynl: add a sample for rt-link
On Fri, 16 May 2025 at 00:17, Jakub Kicinski <kuba@...nel.org> wrote:
>
> Add a fairly complete example of rt-link usage. If run without any
> arguments it simply lists the interfaces and some of their attrs.
> If run with an arg it tries to create and delete a netkit device.
>
> 1 # ./tools/net/ynl/samples/rt-link 1
> 2 Trying to create a Netkit interface
> 3 Testing error message for policy being bad:
> 4 Kernel error: 'Provided default xmit policy not supported' (bad attribute: .linkinfo.data(netkit).policy)
> 5 1: lo: mtu 65536
> 6 2: wlp0s1: mtu 1500
> 7 3: enp0s13: mtu 1500
> 8 4: dummy0: mtu 1500 kind dummy altname one two
> 9 5: nk0: mtu 1500 kind netkit primary 0 policy forward
> 10 6: nk1: mtu 1500 kind netkit primary 1 policy blackhole
> 11 Trying to delete a Netkit interface (ifindex 6)
>
> Sample creates the device first, it sets an invalid value for a netkit
> attribute to trigger reverse parsing. Line 4 shows the error with the
> attribute path correctly generated by YNL.
>
> Then sample fixes the bad attribute and re-issues the request, with
> NLM_F_ECHO set. This flag causes the notification to be looped back
> to the initiating socket (our socket). Sample parses this notification
> to save the ifindex of the created netkit.
>
> Sample then proceeds to list the devices. Line 8 above shows a dummy
> device with two alt names. Lines 9 and 10 show the netkit devices
> the sample itself created.
>
> The "primary" and "policy" attrs are from inside the netkit submsg.
> The string values are auto-generated for the enums by YNL.
>
> To clean up sample deletes the interface it created (line 11).
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
Reviewed-by: Donald Hunter <donald.hunter@...il.com>
Powered by blists - more mailing lists