xfrm: add LINUX_MIB_XFRMACQUIREERROR statistic counter
Subsystems (3)
PATCH RESEND 1/1 xfrm: add LINUX_MIB_XFRMACQUIREERROR statistic counter
When host ping its peer, ICMP echo request packet triggers IPsec policy, then host negotiates SA secret with its peer. After IKE installed SA for OUT direction, but before SA for IN direction installed, host get ICMP echo reply from its peer. At the time being, the SA state for IN direction could be XFRM_STATE_ACQ, then the received packet will be dropped after adding LINUX_MIB_XFRMINSTATEINVALID statistic.
Adding a LINUX_MIB_XFRMACQUIREERROR statistic counter for such scenario when SA in larval state is much clearer for user than LINUX_MIB_XFRMINSTATEINVALID which indicates the SA is totally bad.
--- include/uapi/linux/snmp.h | 1 + net/xfrm/xfrm_input.c | 5 +++++ net/xfrm/xfrm_proc.c | 1 + 3 files changed, 7 insertions(+), 0 deletions(-)
include/uapi/linux/snmp.h +1 -0
@@ -287,6 +287,7 @@ enumLINUX_MIB_XFRMOUTPOLERROR ,/* XfrmOutPolError */ LINUX_MIB_XFRMFWDHDRERROR ,/* XfrmFwdHdrError*/ LINUX_MIB_XFRMOUTSTATEINVALID ,/* XfrmOutStateInvalid */ +LINUX_MIB_XFRMACQUIREERROR ,/* XfrmAcquireError*/ __LINUX_MIB_XFRMMAX };
net/xfrm/xfrm_input.c +5 -0
@@ -163,6 +163,11 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) skb->sp->xvec[skb->sp->len++] = x;spin_lock (&x->lock); +if (unlikely (x->km.state ==XFRM_STATE_ACQ )) { +XFRM_INC_STATS (net,LINUX_MIB_XFRMACQUIREERROR ); + goto drop_unlock; + } +if (unlikely (x->km.state !=XFRM_STATE_VALID )) {XFRM_INC_STATS (net,LINUX_MIB_XFRMINSTATEINVALID ); goto drop_unlock;
net/xfrm/xfrm_proc.c +1 -0
@@ -44,6 +44,7 @@ static const struct snmp_mib xfrm_mib_list[] = {SNMP_MIB_ITEM ("XfrmOutPolError" ,LINUX_MIB_XFRMOUTPOLERROR ),SNMP_MIB_ITEM ("XfrmFwdHdrError" ,LINUX_MIB_XFRMFWDHDRERROR ),SNMP_MIB_ITEM ("XfrmOutStateInvalid" ,LINUX_MIB_XFRMOUTSTATEINVALID ), +SNMP_MIB_ITEM ("XfrmAcquireError" ,LINUX_MIB_XFRMACQUIREERROR ), SNMP_MIB_SENTINEL };
Signature · 1 line
1.7.4.1
Hello.
Quoted 25 lines · Fan Du
When host ping its peer, ICMP echo request packet triggers IPsec policy, then host negotiates SA secret with its peer. After IKE installed SA for OUT direction, but before SA for IN direction installed, host get ICMP echo reply from its peer. At the time being, the SA state for IN direction could be
XFRM_STATE_ACQ, then the received packet will be dropped after addingLINUX_MIB_XFRMINSTATEINVALIDstatistic.Adding a
LINUX_MIB_XFRMACQUIREERRORstatistic counter for such scenario when SA in larval state is much clearer for user thanLINUX_MIB_XFRMINSTATEINVALIDwhich indicates the SA is totally bad.Signed-off-by Fan Du <[email protected]>--- include/uapi/linux/snmp.h | 1 + net/xfrm/xfrm_input.c | 5 +++++ net/xfrm/xfrm_proc.c | 1 + 3 files changed, 7 insertions(+), 0 deletions(-)include/uapi/linux/snmp.h +0
-0
include/uapi/linux/snmp.h enum · line 290
Quoted 4 lines
include/uapi/linux/snmp.h +1
-0@@ -287,6 +287,7 @@ enumLINUX_MIB_XFRMOUTPOLERROR ,/* XfrmOutPolError */ LINUX_MIB_XFRMFWDHDRERROR ,/* XfrmFwdHdrError*/ LINUX_MIB_XFRMOUTSTATEINVALID ,/* XfrmOutStateInvalid */ + LINUX_MIB_XFRMACQUIREERROR, /* XfrmAcquireError*/
Please indent the comment with tabs and align with the above ones.
WBR, Sergei
Hi, Sergei
Quoted 24 lines · Sergei Shtylyov
Hello.
Quoted 19 lines · Fan Du
When host ping its peer, ICMP echo request packet triggers IPsec policy, then host negotiates SA secret with its peer. After IKE installed SA for OUT direction, but before SA for IN direction installed, host get ICMP echo reply from its peer. At the time being, the SA state for IN direction could be
XFRM_STATE_ACQ, then the received packet will be dropped after addingLINUX_MIB_XFRMINSTATEINVALIDstatistic.Adding a
LINUX_MIB_XFRMACQUIREERRORstatistic counter for such scenario when SA in larval state is much clearer for user thanLINUX_MIB_XFRMINSTATEINVALIDwhich indicates the SA is totally bad.Signed-off-by Fan Du <[email protected]>---
include/uapi/linux/snmp.h| 1 +net/xfrm/xfrm_input.c| 5 +++++net/xfrm/xfrm_proc.c| 1 +3 files changed, 7 insertions(+), 0 deletions(-)
Quoted 11 lines
Quoted 9 lines
include/uapi/linux/snmp.h +0
-0@@ -287,6 +287,7 @@ enum
LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/LINUX_MIB_XFRMOUTSTATEINVALID, /* XfrmOutStateInvalid */
+LINUX_MIB_XFRMACQUIREERROR, /* XfrmAcquireError*/Please indent the comment with tabs and align with the above ones.
Thanks for the point, I will fix this in next round after reviewing from Steffen and others.
Quoted 3 lines
WBR, Sergei
Signature · 3 lines
浮沉随浪只记今朝笑 --fan
Steffen Klassert
maintainerQuoted 39 lines · Fan Du
Hi, Sergei
Quoted 24 lines · Sergei Shtylyov
Hello.
Quoted 19 lines · Fan Du
When host ping its peer, ICMP echo request packet triggers IPsec policy, then host negotiates SA secret with its peer. After IKE installed SA for OUT direction, but before SA for IN direction installed, host get ICMP echo reply from its peer. At the time being, the SA state for IN direction could be
XFRM_STATE_ACQ, then the received packet will be dropped after addingLINUX_MIB_XFRMINSTATEINVALIDstatistic.Adding a
LINUX_MIB_XFRMACQUIREERRORstatistic counter for such scenario when SA in larval state is much clearer for user thanLINUX_MIB_XFRMINSTATEINVALIDwhich indicates the SA is totally bad.Signed-off-by Fan Du <[email protected]>---
include/uapi/linux/snmp.h| 1 +net/xfrm/xfrm_input.c| 5 +++++net/xfrm/xfrm_proc.c| 1 +3 files changed, 7 insertions(+), 0 deletions(-)Quoted 11 lines
Quoted 9 lines
include/uapi/linux/snmp.h +0
-0@@ -287,6 +287,7 @@ enum
LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/LINUX_MIB_XFRMOUTSTATEINVALID, /* XfrmOutStateInvalid */
+LINUX_MIB_XFRMACQUIREERROR, /* XfrmAcquireError*/Please indent the comment with tabs and align with the above ones.
Quoted 2 lines
Thanks for the point, I will fix this in next round after reviewing from Steffen and others.
The patch looks ok to me, please fix the indent and resend.
Thanks!