Netdev List
 help / color / mirror / Atom feed
From: Dmitry Safonov <dima@arista.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-kernel@vger.kernel.org, 0x7f454c46@gmail.com,
	Steffen Klassert <steffen.klassert@secunet.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH] net/xfrm: Fix lookups for states with spi == 0
Date: Wed, 02 May 2018 13:41:36 +0100	[thread overview]
Message-ID: <1525264896.14025.23.camel@arista.com> (raw)
In-Reply-To: <20180502091125.jnzaaazh67z4ihyf@gondor.apana.org.au>

On Wed, 2018-05-02 at 17:11 +0800, Herbert Xu wrote:
> On Wed, May 02, 2018 at 03:02:20AM +0100, Dmitry Safonov wrote:
> > It seems to be a valid use case to add xfrm state without
> > Security Parameter Indexes (SPI) value associated:
> > ip xfrm state add src $src dst $dst proto $proto mode $mode sel src
> > $src dst $dst $algo
> > 
> > The bad thing is that it's currently impossible to get/delete the
> > state
> > without SPI: __xfrm_state_insert() obviously doesn't add hash for
> > zero
> > SPI in xfrm.state_byspi, and xfrm_user_state_lookup() will fail as
> > xfrm_state_lookup() does lookups by hash.
> > 
> > It also isn't possible to workaround from userspace as
> > xfrm_id_proto_match() will be always true for ah/esp/comp protos.
> > 
> > So, don't try looking up by hash if SPI == 0.
> > 
> > Cc: Steffen Klassert <steffen.klassert@secunet.com>
> > Cc: Herbert Xu <herbert@gondor.apana.org.au>
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Cc: netdev@vger.kernel.org
> > Signed-off-by: Dmitry Safonov <dima@arista.com>
> 
> A zero SPI is illegal for many IPsec protocols because that value
> is used for other purposes, e.g., IKE encapsulation.

But still it's possible to create ipsec with zero SPI.
And it seems not making sense to search for a state with SPI hash if
request has zero SPI.

-- 
            Dima

  reply	other threads:[~2018-05-02 12:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02  2:02 [PATCH] net/xfrm: Fix lookups for states with spi == 0 Dmitry Safonov
2018-05-02  9:11 ` Herbert Xu
2018-05-02 12:41   ` Dmitry Safonov [this message]
2018-05-03  5:40     ` Herbert Xu

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=1525264896.14025.23.camel@arista.com \
    --to=dima@arista.com \
    --cc=0x7f454c46@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --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