summaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_output.c
diff options
context:
space:
mode:
authorLi RongQing <roy.qing.li@gmail.com>2012-12-28 16:06:28 +0800
committerSteffen Klassert <steffen.klassert@secunet.com>2013-01-07 11:18:58 +0100
commitbb65a9cb953fdfe9c507e8dbb6c4ec2540484bd3 (patch)
tree43c6b5d97e05f485be22918d96450159b1d9b239 /net/xfrm/xfrm_output.c
parent483f777266f5da205459c290994bd3cda5f1f6bc (diff)
downloadop-kernel-dev-bb65a9cb953fdfe9c507e8dbb6c4ec2540484bd3.zip
op-kernel-dev-bb65a9cb953fdfe9c507e8dbb6c4ec2540484bd3.tar.gz
xfrm: removes a superfluous check and add a statistic
Remove the check if x->km.state equal to XFRM_STATE_VALID in xfrm_state_check_expire(), which will be done before call xfrm_state_check_expire(). add a LINUX_MIB_XFRMOUTSTATEINVALID statistic to record the outbound error due to invalid xfrm state. Signed-off-by: Li RongQing <roy.qing.li@gmail.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm/xfrm_output.c')
-rw-r--r--net/xfrm/xfrm_output.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 95a338c..3670526 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -61,6 +61,12 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
}
spin_lock_bh(&x->lock);
+
+ if (unlikely(x->km.state != XFRM_STATE_VALID)) {
+ XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTSTATEINVALID);
+ goto error_nolock;
+ }
+
err = xfrm_state_check_expire(x);
if (err) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTSTATEEXPIRED);
OpenPOWER on IntegriCloud