Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 243257
b: refs/heads/master
c: 36ae014
h: refs/heads/master
i:
  243255: dd72aa6
v: v3
  • Loading branch information
Steffen Klassert authored and David S. Miller committed Mar 29, 2011
1 parent 872e165 commit 995dd21
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 72f49050ba18959472aac723cd9d094bc3547e89
refs/heads/master: 36ae0148dbb6b9e15d8f067bb7523fd2b765a6af
2 changes: 1 addition & 1 deletion trunk/net/xfrm/xfrm_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
goto drop_unlock;
}

if (x->props.replay_window && x->repl->check(x, skb, seq)) {
if (x->repl->check(x, skb, seq)) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR);
goto drop_unlock;
}
Expand Down
17 changes: 15 additions & 2 deletions trunk/net/xfrm/xfrm_replay.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ static int xfrm_replay_check(struct xfrm_state *x,
u32 diff;
u32 seq = ntohl(net_seq);

if (!x->props.replay_window)
return 0;

if (unlikely(seq == 0))
goto err;

Expand Down Expand Up @@ -193,9 +196,14 @@ static int xfrm_replay_check_bmp(struct xfrm_state *x,
{
unsigned int bitnr, nr;
struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
u32 pos;
u32 seq = ntohl(net_seq);
u32 diff = replay_esn->seq - seq;
u32 pos = (replay_esn->seq - 1) % replay_esn->replay_window;

if (!replay_esn->replay_window)
return 0;

pos = (replay_esn->seq - 1) % replay_esn->replay_window;

if (unlikely(seq == 0))
goto err;
Expand Down Expand Up @@ -373,12 +381,17 @@ static int xfrm_replay_check_esn(struct xfrm_state *x,
unsigned int bitnr, nr;
u32 diff;
struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
u32 pos;
u32 seq = ntohl(net_seq);
u32 pos = (replay_esn->seq - 1) % replay_esn->replay_window;
u32 wsize = replay_esn->replay_window;
u32 top = replay_esn->seq;
u32 bottom = top - wsize + 1;

if (!wsize)
return 0;

pos = (replay_esn->seq - 1) % replay_esn->replay_window;

if (unlikely(seq == 0 && replay_esn->seq_hi == 0 &&
(replay_esn->seq < replay_esn->replay_window - 1)))
goto err;
Expand Down

0 comments on commit 995dd21

Please sign in to comment.