diff options
Diffstat (limited to 'net/xfrm')
| -rw-r--r-- | net/xfrm/xfrm_input.c | 2 | ||||
| -rw-r--r-- | net/xfrm/xfrm_replay.c | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index 54a0dc2e2f8d..ab2bb42fe094 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c | |||
| @@ -212,7 +212,7 @@ resume: | |||
| 212 | /* only the first xfrm gets the encap type */ | 212 | /* only the first xfrm gets the encap type */ |
| 213 | encap_type = 0; | 213 | encap_type = 0; |
| 214 | 214 | ||
| 215 | if (async && x->repl->check(x, skb, seq)) { | 215 | if (async && x->repl->recheck(x, skb, seq)) { |
| 216 | XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR); | 216 | XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR); |
| 217 | goto drop_unlock; | 217 | goto drop_unlock; |
| 218 | } | 218 | } |
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c index 2f6d11d04a2b..3efb07d3eb27 100644 --- a/net/xfrm/xfrm_replay.c +++ b/net/xfrm/xfrm_replay.c | |||
| @@ -420,6 +420,18 @@ err: | |||
| 420 | return -EINVAL; | 420 | return -EINVAL; |
| 421 | } | 421 | } |
| 422 | 422 | ||
| 423 | static int xfrm_replay_recheck_esn(struct xfrm_state *x, | ||
| 424 | struct sk_buff *skb, __be32 net_seq) | ||
| 425 | { | ||
| 426 | if (unlikely(XFRM_SKB_CB(skb)->seq.input.hi != | ||
| 427 | htonl(xfrm_replay_seqhi(x, net_seq)))) { | ||
| 428 | x->stats.replay_window++; | ||
| 429 | return -EINVAL; | ||
| 430 | } | ||
| 431 | |||
| 432 | return xfrm_replay_check_esn(x, skb, net_seq); | ||
| 433 | } | ||
| 434 | |||
| 423 | static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq) | 435 | static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq) |
| 424 | { | 436 | { |
| 425 | unsigned int bitnr, nr, i; | 437 | unsigned int bitnr, nr, i; |
| @@ -479,6 +491,7 @@ static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq) | |||
| 479 | static struct xfrm_replay xfrm_replay_legacy = { | 491 | static struct xfrm_replay xfrm_replay_legacy = { |
| 480 | .advance = xfrm_replay_advance, | 492 | .advance = xfrm_replay_advance, |
| 481 | .check = xfrm_replay_check, | 493 | .check = xfrm_replay_check, |
| 494 | .recheck = xfrm_replay_check, | ||
| 482 | .notify = xfrm_replay_notify, | 495 | .notify = xfrm_replay_notify, |
| 483 | .overflow = xfrm_replay_overflow, | 496 | .overflow = xfrm_replay_overflow, |
| 484 | }; | 497 | }; |
| @@ -486,6 +499,7 @@ static struct xfrm_replay xfrm_replay_legacy = { | |||
| 486 | static struct xfrm_replay xfrm_replay_bmp = { | 499 | static struct xfrm_replay xfrm_replay_bmp = { |
| 487 | .advance = xfrm_replay_advance_bmp, | 500 | .advance = xfrm_replay_advance_bmp, |
| 488 | .check = xfrm_replay_check_bmp, | 501 | .check = xfrm_replay_check_bmp, |
| 502 | .recheck = xfrm_replay_check_bmp, | ||
| 489 | .notify = xfrm_replay_notify_bmp, | 503 | .notify = xfrm_replay_notify_bmp, |
| 490 | .overflow = xfrm_replay_overflow_bmp, | 504 | .overflow = xfrm_replay_overflow_bmp, |
| 491 | }; | 505 | }; |
| @@ -493,6 +507,7 @@ static struct xfrm_replay xfrm_replay_bmp = { | |||
| 493 | static struct xfrm_replay xfrm_replay_esn = { | 507 | static struct xfrm_replay xfrm_replay_esn = { |
| 494 | .advance = xfrm_replay_advance_esn, | 508 | .advance = xfrm_replay_advance_esn, |
| 495 | .check = xfrm_replay_check_esn, | 509 | .check = xfrm_replay_check_esn, |
| 510 | .recheck = xfrm_replay_recheck_esn, | ||
| 496 | .notify = xfrm_replay_notify_bmp, | 511 | .notify = xfrm_replay_notify_bmp, |
| 497 | .overflow = xfrm_replay_overflow_esn, | 512 | .overflow = xfrm_replay_overflow_esn, |
| 498 | }; | 513 | }; |
