mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 16:41:25 +00:00
net: add support for netdev notifier error injection
This module allows to insert errors in some of netdevice's notifier events. All network drivers use these notifiers to signal various events and to check if they are allowed, e.g. PRECHANGEMTU and CHANGEMTU afterwards. Until recently I had to run failure tests by injecting a custom module, but now this infrastructure makes it trivial to test these failure paths. Some of the recent bugs I fixed were found using this module. Here's an example: $ cd /sys/kernel/debug/notifier-error-inject/netdev $ echo -22 > actions/NETDEV_CHANGEMTU/error $ ip link set eth0 mtu 1024 RTNETLINK answers: Invalid argument CC: Akinobu Mita <akinobu.mita@gmail.com> CC: "David S. Miller" <davem@davemloft.net> CC: netdev <netdev@vger.kernel.org> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
27a70af3f4
commit
02fff96a79
4 changed files with 102 additions and 0 deletions
|
@ -10,6 +10,7 @@ modules that can be used to test the following notifiers.
|
|||
* PM notifier
|
||||
* Memory hotplug notifier
|
||||
* powerpc pSeries reconfig notifier
|
||||
* Netdevice notifier
|
||||
|
||||
CPU notifier error injection module
|
||||
-----------------------------------
|
||||
|
@ -87,6 +88,29 @@ Possible pSeries reconfig notifier events to be failed are:
|
|||
* PSERIES_DRCONF_MEM_ADD
|
||||
* PSERIES_DRCONF_MEM_REMOVE
|
||||
|
||||
Netdevice notifier error injection module
|
||||
----------------------------------------------
|
||||
This feature is controlled through debugfs interface
|
||||
/sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
|
||||
|
||||
Netdevice notifier events which can be failed are:
|
||||
|
||||
* NETDEV_REGISTER
|
||||
* NETDEV_CHANGEMTU
|
||||
* NETDEV_CHANGENAME
|
||||
* NETDEV_PRE_UP
|
||||
* NETDEV_PRE_TYPE_CHANGE
|
||||
* NETDEV_POST_INIT
|
||||
* NETDEV_PRECHANGEMTU
|
||||
* NETDEV_PRECHANGEUPPER
|
||||
|
||||
Example: Inject netdevice mtu change error (-22 == -EINVAL)
|
||||
|
||||
# cd /sys/kernel/debug/notifier-error-inject/netdev
|
||||
# echo -22 > actions/NETDEV_CHANGEMTU/error
|
||||
# ip link set eth0 mtu 1024
|
||||
RTNETLINK answers: Invalid argument
|
||||
|
||||
For more usage examples
|
||||
-----------------------
|
||||
There are tools/testing/selftests using the notifier error injection features
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue