From: James Morris <jmorris@namei.org>
To: Paul Moore <paul.moore@hp.com>
Cc: netdev@vger.kernel.org, linux-audit@redhat.com
Subject: Re: [PATCH 3/3] XFRM: Drop packets when replay counter would overflow
Date: Fri, 21 Dec 2007 09:28:26 +1100 (EST) [thread overview]
Message-ID: <Xine.LNX.4.64.0712210928180.27551@us.intercode.com.au> (raw)
In-Reply-To: <20071220214230.12122.77900.stgit@flek.lan>
On Thu, 20 Dec 2007, Paul Moore wrote:
> 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>
> ---
>
> 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 eb3333b..284eeef 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)
>
> if (x->type->flags & XFRM_TYPE_REPLAY_PROT) {
> XFRM_SKB_CB(skb)->seq = ++x->replay.oseq;
> - if (unlikely(x->replay.oseq == 0))
> + if (unlikely(x->replay.oseq == 0)) {
> + x->replay.oseq--;
> xfrm_audit_state_replay_overflow(x, skb);
> + goto error;
> + }
> if (xfrm_aevent_is_on())
> xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
James Morris
<jmorris@namei.org>
prev parent reply other threads:[~2007-12-20 22:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-20 21:42 [PATCH 0/3] XFRM audit fixes/additions for net-2.6.25 Paul Moore
2007-12-20 21:42 ` [PATCH 1/3] XFRM: Assorted IPsec fixups Paul Moore
2007-12-20 22:25 ` James Morris
2007-12-21 4:49 ` David Miller
2007-12-20 21:42 ` [PATCH 2/3] XFRM: RFC4303 compliant auditing Paul Moore
2007-12-20 22:27 ` James Morris
2007-12-21 9:43 ` David Miller
2007-12-21 13:27 ` Paul Moore
2007-12-21 13:51 ` Paul Moore
2007-12-21 14:02 ` David Miller
2007-12-21 14:22 ` Paul Moore
2007-12-20 21:42 ` [PATCH 3/3] XFRM: Drop packets when replay counter would overflow Paul Moore
2007-12-20 22:28 ` James Morris [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Xine.LNX.4.64.0712210928180.27551@us.intercode.com.au \
--to=jmorris@namei.org \
--cc=linux-audit@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=paul.moore@hp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox