diff options
author | Paul Moore <paul.moore@hp.com> | 2007-12-21 17:59:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:00:02 -0500 |
commit | e1af9f270b69a3ad1dcbabb404dd1f40a96f43f5 (patch) | |
tree | 8dc77b5c842a517d0d19bba835897846f77ec647 /net/xfrm/xfrm_output.c | |
parent | afeb14b49098ba7a51c96e083a4105a0301f94c4 (diff) |
[XFRM]: Drop packets when replay counter would overflow
According to RFC4303, section 3.3.3 we need to drop outgoing packets which
cause the replay counter to overflow:
3.3.3. Sequence Number Generation
The sender's counter is initialized to 0 when an SA is established.
The sender increments the sequence number (or ESN) counter for this
SA and inserts the low-order 32 bits of the value into the Sequence
Number field. Thus, the first packet sent using a given SA will
contain a sequence number of 1.
If anti-replay is enabled (the default), the sender checks to ensure
that the counter has not cycled before inserting the new value in the
Sequence Number field. In other words, the sender MUST NOT send a
packet on an SA if doing so would cause the sequence number to cycle.
An attempt to transmit a packet that would result in sequence number
overflow is an auditable event. The audit log entry for this event
SHOULD include the SPI value, current date/time, Source Address,
Destination Address, and (in IPv6) the cleartext Flow ID.
Signed-off-by: Paul Moore <paul.moore@hp.com>
Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_output.c')
-rw-r--r-- | net/xfrm/xfrm_output.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index 09514449fe8a..d73003cb2c0e 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c | |||
@@ -57,8 +57,11 @@ static int xfrm_output_one(struct sk_buff *skb, int err) | |||
57 | 57 | ||
58 | if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { | 58 | if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { |
59 | XFRM_SKB_CB(skb)->seq = ++x->replay.oseq; | 59 | XFRM_SKB_CB(skb)->seq = ++x->replay.oseq; |
60 | if (unlikely(x->replay.oseq == 0)) | 60 | if (unlikely(x->replay.oseq == 0)) { |
61 | x->replay.oseq--; | ||
61 | xfrm_audit_state_replay_overflow(x, skb); | 62 | xfrm_audit_state_replay_overflow(x, skb); |
63 | goto error; | ||
64 | } | ||
62 | if (xfrm_aevent_is_on()) | 65 | if (xfrm_aevent_is_on()) |
63 | xfrm_replay_notify(x, XFRM_REPLAY_UPDATE); | 66 | xfrm_replay_notify(x, XFRM_REPLAY_UPDATE); |
64 | } | 67 | } |