Skip to content

Commit

Permalink
[NET]: Add CONFIG_NETDEBUG to suppress bad packet messages.
Browse files Browse the repository at this point in the history
If you are on a hostile network, or are running protocol tests, you can
easily get the logged swamped by messages about bad UDP and ICMP packets.
This turns those messages off unless a config option is enabled.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Acked-by: Dave Jones <davej@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and davem330 committed Feb 3, 2006
1 parent 6e2be3e commit 0dec456
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -1354,12 +1354,12 @@ extern int sock_get_timestamp(struct sock *, struct timeval __user *);
* Enable debug/info messages
*/

#if 0
#define NETDEBUG(fmt, args...) do { } while (0)
#define LIMIT_NETDEBUG(fmt, args...) do { } while(0)
#else
#ifdef CONFIG_NETDEBUG
#define NETDEBUG(fmt, args...) printk(fmt,##args)
#define LIMIT_NETDEBUG(fmt, args...) do { if (net_ratelimit()) printk(fmt,##args); } while(0)
#else
#define NETDEBUG(fmt, args...) do { } while (0)
#define LIMIT_NETDEBUG(fmt, args...) do { } while(0)
#endif

/*
Expand Down
7 changes: 7 additions & 0 deletions net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ if NET

menu "Networking options"

config NETDEBUG
bool "Network packet debugging"
help
You can say Y here if you want to get additional messages useful in
debugging bad packets, but can overwhelm logs under denial of service
attacks.

source "net/packet/Kconfig"
source "net/unix/Kconfig"
source "net/xfrm/Kconfig"
Expand Down

0 comments on commit 0dec456

Please sign in to comment.