diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-03-08 23:41:08 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:24:05 -0400 |
commit | a2a316fd068c455c609ecc155dcfaa7e208d29fe (patch) | |
tree | 9839e2c7e05e9d25241fa7c7b27fd06214120292 | |
parent | ae40eb1ef30ab4120bd3c8b7e3da99ee53d27a23 (diff) |
[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 <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | Documentation/filesystems/proc.txt | 9 | ||||
-rw-r--r-- | include/linux/sysctl.h | 1 | ||||
-rw-r--r-- | include/net/sock.h | 12 | ||||
-rw-r--r-- | net/Kconfig | 7 | ||||
-rw-r--r-- | net/core/sysctl_net_core.c | 8 | ||||
-rw-r--r-- | 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 5484ab5efd4f..7aaf09b86a55 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 | |||
1421 | be dropped. The default settings limit warning messages to one every five | 1421 | be dropped. The default settings limit warning messages to one every five |
1422 | seconds. | 1422 | seconds. |
1423 | 1423 | ||
1424 | warnings | ||
1425 | -------- | ||
1426 | |||
1427 | This controls console messages from the networking stack that can occur because | ||
1428 | of problems on the network like duplicate address or bad checksums. Normally, | ||
1429 | this should be enabled, but if the problem persists the messages can be | ||
1430 | disabled. | ||
1431 | |||
1432 | |||
1424 | netdev_max_backlog | 1433 | netdev_max_backlog |
1425 | ------------------ | 1434 | ------------------ |
1426 | 1435 | ||
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index c9ccb550206f..df2d9ed20a4e 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -290,6 +290,7 @@ enum | |||
290 | NET_CORE_BUDGET=19, | 290 | NET_CORE_BUDGET=19, |
291 | NET_CORE_AEVENT_ETIME=20, | 291 | NET_CORE_AEVENT_ETIME=20, |
292 | NET_CORE_AEVENT_RSEQTH=21, | 292 | NET_CORE_AEVENT_RSEQTH=21, |
293 | NET_CORE_WARNINGS=22, | ||
293 | }; | 294 | }; |
294 | 295 | ||
295 | /* /proc/sys/net/ethernet */ | 296 | /* /proc/sys/net/ethernet */ |
diff --git a/include/net/sock.h b/include/net/sock.h index d093e49fdc85..51246579592e 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 *); | |||
1334 | /* | 1334 | /* |
1335 | * Enable debug/info messages | 1335 | * Enable debug/info messages |
1336 | */ | 1336 | */ |
1337 | extern int net_msg_warn; | ||
1338 | #define NETDEBUG(fmt, args...) \ | ||
1339 | do { if (net_msg_warn) printk(fmt,##args); } while (0) | ||
1337 | 1340 | ||
1338 | #ifdef CONFIG_NETDEBUG | 1341 | #define LIMIT_NETDEBUG(fmt, args...) \ |
1339 | #define NETDEBUG(fmt, args...) printk(fmt,##args) | 1342 | do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0) |
1340 | #define LIMIT_NETDEBUG(fmt, args...) do { if (net_ratelimit()) printk(fmt,##args); } while(0) | ||
1341 | #else | ||
1342 | #define NETDEBUG(fmt, args...) do { } while (0) | ||
1343 | #define LIMIT_NETDEBUG(fmt, args...) do { } while(0) | ||
1344 | #endif | ||
1345 | 1343 | ||
1346 | /* | 1344 | /* |
1347 | * Macros for sleeping on a socket. Use them like this: | 1345 | * Macros for sleeping on a socket. Use them like this: |
diff --git a/net/Kconfig b/net/Kconfig index 915657832d94..e2d9b3b9cda4 100644 --- a/net/Kconfig +++ b/net/Kconfig | |||
@@ -27,13 +27,6 @@ if NET | |||
27 | 27 | ||
28 | menu "Networking options" | 28 | menu "Networking options" |
29 | 29 | ||
30 | config NETDEBUG | ||
31 | bool "Network packet debugging" | ||
32 | help | ||
33 | You can say Y here if you want to get additional messages useful in | ||
34 | debugging bad packets, but can overwhelm logs under denial of service | ||
35 | attacks. | ||
36 | |||
37 | source "net/packet/Kconfig" | 30 | source "net/packet/Kconfig" |
38 | source "net/unix/Kconfig" | 31 | source "net/unix/Kconfig" |
39 | source "net/xfrm/Kconfig" | 32 | source "net/xfrm/Kconfig" |
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 1e75b1585460..b29712033dd4 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
@@ -136,6 +136,14 @@ ctl_table core_table[] = { | |||
136 | .mode = 0644, | 136 | .mode = 0644, |
137 | .proc_handler = &proc_dointvec | 137 | .proc_handler = &proc_dointvec |
138 | }, | 138 | }, |
139 | { | ||
140 | .ctl_name = NET_CORE_WARNINGS, | ||
141 | .procname = "warnings", | ||
142 | .data = &net_msg_warn, | ||
143 | .maxlen = sizeof(int), | ||
144 | .mode = 0644, | ||
145 | .proc_handler = &proc_dointvec | ||
146 | }, | ||
139 | { .ctl_name = 0 } | 147 | { .ctl_name = 0 } |
140 | }; | 148 | }; |
141 | 149 | ||
diff --git a/net/core/utils.c b/net/core/utils.c index 07236c17fab9..34f08107b98e 100644 --- a/net/core/utils.c +++ b/net/core/utils.c | |||
@@ -32,6 +32,8 @@ | |||
32 | 32 | ||
33 | int net_msg_cost = 5*HZ; | 33 | int net_msg_cost = 5*HZ; |
34 | int net_msg_burst = 10; | 34 | int net_msg_burst = 10; |
35 | int net_msg_warn = 1; | ||
36 | EXPORT_SYMBOL(net_msg_warn); | ||
35 | 37 | ||
36 | /* | 38 | /* |
37 | * All net warning printk()s should be guarded by this function. | 39 | * All net warning printk()s should be guarded by this function. |