From: Christophe Gouault <christophe.gouault@6wind.com>
To: "Petr Vaněk" <pv@excello.cz>
Cc: Steffen Klassert <steffen.klassert@secunet.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] xfrm: no-anti-replay protection flag
Date: Wed, 27 May 2020 19:11:21 +0200 [thread overview]
Message-ID: <CADdy8Ho0v7SV_dNR+syBFX79U+iE62sumLjDQypgkxs536fCbQ@mail.gmail.com> (raw)
In-Reply-To: <20200525154633.GB22403@atlantis>
Hi Petr,
This patch is useful, however I think you should change the name of
the option and amend its description:
the option does not disable anti-replay in output (it can only be
disabled in input), it allows the output sequence number to wrap, and
it assumes that the remote peer disabled anti-replay in input.
So you I suggest you change the name of the option to something like
XFRM_SA_XFLAG_OSEQ_MAY_WRAP or XFRM_SA_XFLAG_ALLOW_OSEQ_WRAP.
Best regards,
Christophe
Le lun. 25 mai 2020 à 17:53, Petr Vaněk <pv@excello.cz> a écrit :
>
> RFC 4303 in section 3.3.3 suggests to disable anti-replay for manually
> distributed ICVs.
>
> This patch introduces new extra_flag XFRM_SA_XFLAG_NO_ANTI_REPLAY which
> disables anti-replay for outbound packets if set. The flag is used only
> in legacy and bmp code, because esn should not be negotiated if
> anti-replay is disabled (see note in 3.3.3 section).
>
> Signed-off-by: Petr Vaněk <pv@excello.cz>
> ---
> include/uapi/linux/xfrm.h | 1 +
> net/xfrm/xfrm_replay.c | 12 ++++++++----
> 2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
> index 5f3b9fec7b5f..4842b1ed49e9 100644
> --- a/include/uapi/linux/xfrm.h
> +++ b/include/uapi/linux/xfrm.h
> @@ -387,6 +387,7 @@ struct xfrm_usersa_info {
> };
>
> #define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1
> +#define XFRM_SA_XFLAG_NO_ANTI_REPLAY 2
>
> struct xfrm_usersa_id {
> xfrm_address_t daddr;
> diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
> index 98943f8d01aa..1602843aa2ec 100644
> --- a/net/xfrm/xfrm_replay.c
> +++ b/net/xfrm/xfrm_replay.c
> @@ -89,7 +89,8 @@ static int xfrm_replay_overflow(struct xfrm_state *x, struct sk_buff *skb)
> if (x->type->flags & XFRM_TYPE_REPLAY_PROT) {
> XFRM_SKB_CB(skb)->seq.output.low = ++x->replay.oseq;
> XFRM_SKB_CB(skb)->seq.output.hi = 0;
> - if (unlikely(x->replay.oseq == 0)) {
> + if (unlikely(x->replay.oseq == 0) &&
> + !(x->props.extra_flags & XFRM_SA_XFLAG_NO_ANTI_REPLAY)) {
> x->replay.oseq--;
> xfrm_audit_state_replay_overflow(x, skb);
> err = -EOVERFLOW;
> @@ -168,7 +169,8 @@ static int xfrm_replay_overflow_bmp(struct xfrm_state *x, struct sk_buff *skb)
> if (x->type->flags & XFRM_TYPE_REPLAY_PROT) {
> XFRM_SKB_CB(skb)->seq.output.low = ++replay_esn->oseq;
> XFRM_SKB_CB(skb)->seq.output.hi = 0;
> - if (unlikely(replay_esn->oseq == 0)) {
> + if (unlikely(replay_esn->oseq == 0) &&
> + !(x->props.extra_flags & XFRM_SA_XFLAG_NO_ANTI_REPLAY)) {
> replay_esn->oseq--;
> xfrm_audit_state_replay_overflow(x, skb);
> err = -EOVERFLOW;
> @@ -572,7 +574,8 @@ static int xfrm_replay_overflow_offload(struct xfrm_state *x, struct sk_buff *sk
>
> XFRM_SKB_CB(skb)->seq.output.hi = 0;
> xo->seq.hi = 0;
> - if (unlikely(oseq < x->replay.oseq)) {
> + if (unlikely(oseq < x->replay.oseq) &&
> + !(x->props.extra_flags & XFRM_SA_XFLAG_NO_ANTI_REPLAY)) {
> xfrm_audit_state_replay_overflow(x, skb);
> err = -EOVERFLOW;
>
> @@ -611,7 +614,8 @@ static int xfrm_replay_overflow_offload_bmp(struct xfrm_state *x, struct sk_buff
>
> XFRM_SKB_CB(skb)->seq.output.hi = 0;
> xo->seq.hi = 0;
> - if (unlikely(oseq < replay_esn->oseq)) {
> + if (unlikely(oseq < replay_esn->oseq) &&
> + !(x->props.extra_flags & XFRM_SA_XFLAG_NO_ANTI_REPLAY)) {
> xfrm_audit_state_replay_overflow(x, skb);
> err = -EOVERFLOW;
>
> --
> 2.26.2
>
next prev parent reply other threads:[~2020-05-27 17:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-25 15:46 [PATCH net-next] xfrm: no-anti-replay protection flag Petr Vaněk
2020-05-27 17:11 ` Christophe Gouault [this message]
2020-05-30 12:41 ` Petr Vaněk
2020-05-30 12:39 ` [PATCH net-next v2] xfrm: introduce oseq-may-wrap flag Petr Vaněk
2020-06-02 9:55 ` Christophe Gouault
2020-06-26 5:24 ` Steffen Klassert
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=CADdy8Ho0v7SV_dNR+syBFX79U+iE62sumLjDQypgkxs536fCbQ@mail.gmail.com \
--to=christophe.gouault@6wind.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pv@excello.cz \
--cc=steffen.klassert@secunet.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;
as well as URLs for NNTP newsgroup(s).