Skip to content

Commit d268c1f

Browse files
edumazetdavem330
authored andcommitted
net: add CONFIG_DEBUG_NET
This config option enables network debugging checks. This patch adds DEBUG_NET_WARN_ON_ONCE(cond) Note that this is not a replacement for WARN_ON_ONCE(cond) as (cond) is not evaluated if CONFIG_DEBUG_NET is not set. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5b87be9 commit d268c1f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/net/net_debug.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,10 @@ do { \
148148
#endif
149149

150150

151+
#if defined(CONFIG_DEBUG_NET)
152+
#define DEBUG_NET_WARN_ON_ONCE(cond) (void)WARN_ON_ONCE(cond)
153+
#else
154+
#define DEBUG_NET_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond)
155+
#endif
156+
151157
#endif /* _LINUX_NET_DEBUG_H */

net/Kconfig.debug

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ config NET_NS_REFCNT_TRACKER
1717
help
1818
Enable debugging feature to track netns references.
1919
This adds memory and cpu costs.
20+
21+
config DEBUG_NET
22+
bool "Add generic networking debug"
23+
depends on DEBUG_KERNEL
24+
help
25+
Enable extra sanity checks in networking.
26+
This is mostly used by fuzzers, but is safe to select.

0 commit comments

Comments
 (0)