lkml.org 
[lkml]   [2018]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] net/xfrm: Fix lookups for states with spi == 0
    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.

    Cheers,
    --
    Email: Herbert Xu <herbert@gondor.apana.org.au>
    Home Page: http://gondor.apana.org.au/~herbert/
    PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

    \
     
     \ /
      Last update: 2018-05-02 11:12    [W:2.574 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site