-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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>
- Loading branch information
Showing
7 changed files
with
246 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
XFRM proc - /proc/net/xfrm_* files | ||
================================== | ||
Masahide NAKAMURA <nakam@linux-ipv6.org> | ||
|
||
|
||
Transformation Statistics | ||
------------------------- | ||
xfrm_proc is a statistics shown factor dropped by transformation | ||
for developer. | ||
It is a counter designed from current transformation source code | ||
and defined like linux private MIB. | ||
|
||
Inbound statistics | ||
~~~~~~~~~~~~~~~~~~ | ||
XfrmInError: | ||
All errors which is not matched others | ||
XfrmInBufferError: | ||
No buffer is left | ||
XfrmInHdrError: | ||
Header error | ||
XfrmInNoStates: | ||
No state is found | ||
i.e. Either inbound SPI, address, or IPsec protocol at SA is wrong | ||
XfrmInStateProtoError: | ||
Transformation protocol specific error | ||
e.g. SA key is wrong | ||
XfrmInStateModeError: | ||
Transformation mode specific error | ||
XfrmInSeqOutOfWindow: | ||
Sequence out of window | ||
XfrmInStateExpired: | ||
State is expired | ||
XfrmInStateMismatch: | ||
State has mismatch option | ||
e.g. UDP encapsulation type is mismatch | ||
XfrmInStateInvalid: | ||
State is invalid | ||
XfrmInTmplMismatch: | ||
No matching template for states | ||
e.g. Inbound SAs are correct but SP rule is wrong | ||
XfrmInNoPols: | ||
No policy is found for states | ||
e.g. Inbound SAs are correct but no SP is found | ||
XfrmInPolBlock: | ||
Policy discards | ||
XfrmInPolError: | ||
Policy error | ||
|
||
Outbound errors | ||
~~~~~~~~~~~~~~~ | ||
XfrmOutError: | ||
All errors which is not matched others | ||
XfrmOutBundleGenError: | ||
Bundle generation error | ||
XfrmOutBundleCheckError: | ||
Bundle check error | ||
XfrmOutNoStates: | ||
No state is found | ||
XfrmOutStateProtoError: | ||
Transformation protocol specific error | ||
XfrmOutStateModeError: | ||
Transformation mode specific error | ||
e.g. Outer header space is not enough | ||
XfrmOutStateExpired: | ||
State is expired | ||
XfrmOutPolBlock: | ||
Policy discards | ||
XfrmOutPolDead: | ||
Policy is dead | ||
XfrmOutPolError: | ||
Policy error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* xfrm_proc.c | ||
* | ||
* Copyright (C)2006-2007 USAGI/WIDE Project | ||
* | ||
* Authors: Masahide NAKAMURA <nakam@linux-ipv6.org> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version | ||
* 2 of the License, or (at your option) any later version. | ||
*/ | ||
#include <linux/proc_fs.h> | ||
#include <linux/seq_file.h> | ||
#include <net/snmp.h> | ||
#include <net/xfrm.h> | ||
|
||
static struct snmp_mib xfrm_mib_list[] = { | ||
SNMP_MIB_ITEM("XfrmInError", LINUX_MIB_XFRMINERROR), | ||
SNMP_MIB_ITEM("XfrmInBufferError", LINUX_MIB_XFRMINBUFFERERROR), | ||
SNMP_MIB_ITEM("XfrmInHdrError", LINUX_MIB_XFRMINHDRERROR), | ||
SNMP_MIB_ITEM("XfrmInNoStates", LINUX_MIB_XFRMINNOSTATES), | ||
SNMP_MIB_ITEM("XfrmInStateProtoError", LINUX_MIB_XFRMINSTATEPROTOERROR), | ||
SNMP_MIB_ITEM("XfrmInStateModeError", LINUX_MIB_XFRMINSTATEMODEERROR), | ||
SNMP_MIB_ITEM("XfrmInSeqOutOfWindow", LINUX_MIB_XFRMINSEQOUTOFWINDOW), | ||
SNMP_MIB_ITEM("XfrmInStateExpired", LINUX_MIB_XFRMINSTATEEXPIRED), | ||
SNMP_MIB_ITEM("XfrmInStateMismatch", LINUX_MIB_XFRMINSTATEMISMATCH), | ||
SNMP_MIB_ITEM("XfrmInStateInvalid", LINUX_MIB_XFRMINSTATEINVALID), | ||
SNMP_MIB_ITEM("XfrmInTmplMismatch", LINUX_MIB_XFRMINTMPLMISMATCH), | ||
SNMP_MIB_ITEM("XfrmInNoPols", LINUX_MIB_XFRMINNOPOLS), | ||
SNMP_MIB_ITEM("XfrmInPolBlock", LINUX_MIB_XFRMINPOLBLOCK), | ||
SNMP_MIB_ITEM("XfrmInPolError", LINUX_MIB_XFRMINPOLERROR), | ||
SNMP_MIB_ITEM("XfrmOutError", LINUX_MIB_XFRMOUTERROR), | ||
SNMP_MIB_ITEM("XfrmOutBundleGenError", LINUX_MIB_XFRMOUTBUNDLEGENERROR), | ||
SNMP_MIB_ITEM("XfrmOutBundleCheckError", LINUX_MIB_XFRMOUTBUNDLECHECKERROR), | ||
SNMP_MIB_ITEM("XfrmOutNoStates", LINUX_MIB_XFRMOUTNOSTATES), | ||
SNMP_MIB_ITEM("XfrmOutStateProtoError", LINUX_MIB_XFRMOUTSTATEPROTOERROR), | ||
SNMP_MIB_ITEM("XfrmOutStateModeError", LINUX_MIB_XFRMOUTSTATEMODEERROR), | ||
SNMP_MIB_ITEM("XfrmOutStateExpired", LINUX_MIB_XFRMOUTSTATEEXPIRED), | ||
SNMP_MIB_ITEM("XfrmOutPolBlock", LINUX_MIB_XFRMOUTPOLBLOCK), | ||
SNMP_MIB_ITEM("XfrmOutPolDead", LINUX_MIB_XFRMOUTPOLDEAD), | ||
SNMP_MIB_ITEM("XfrmOutPolError", LINUX_MIB_XFRMOUTPOLERROR), | ||
SNMP_MIB_SENTINEL | ||
}; | ||
|
||
static unsigned long | ||
fold_field(void *mib[], int offt) | ||
{ | ||
unsigned long res = 0; | ||
int i; | ||
|
||
for_each_possible_cpu(i) { | ||
res += *(((unsigned long *)per_cpu_ptr(mib[0], i)) + offt); | ||
res += *(((unsigned long *)per_cpu_ptr(mib[1], i)) + offt); | ||
} | ||
return res; | ||
} | ||
|
||
static int xfrm_statistics_seq_show(struct seq_file *seq, void *v) | ||
{ | ||
int i; | ||
for (i=0; xfrm_mib_list[i].name; i++) | ||
seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name, | ||
fold_field((void **)xfrm_statistics, | ||
xfrm_mib_list[i].entry)); | ||
return 0; | ||
} | ||
|
||
static int xfrm_statistics_seq_open(struct inode *inode, struct file *file) | ||
{ | ||
return single_open(file, xfrm_statistics_seq_show, NULL); | ||
} | ||
|
||
static struct file_operations xfrm_statistics_seq_fops = { | ||
.owner = THIS_MODULE, | ||
.open = xfrm_statistics_seq_open, | ||
.read = seq_read, | ||
.llseek = seq_lseek, | ||
.release = single_release, | ||
}; | ||
|
||
int __init xfrm_proc_init(void) | ||
{ | ||
int rc = 0; | ||
|
||
if (!proc_net_fops_create(&init_net, "xfrm_stat", S_IRUGO, | ||
&xfrm_statistics_seq_fops)) | ||
goto stat_fail; | ||
|
||
out: | ||
return rc; | ||
|
||
stat_fail: | ||
rc = -ENOMEM; | ||
goto out; | ||
} |