aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMathias Krause <minipli@googlemail.com>2013-03-20 17:59:11 -0400
committerSteffen Klassert <steffen.klassert@secunet.com>2013-03-25 02:25:50 -0400
commit799ef90c55e692e096d8bd9e5871b95264b1e9ba (patch)
tree8dc4b7c9fc0f0fc13e1e7a04ce62107fa1d02b4b /net
parent0017c0b57500606aab894cdb02fdf3380ddd60ee (diff)
xfrm: Fix esn sequence number diff calculation in xfrm_replay_notify_esn()
Commit 0017c0b "xfrm: Fix replay notification for esn." is off by one for the sequence number wrapped case as UINT_MAX is 0xffffffff, not 0x100000000. ;) Just calculate the diff like done everywhere else in the file. Signed-off-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net')
-rw-r--r--net/xfrm/xfrm_replay.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
index a3906737f49e..8dafe6d3c6e4 100644
--- a/net/xfrm/xfrm_replay.c
+++ b/net/xfrm/xfrm_replay.c
@@ -359,14 +359,12 @@ static void xfrm_replay_notify_esn(struct xfrm_state *x, int event)
359 if (replay_esn->seq_hi == preplay_esn->seq_hi) 359 if (replay_esn->seq_hi == preplay_esn->seq_hi)
360 seq_diff = replay_esn->seq - preplay_esn->seq; 360 seq_diff = replay_esn->seq - preplay_esn->seq;
361 else 361 else
362 seq_diff = UINT_MAX - preplay_esn->seq 362 seq_diff = ~preplay_esn->seq + replay_esn->seq + 1;
363 + replay_esn->seq;
364 363
365 if (replay_esn->oseq_hi == preplay_esn->oseq_hi) 364 if (replay_esn->oseq_hi == preplay_esn->oseq_hi)
366 oseq_diff = replay_esn->oseq - preplay_esn->oseq; 365 oseq_diff = replay_esn->oseq - preplay_esn->oseq;
367 else 366 else
368 oseq_diff = UINT_MAX - preplay_esn->oseq 367 oseq_diff = ~preplay_esn->oseq + replay_esn->oseq + 1;
369 + replay_esn->oseq;
370 368
371 if (seq_diff < x->replay_maxdiff && 369 if (seq_diff < x->replay_maxdiff &&
372 oseq_diff < x->replay_maxdiff) { 370 oseq_diff < x->replay_maxdiff) {