All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: David George <David.George@sophos.com>
Cc: Sri Sakthi <srisakthi.s@gmail.com>,
	"steffen.klassert@secunet.com" <steffen.klassert@secunet.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Srisakthi Subramaniam <Srisakthi.Subramaniam@sophos.com>,
	Vimal Agrawal <Vimal.Agrawal@sophos.com>
Subject: [PATCH] xfrm: Allow transport-mode states with AF_UNSPEC selector
Date: Tue, 21 Feb 2023 13:54:00 +0800	[thread overview]
Message-ID: <Y/RceGnV2JLvRmXC@gondor.apana.org.au> (raw)
In-Reply-To: <Y/RDBnFoROo5+xcm@gondor.apana.org.au>

On Tue, Feb 21, 2023 at 12:05:26PM +0800, Herbert Xu wrote:
> 
> OK I wasn't aware of this.  This definitely looks buggy.  We need
> to fix this bogus check.

It looks like I actually added this bogus check :)

Does this patch work for you?

---8<---
xfrm state selectors are matched against the inner-most flow
which can be of any address family.  Therefore middle states
in nested configurations need to carry a wildcard selector in
order to work at all.

However, this is currently forbidden for transport-mode states.

Fix this by removing the unnecessary check.

Fixes: 13996378e658 ("[IPSEC]: Rename mode to outer_mode and add inner_mode")
Reported-by: David George <David.George@sophos.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 89c731f4f0c7..6f53841cd162 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -2815,11 +2815,6 @@ int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload,
 			goto error;
 		}
 
-		if (!(inner_mode->flags & XFRM_MODE_FLAG_TUNNEL)) {
-			NL_SET_ERR_MSG(extack, "Only tunnel modes can accommodate an AF_UNSPEC selector");
-			goto error;
-		}
-
 		x->inner_mode = *inner_mode;
 
 		if (x->props.family == AF_INET)
-- 
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

  reply	other threads:[~2023-02-21  5:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA+t5pP=6E4RvKiPdS4fm_Z2M2BLKPkd6jewtF0Y_Ci_w-oTb+w@mail.gmail.com>
2023-02-17  5:24 ` xfrm: Pass on correct AF value to xfrm_state_find Herbert Xu
     [not found]   ` <CA+t5pP=NRQUax5ogB32dZN74Mk2qq_ZY7OgNro8JmckVkQsQyw@mail.gmail.com>
2023-02-17  8:29     ` Herbert Xu
2023-02-20 11:28       ` David George
2023-02-21  4:05         ` Herbert Xu
2023-02-21  5:54           ` Herbert Xu [this message]
2023-02-27 11:15             ` [PATCH] xfrm: Allow transport-mode states with AF_UNSPEC selector 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=Y/RceGnV2JLvRmXC@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=David.George@sophos.com \
    --cc=Srisakthi.Subramaniam@sophos.com \
    --cc=Vimal.Agrawal@sophos.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=srisakthi.s@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.