xfrm: Check for the new replay implementation if an esn state is inserted
authorSteffen Klassert <steffen.klassert@secunet.com>
Mon, 25 Apr 2011 19:41:21 +0000 (19:41 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Apr 2011 19:46:04 +0000 (12:46 -0700)
IPsec extended sequence numbers can be used only with the new
anti-replay window implementation. So check if the new implementation
is used if an esn state is inserted and return an error if it is not.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/xfrm/xfrm_user.c

index 5d1d60d3ca832c419bd41bf7b70d84bacb222494..c658cb3bc7c3ccf213fffee288f8b211a2c93293 100644 (file)
@@ -124,6 +124,9 @@ static inline int verify_replay(struct xfrm_usersa_info *p,
 {
        struct nlattr *rt = attrs[XFRMA_REPLAY_ESN_VAL];
 
+       if ((p->flags & XFRM_STATE_ESN) && !rt)
+               return -EINVAL;
+
        if (!rt)
                return 0;