[fault] Generalise NETDEV_DISCARD_RATE fault injection mechanism

Provide a generic inject_fault() function that can be used to inject
random faults with configurable probabilities.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2015-07-22 02:56:49 +01:00
parent 9546b0c17b
commit d0325b1da6
6 changed files with 110 additions and 8 deletions

19
src/config/fault.h Normal file
View File

@@ -0,0 +1,19 @@
#ifndef CONFIG_FAULT_H
#define CONFIG_FAULT_H
/** @file
*
* Fault injection
*
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <config/defaults.h>
/* Drop every N transmitted or received network packets */
#define NETDEV_DISCARD_RATE 0
#include <config/local/fault.h>
#endif /* CONFIG_FAULT_H */