Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a2a316fd068c455c609ecc155dcfaa7e208d29fe
Commit:     a2a316fd068c455c609ecc155dcfaa7e208d29fe
Parent:     ae40eb1ef30ab4120bd3c8b7e3da99ee53d27a23
Author:     Stephen Hemminger <[EMAIL PROTECTED]>
AuthorDate: Thu Mar 8 20:41:08 2007 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Apr 25 22:24:05 2007 -0700

    [NET]: Replace CONFIG_NET_DEBUG with sysctl.
    
    Covert network warning messages from a compile time to runtime choice.
    Removes kernel config option and replaces it with new 
/proc/sys/net/core/warnings.
    
    Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 Documentation/filesystems/proc.txt |    9 +++++++++
 include/linux/sysctl.h             |    1 +
 include/net/sock.h                 |   12 +++++-------
 net/Kconfig                        |    7 -------
 net/core/sysctl_net_core.c         |    8 ++++++++
 net/core/utils.c                   |    2 ++
 6 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/Documentation/filesystems/proc.txt 
b/Documentation/filesystems/proc.txt
index 5484ab5..7aaf09b 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1421,6 +1421,15 @@ fewer messages that will be written. Message_burst 
controls when messages will
 be dropped.  The  default  settings  limit  warning messages to one every five
 seconds.
 
+warnings
+--------
+
+This controls console messages from the networking stack that can occur because
+of problems on the network like duplicate address or bad checksums. Normally,
+this should be enabled, but if the problem persists the messages can be
+disabled.
+
+
 netdev_max_backlog
 ------------------
 
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index c9ccb55..df2d9ed 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -290,6 +290,7 @@ enum
        NET_CORE_BUDGET=19,
        NET_CORE_AEVENT_ETIME=20,
        NET_CORE_AEVENT_RSEQTH=21,
+       NET_CORE_WARNINGS=22,
 };
 
 /* /proc/sys/net/ethernet */
diff --git a/include/net/sock.h b/include/net/sock.h
index d093e49..5124657 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1334,14 +1334,12 @@ extern int sock_get_timestampns(struct sock *, struct 
timespec __user *);
 /* 
  *     Enable debug/info messages 
  */
+extern int net_msg_warn;
+#define NETDEBUG(fmt, args...) \
+       do { if (net_msg_warn) printk(fmt,##args); } while (0)
 
-#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
+#define LIMIT_NETDEBUG(fmt, args...) \
+       do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0)
 
 /*
  * Macros for sleeping on a socket. Use them like this:
diff --git a/net/Kconfig b/net/Kconfig
index 9156578..e2d9b3b 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -27,13 +27,6 @@ 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"
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 1e75b15..b297120 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -136,6 +136,14 @@ ctl_table core_table[] = {
                .mode           = 0644,
                .proc_handler   = &proc_dointvec
        },
+       {
+               .ctl_name       = NET_CORE_WARNINGS,
+               .procname       = "warnings",
+               .data           = &net_msg_warn,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec
+       },
        { .ctl_name = 0 }
 };
 
diff --git a/net/core/utils.c b/net/core/utils.c
index 07236c1..34f0810 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -32,6 +32,8 @@
 
 int net_msg_cost = 5*HZ;
 int net_msg_burst = 10;
+int net_msg_warn = 1;
+EXPORT_SYMBOL(net_msg_warn);
 
 /*
  * All net warning printk()s should be guarded by this function.
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to