|
@@ -121,22 +121,17 @@ static inline int verify_replay(struct xfrm_usersa_info *p,
|
|
|
struct nlattr *rt = attrs[XFRMA_REPLAY_ESN_VAL];
|
|
|
struct xfrm_replay_state_esn *rs;
|
|
|
|
|
|
- if (p->flags & XFRM_STATE_ESN) {
|
|
|
- if (!rt)
|
|
|
- return -EINVAL;
|
|
|
+ if (!rt)
|
|
|
+ return (p->flags & XFRM_STATE_ESN) ? -EINVAL : 0;
|
|
|
|
|
|
- rs = nla_data(rt);
|
|
|
+ rs = nla_data(rt);
|
|
|
|
|
|
- if (rs->bmp_len > XFRMA_REPLAY_ESN_MAX / sizeof(rs->bmp[0]) / 8)
|
|
|
- return -EINVAL;
|
|
|
-
|
|
|
- if (nla_len(rt) < (int)xfrm_replay_state_esn_len(rs) &&
|
|
|
- nla_len(rt) != sizeof(*rs))
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
+ if (rs->bmp_len > XFRMA_REPLAY_ESN_MAX / sizeof(rs->bmp[0]) / 8)
|
|
|
+ return -EINVAL;
|
|
|
|
|
|
- if (!rt)
|
|
|
- return 0;
|
|
|
+ if (nla_len(rt) < (int)xfrm_replay_state_esn_len(rs) &&
|
|
|
+ nla_len(rt) != sizeof(*rs))
|
|
|
+ return -EINVAL;
|
|
|
|
|
|
/* As only ESP and AH support ESN feature. */
|
|
|
if ((p->id.proto != IPPROTO_ESP) && (p->id.proto != IPPROTO_AH))
|