<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/testing/selftests/net/lib.sh, branch linux-6.15.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2025-07-17T16:43:59Z</updated>
<entry>
<title>selftests: net: lib: fix shift count out of range</title>
<updated>2025-07-17T16:43:59Z</updated>
<author>
<name>Hangbin Liu</name>
</author>
<published>2025-07-09T09:12:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a16f5543b01aa2b420beafdb28b78f3757a92d1e'/>
<id>urn:sha1:a16f5543b01aa2b420beafdb28b78f3757a92d1e</id>
<content type='text'>
[ Upstream commit 47c84997c686b4d43b225521b732492552b84758 ]

I got the following warning when writing other tests:

  + handle_test_result_pass 'bond 802.3ad' '(lacp_active off)'
  + local 'test_name=bond 802.3ad'
  + shift
  + local 'opt_str=(lacp_active off)'
  + shift
  + log_test_result 'bond 802.3ad' '(lacp_active off)' ' OK '
  + local 'test_name=bond 802.3ad'
  + shift
  + local 'opt_str=(lacp_active off)'
  + shift
  + local 'result= OK '
  + shift
  + local retmsg=
  + shift
  /net/tools/testing/selftests/net/forwarding/../lib.sh: line 315: shift: shift count out of range

This happens because an extra shift is executed even after all arguments
have been consumed. Remove the last shift in log_test_result() to avoid
this warning.

Fixes: a923af1ceee7 ("selftests: forwarding: Convert log_test() to recognize RET values")
Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Link: https://patch.msgid.link/20250709091244.88395-1-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: net: use netdevsim in netns test</title>
<updated>2025-04-03T22:32:09Z</updated>
<author>
<name>Stanislav Fomichev</name>
</author>
<published>2025-04-01T16:34:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=56c8a23f8a0f3c735f3b8f9d323927904090049b'/>
<id>urn:sha1:56c8a23f8a0f3c735f3b8f9d323927904090049b</id>
<content type='text'>
Netdevsim has extra register_netdevice_notifier_dev_net notifiers,
use netdevim instead of dummy device to test them out.

Signed-off-by: Stanislav Fomichev &lt;sdf@fomichev.me&gt;
Link: https://patch.msgid.link/20250401163452.622454-9-sdf@fomichev.me
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: forwarding: lib: Move require_command to net, generalize</title>
<updated>2025-02-18T12:06:43Z</updated>
<author>
<name>Petr Machata</name>
</author>
<published>2025-02-14T16:18:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f802f172d78b8b96dcd1832dc7c8da8ee9dcbc29'/>
<id>urn:sha1:f802f172d78b8b96dcd1832dc7c8da8ee9dcbc29</id>
<content type='text'>
This helper could be useful to more than just forwarding tests.
Move it upstairs and port over to log_test_skip().

Split the function into two parts: the bit that actually checks and
reports skip, which is in a new function check_command(). And a bit
that exits the test script if the check fails. This allows users
consistent checking behavior while giving an option to bail out from
a single test without bailing out of the whole script.

Signed-off-by: Petr Machata &lt;petrm@nvidia.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Reviewed-by: Nikolay Aleksandrov &lt;razor@blackwall.org&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
</entry>
<entry>
<title>selftests: net: lib: Add a couple autodefer helpers</title>
<updated>2024-12-20T21:14:17Z</updated>
<author>
<name>Petr Machata</name>
</author>
<published>2024-12-18T17:15:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=976d248bd33356eecb958cdc1b0c37622fd5d595'/>
<id>urn:sha1:976d248bd33356eecb958cdc1b0c37622fd5d595</id>
<content type='text'>
Alongside the helper ip_link_set_up(), one to set the link down will be
useful as well. Add a helper to determine the link state as well,
ip_link_is_up(), and use it to short-circuit any changes if the state is
already the desired one.

Furthermore, add a helper bridge_vlan_add().

Signed-off-by: Petr Machata &lt;petrm@nvidia.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Acked-by: Nikolay Aleksandrov &lt;razor@blackwall.org&gt;
Link: https://patch.msgid.link/856d9e01725fdba21b7f6716358f645b19131af2.1734540770.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: net: lib: Add several autodefer helpers</title>
<updated>2024-12-09T22:47:05Z</updated>
<author>
<name>Petr Machata</name>
</author>
<published>2024-12-05T15:40:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d76ccb2ec368c8a44f64839140cd253c19f6a79a'/>
<id>urn:sha1:d76ccb2ec368c8a44f64839140cd253c19f6a79a</id>
<content type='text'>
Add ip_link_set_addr(), ip_link_set_up(), ip_addr_add() and ip_route_add()
to the suite of helpers that automatically schedule a corresponding
cleanup.

When setting a new MAC, one needs to remember the old address first. Move
mac_get() from forwarding/ to that end.

