| fbf5df34 | 10-May-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: add scope qualifier for definitions
Using definitions in kernel policies is awkward right now. On one hand we want defines for max values and such. On the other we don't have a way of ad
tools: ynl: add scope qualifier for definitions
Using definitions in kernel policies is awkward right now. On one hand we want defines for max values and such. On the other we don't have a way of adding kernel-only defines. Adding unnecessary defines to uAPI is a bad idea, we won't be able to delete them. And when it comes to policy user space should just query it via the policy dump, not use hard coded defines.
Add a "scope" property to definitions, which will let us tell the codegen that a definition is for kernel use only. Support following values: - uapi: render into the uAPI header (default, today's behavior) - kernel: render to kernel header only - user: same as kernel but for the user-side generated header
Definitions may have a header property (definition is "external", provided by existing header). Extend the scope to headers, too. If definition has both scope and header properties we will only generate the includes in the right scope.
Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20260510192904.3987113-8-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
| 121f4167 | 14-Apr-2026 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl: add sample for wireguard
Add a sample application for WireGuard, using the generated C library.
The main benefit of this is to exercise the generated library, which might be useful for
tools: ynl: add sample for wireguard
Add a sample application for WireGuard, using the generated C library.
The main benefit of this is to exercise the generated library, which might be useful for future self-tests.
Example: $ make -C tools/net/ynl/lib $ make -C tools/net/ynl/generated $ make -C tools/net/ynl/tests wireguard $ ./tools/net/ynl/tests/wireguard usage: ./tools/net/ynl/tests/wireguard <ifindex|ifname> $ sudo ./tools/net/ynl/tests/wireguard wg-test Interface 3: wg-test Peer 6adfb183a4a2c94a2f92dab5ade762a4788[...]: Data: rx: 42 / tx: 42 bytes Allowed IPs: 0.0.0.0/0 ::/0
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Link: https://patch.msgid.link/20260414153944.2742252-3-Jason@zx2c4.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 594ba447 | 08-Apr-2026 |
Hangbin Liu <liuhangbin@gmail.com> |
tools: ynl: ethtool: add --dbg-small-recv option
Add a --dbg-small-recv debug option to control the recv() buffer size used by YNL, matching the same option already present in cli.py. This is useful
tools: ynl: ethtool: add --dbg-small-recv option
Add a --dbg-small-recv debug option to control the recv() buffer size used by YNL, matching the same option already present in cli.py. This is useful if user need to get large netlink message.
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Link: https://patch.msgid.link/20260408-b4-ynl_ethtool-v2-3-7623a5e8f70b@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 1c43d471 | 08-Apr-2026 |
Hangbin Liu <liuhangbin@gmail.com> |
tools: ynl: ethtool: use doit instead of dumpit for per-device GET
Rename the local helper doit() to do_set() and dumpit() to do_get() to better reflect their purpose.
Convert do_get() to use ynl.d
tools: ynl: ethtool: use doit instead of dumpit for per-device GET
Rename the local helper doit() to do_set() and dumpit() to do_get() to better reflect their purpose.
Convert do_get() to use ynl.do() with an explicit device header instead of ynl.dump() followed by client-side filtering. This is more efficient as the kernel only processes and returns data for the requested device, rather than dumping all devices across the netns.
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Link: https://patch.msgid.link/20260408-b4-ynl_ethtool-v2-2-7623a5e8f70b@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| d6df5e9b | 10-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: cli: add --policy support
Add --policy flag which can be combined with --do or --dump to query the kernel's netlink policy for an operation instead of executing it.
Examples:
$ ynl -
tools: ynl: cli: add --policy support
Add --policy flag which can be combined with --do or --dump to query the kernel's netlink policy for an operation instead of executing it.
Examples:
$ ynl --family netdev --do dev-get --policy {'ifindex': {'max-value': 4294967295, 'min-value': 1, 'type': 'u32'}}
$ ynl --family ethtool --do channels-get --policy --output-json {"header": {"type": "nested", "policy": {"dev-index": ...}}}
$ ynl --family netdev --dump dev-get --policy {}
Link: https://patch.msgid.link/20260310005337.3594225-6-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 77a6401a | 10-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: add Python API for easier access to policies
The format of Netlink policy dump is a bit curious with messages in the same dump carrying both attrs and mapping info. Plus each message car
tools: ynl: add Python API for easier access to policies
The format of Netlink policy dump is a bit curious with messages in the same dump carrying both attrs and mapping info. Plus each message carries a single piece of the puzzle the caller must then reassemble.
I need to do this reassembly for a test, but I think it's generally useful. So let's add proper support to YnlFamily to return more user-friendly representation. See the various docs in the patch for more details.
Link: https://patch.msgid.link/20260310005337.3594225-5-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 8bbcfce5 | 10-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: add short doc to class YnlFamily
The class is quite long. It's getting hard to find the user-facing methods. Add a short doc at the class level explaining the main API.
Link: https://pa
tools: ynl: add short doc to class YnlFamily
The class is quite long. It's getting hard to find the user-facing methods. Add a short doc at the class level explaining the main API.
Link: https://patch.msgid.link/20260310005337.3594225-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| c26fda62 | 10-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: move policy decoding out of NlMsg
We'll soon need to decode policies from dump so move _decode_policy() out of class NlMsg.
Link: https://patch.msgid.link/20260310005337.3594225-3-kuba@
tools: ynl: move policy decoding out of NlMsg
We'll soon need to decode policies from dump so move _decode_policy() out of class NlMsg.
Link: https://patch.msgid.link/20260310005337.3594225-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| aa234faa | 07-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: convert rt-route sample to selftest
Convert rt-route.c to use kselftest_harness.h with FIXTURE/TEST_F. This is the last test to convert so clean up the Makefile.
Validate that the conne
tools: ynl: convert rt-route sample to selftest
Convert rt-route.c to use kselftest_harness.h with FIXTURE/TEST_F. This is the last test to convert so clean up the Makefile.
Validate that the connected routes for 192.168.1.0/24 and 2001:db8::/64 appear in the dump.
Output:
TAP version 13 1..1 # Starting 1 tests from 1 test cases. # RUN rt_route.dump ... # oif: nsim0 dst: 192.168.1.0/24 # oif: lo dst: ::1/128 # oif: nsim0 dst: 2001:db8::1/128 # oif: nsim0 dst: 2001:db8::/64 # oif: nsim0 dst: fe80::/64 # oif: nsim0 dst: ff00::/8 # OK rt_route.dump ok 1 rt_route.dump # PASSED: 1 / 1 tests passed. # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Tested-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260307033630.1396085-11-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| e7a39b8f | 07-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: convert rt-addr sample to selftest
Convert rt-addr.c to use kselftest_harness.h with FIXTURE/TEST_F.
Validate that the addresses configured by the wrapper (192.168.1.1 and 2001:db8::1)
tools: ynl: convert rt-addr sample to selftest
Convert rt-addr.c to use kselftest_harness.h with FIXTURE/TEST_F.
Validate that the addresses configured by the wrapper (192.168.1.1 and 2001:db8::1) appear in the dump.
Output:
TAP version 13 1..1 # Starting 1 tests from 1 test cases. # RUN rt_addr.dump ... # lo: 127.0.0.1 # nsim0: 192.168.1.1 # lo: ::1 # nsim0: 2001:db8::1 # nsim0: fe80::7c66:c9ff:fe5f:bf01 # OK rt_addr.dump ok 1 rt_addr.dump # PASSED: 1 / 1 tests passed. # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Tested-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260307033630.1396085-10-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 1419fbf5 | 07-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: convert ethtool sample to selftest
Convert ethtool.c to use kselftest_harness.h with FIXTURE/TEST_F. Move ethtool from BINS to TEST_GEN_FILES and add ethtool.sh wrapper which sets up a n
tools: ynl: convert ethtool sample to selftest
Convert ethtool.c to use kselftest_harness.h with FIXTURE/TEST_F. Move ethtool from BINS to TEST_GEN_FILES and add ethtool.sh wrapper which sets up a netdevsim device before running the test binary.
Output:
TAP version 13 1..2 # Starting 2 tests from 1 test cases. # RUN ethtool.channels ... # nsim0: combined 1 # OK ethtool.channels ok 1 ethtool.channels # RUN ethtool.rings ... # nsim0: rx 512 tx 512 # OK ethtool.rings ok 2 ethtool.rings # PASSED: 2 / 2 tests passed. # Totals: pass:2 fail:0 xfail:0 xpass:0 skip:0 error:0
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Tested-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260307033630.1396085-9-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| db20b374 | 07-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: convert devlink sample to selftest
Convert devlink.c to use kselftest_harness.h with FIXTURE/TEST_F. Move devlink from BINS to TEST_GEN_FILES in the Makefile since it's invoked via the d
tools: ynl: convert devlink sample to selftest
Convert devlink.c to use kselftest_harness.h with FIXTURE/TEST_F. Move devlink from BINS to TEST_GEN_FILES in the Makefile since it's invoked via the devlink.sh wrapper which sets up netdevsim.
Output:
TAP version 13 1..2 # Starting 2 tests from 1 test cases. # RUN devlink.dump ... # netdevsim/netdevsim1337 # OK devlink.dump ok 1 devlink.dump # RUN devlink.info ... # netdevsim/netdevsim1337: # driver: netdevsim # running fw: # fw.mgmt: 10.20.30 # OK devlink.info ok 2 devlink.info # PASSED: 2 / 2 tests passed. # Totals: pass:2 fail:0 xfail:0 xpass:0 skip:0 error:0
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Tested-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260307033630.1396085-8-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 7a95e525 | 07-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: add netdevsim wrapper library for YNL tests
Some tests need netdevsim setup which is painful to do from C.
Add ynl_nsim_lib.sh, a shared library providing nsim_setup and nsim_cleanup fu
tools: ynl: add netdevsim wrapper library for YNL tests
Some tests need netdevsim setup which is painful to do from C.
Add ynl_nsim_lib.sh, a shared library providing nsim_setup and nsim_cleanup functions for tests that need a netdevsim device.
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Tested-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260307033630.1396085-7-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 6cf8fb47 | 07-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: convert tc and tc-filter-add samples to selftest
Convert tc.c and tc-filter-add.c to produce KTAP output with kselftest_harness. Merge the two tests together. They both test TC one is te
tools: ynl: convert tc and tc-filter-add samples to selftest
Convert tc.c and tc-filter-add.c to produce KTAP output with kselftest_harness. Merge the two tests together. They both test TC one is testing qdisc and the other classifiers but they can easily live in a single selftest.
Make the test spawn a new netns, and run the operations on lo to avoid onerous setup and cleanup.
TAP version 13 1..2 # Starting 2 tests from 1 test cases. # RUN tc.qdisc ... # lo: fq_codel limit: 10240p target: 5ms new_flow_cnt: 0 # OK tc.qdisc ok 1 tc.qdisc # RUN tc.flower ... # flower pref 1 proto: 0x8100 # flower: # vlan_id: 100 # vlan_prio: 5 # num_of_vlans: 3 # action order: 1 vlan push id 200 protocol 0x8100 priority 0 # action order: 2 vlan push id 300 protocol 0x8100 priority 0 # OK tc.flower ok 2 tc.flower # PASSED: 2 / 2 tests passed. # Totals: pass:2 fail:0 xfail:0 xpass:0 skip:0 error:0
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Tested-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260307033630.1396085-6-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 5c320678 | 07-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: convert rt-link sample to selftest
Convert rt-link.c to use kselftest_harness.h with FIXTURE/TEST_F. Move rt-link from BINS to TEST_GEN_PROGS.
Output:
TAP version 13 1..3 # Start
tools: ynl: convert rt-link sample to selftest
Convert rt-link.c to use kselftest_harness.h with FIXTURE/TEST_F. Move rt-link from BINS to TEST_GEN_PROGS.
Output:
TAP version 13 1..3 # Starting 3 tests from 1 test cases. # RUN rt_link.dump ... # 1: lo: mtu 65536 # 2: sit0: mtu 1480 kind sit # OK rt_link.dump ok 1 rt_link.dump # RUN rt_link.netkit ... # 4: nk1: mtu 1500 kind netkit primary 1 policy blackhole # OK rt_link.netkit ok 2 rt_link.netkit # RUN rt_link.netkit_err_msg ... # OK rt_link.netkit_err_msg ok 3 rt_link.netkit_err_msg # PASSED: 3 / 3 tests passed. # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Tested-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260307033630.1396085-5-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 7e3effbc | 07-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: convert ovs sample to selftest
Convert ovs.c to produce KTAP output with kselftest_harness. The single "crud" test creates a new OVS datapath, fetches it back by name, then dumps all dat
tools: ynl: convert ovs sample to selftest
Convert ovs.c to produce KTAP output with kselftest_harness. The single "crud" test creates a new OVS datapath, fetches it back by name, then dumps all datapaths verifying the new one appears.
IIRC I added this test because ovs is a genetlink family but has a family-specific fixed header.
TAP version 13 1..1 # Starting 1 tests from 1 test cases. # RUN ovs.crud ... # get: # ynl-test(3): pid:0 cache:256 # dump: # ynl-test(3): pid:0 cache:256 # OK ovs.crud ok 1 ovs.crud # PASSED: 1 / 1 tests passed. # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Tested-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260307033630.1396085-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 285804d6 | 07-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: convert netdev sample to selftest
Convert netdev.c to produce KTAP output with 3 tests: - dev_dump: dump all netdev devices, skip if empty - dev_get: query first device from dump by ifin
tools: ynl: convert netdev sample to selftest
Convert netdev.c to produce KTAP output with 3 tests: - dev_dump: dump all netdev devices, skip if empty - dev_get: query first device from dump by ifindex - ntf_check: subscribe to "mgmt", create a veth via rt-link, verify netdev notification is received, then delete the veth
Remove stdin/scanf-based UI. Add rt-link dependency for the veth notification test.
TAP version 13 1..3 # Starting 3 tests from 1 test cases. # RUN netdev.dump ... # lo[1] xdp-features (0): xdp-rx-metadata-features (0): xsk-fea... # sit0[2] xdp-features (0): xdp-rx-metadata-features (0): xsk-fea... # OK netdev.dump ok 1 netdev.dump # RUN netdev.get ... # lo[1] xdp-features (0): xdp-rx-metadata-features (0): xsk-fea... # OK netdev.get ok 2 netdev.get # RUN netdev.ntf_check ... # veth0[7] xdp-features (0): xdp-rx-metadata-features (7): timesta... # OK netdev.ntf_check ok 3 netdev.ntf_check # PASSED: 3 / 3 tests passed. # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Tested-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260307033630.1396085-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|