diff options
author | Masahide NAKAMURA <nakam@linux-ipv6.org> | 2007-12-20 23:42:57 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:59:38 -0500 |
commit | 558f82ef6e0d25e87f7468c07b6db1fbbf95a855 (patch) | |
tree | b2fe20926ca4e500b6e5c0232a5bf3b2e3ba898e /net/xfrm/xfrm_policy.c | |
parent | 9473e1f631de339c50bde1e3bd09e1045fe90fd5 (diff) |
[XFRM]: Define packet dropping statistics.
This statistics is shown factor dropped by transformation
at /proc/net/xfrm_stat for developer.
It is a counter designed from current transformation source code
and defined as linux private MIB.
See Documentation/networking/xfrm_proc.txt for the detail.
Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_policy.c')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 521cb6e12561..32ddb7b12e7f 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -27,11 +27,19 @@ | |||
27 | #include <net/dst.h> | 27 | #include <net/dst.h> |
28 | #include <net/xfrm.h> | 28 | #include <net/xfrm.h> |
29 | #include <net/ip.h> | 29 | #include <net/ip.h> |
30 | #ifdef CONFIG_XFRM_STATISTICS | ||
31 | #include <net/snmp.h> | ||
32 | #endif | ||
30 | 33 | ||
31 | #include "xfrm_hash.h" | 34 | #include "xfrm_hash.h" |
32 | 35 | ||
33 | int sysctl_xfrm_larval_drop __read_mostly; | 36 | int sysctl_xfrm_larval_drop __read_mostly; |
34 | 37 | ||
38 | #ifdef CONFIG_XFRM_STATISTICS | ||
39 | DEFINE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics) __read_mostly; | ||
40 | EXPORT_SYMBOL(xfrm_statistics); | ||
41 | #endif | ||
42 | |||
35 | DEFINE_MUTEX(xfrm_cfg_mutex); | 43 | DEFINE_MUTEX(xfrm_cfg_mutex); |
36 | EXPORT_SYMBOL(xfrm_cfg_mutex); | 44 | EXPORT_SYMBOL(xfrm_cfg_mutex); |
37 | 45 | ||
@@ -2258,6 +2266,16 @@ static struct notifier_block xfrm_dev_notifier = { | |||
2258 | 0 | 2266 | 0 |
2259 | }; | 2267 | }; |
2260 | 2268 | ||
2269 | #ifdef CONFIG_XFRM_STATISTICS | ||
2270 | static int __init xfrm_statistics_init(void) | ||
2271 | { | ||
2272 | if (snmp_mib_init((void **)xfrm_statistics, | ||
2273 | sizeof(struct linux_xfrm_mib)) < 0) | ||
2274 | return -ENOMEM; | ||
2275 | return 0; | ||
2276 | } | ||
2277 | #endif | ||
2278 | |||
2261 | static void __init xfrm_policy_init(void) | 2279 | static void __init xfrm_policy_init(void) |
2262 | { | 2280 | { |
2263 | unsigned int hmask, sz; | 2281 | unsigned int hmask, sz; |
@@ -2294,9 +2312,15 @@ static void __init xfrm_policy_init(void) | |||
2294 | 2312 | ||
2295 | void __init xfrm_init(void) | 2313 | void __init xfrm_init(void) |
2296 | { | 2314 | { |
2315 | #ifdef CONFIG_XFRM_STATISTICS | ||
2316 | xfrm_statistics_init(); | ||
2317 | #endif | ||
2297 | xfrm_state_init(); | 2318 | xfrm_state_init(); |
2298 | xfrm_policy_init(); | 2319 | xfrm_policy_init(); |
2299 | xfrm_input_init(); | 2320 | xfrm_input_init(); |
2321 | #ifdef CONFIG_XFRM_STATISTICS | ||
2322 | xfrm_proc_init(); | ||
2323 | #endif | ||
2300 | } | 2324 | } |
2301 | 2325 | ||
2302 | #ifdef CONFIG_AUDITSYSCALL | 2326 | #ifdef CONFIG_AUDITSYSCALL |