Signed-off-by: Petr Machata &lt;petrm@nvidia.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Reviewed-by: Nikolay Aleksandrov &lt;razor@blackwall.org&gt;
Link: https://patch.msgid.link/add6bcbe30828fd01363266df20c338cf13aaf25.1733412063.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: net: lib: Rename ip_link_master() to ip_link_set_master()</title>
<updated>2024-12-09T22:47:05Z</updated>
<author>
<name>Petr Machata</name>
</author>
<published>2024-12-05T15:40:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8653eb21d68c6882ce5716b04379431817310b85'/>
<id>urn:sha1:8653eb21d68c6882ce5716b04379431817310b85</id>
<content type='text'>
Let's have a verb in that function name to make it clearer what's going on.

Signed-off-by: Petr Machata &lt;petrm@nvidia.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Reviewed-by: Nikolay Aleksandrov &lt;razor@blackwall.org&gt;
Link: https://patch.msgid.link/fbf7c53a429b340b9cff5831280ea8c305a224f9.1733412063.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: net: fdb_notify: Add a test for FDB notifications</title>
<updated>2024-11-16T00:39:19Z</updated>
<author>
<name>Petr Machata</name>
</author>
<published>2024-11-14T14:09:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=15880bec9bc32ddc8f70f8c551745c2344233372'/>
<id>urn:sha1:15880bec9bc32ddc8f70f8c551745c2344233372</id>
<content type='text'>
Check that only one notification is produced for various FDB edit
operations.

Regarding the ip_link_add() and ip_link_master() helpers. This pattern of
action plus corresponding defer is bound to come up often, and a dedicated
vocabulary to capture it will be handy. tunnel_create() and vlan_create()
from forwarding/lib.sh are somewhat opaque and perhaps too kitchen-sinky,
so I tried to go in the opposite direction with these ones, and wrapped
only the bare minimum to schedule a corresponding cleanup.

Signed-off-by: Petr Machata &lt;petrm@nvidia.com&gt;
Reviewed-by: Amit Cohen &lt;amcohen@nvidia.com&gt;
Acked-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Link: https://patch.msgid.link/910c5880ae6d3b558d6889cbdba2be690c2615c6.1731589511.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: net: lib: Add kill_process</title>
<updated>2024-11-16T00:39:19Z</updated>
<author>
<name>Petr Machata</name>
</author>
<published>2024-11-14T14:09:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=46f6569cf0754e27816403c3701c7070ff281ad0'/>
<id>urn:sha1:46f6569cf0754e27816403c3701c7070ff281ad0</id>
<content type='text'>
A number of selftests run processes in the background and need to kill them
afterwards. Instead for everyone to open-code the kill / wait / redirect
mantra, add a helper in net/lib.sh. Convert existing open-code sites.

Signed-off-by: Petr Machata &lt;petrm@nvidia.com&gt;
Acked-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Reviewed-by: Amit Cohen &lt;amcohen@nvidia.com&gt;
Link: https://patch.msgid.link/a9db102067d741c118f0bd93b10c75e2a34665ea.1731589511.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: net: lib: Move checks from forwarding/lib.sh here</title>
<updated>2024-11-16T00:39:19Z</updated>
<author>
<name>Petr Machata</name>
</author>
<published>2024-11-14T14:09:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=af76b4431818cf7a73cf0ec19465ad3b01cdb159'/>
<id>urn:sha1:af76b4431818cf7a73cf0ec19465ad3b01cdb159</id>
<content type='text'>
For logging to be useful, something has to set RET and retmsg by calling
ret_set_ksft_status(). There is a suite of functions to that end in
forwarding/lib: check_err, check_fail et.al. Move them to net/lib.sh so
that every net test can use them.

Existing lib.sh users might be using these same names for their functions.
However lib.sh is always sourced near the top of the file (checked), and
whatever new definitions will simply override the ones provided by lib.sh.

Signed-off-by: Petr Machata &lt;petrm@nvidia.com&gt;
Reviewed-by: Amit Cohen &lt;amcohen@nvidia.com&gt;
Acked-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Link: https://patch.msgid.link/f488a00dc85b8e0c1f3c71476b32b21b5189a847.1731589511.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: net: lib: Move tests_run from forwarding/lib.sh here</title>
<updated>2024-11-16T00:39:19Z</updated>
<author>
<name>Petr Machata</name>
</author>
<published>2024-11-14T14:09:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=601d9d70a40a8ccf93f41a153dd4c9aa1db60d57'/>
<id>urn:sha1:601d9d70a40a8ccf93f41a153dd4c9aa1db60d57</id>
<content type='text'>
It would be good to use the same mechanism for scheduling and dispatching
general net tests as the many forwarding tests already use. To that end,
move the logging helpers to net/lib.sh so that every net test can use them.

Existing lib.sh users might be using the name themselves. However lib.sh is
always sourced near the top of the file (checked), and whatever new
definition will simply override the one provided by lib.sh.

Signed-off-by: Petr Machata &lt;petrm@nvidia.com&gt;
Reviewed-by: Amit Cohen &lt;amcohen@nvidia.com&gt;
Acked-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Link: https://patch.msgid.link/a6fc083486493425b2c61185c327845b6ce3233a.1731589511.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
</feed>
