linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: yossefe@mellanox.com
To: "David S. Miller" <davem@davemloft.net>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: borisp@mellanox.com, kliteyn@mellanox.com, yossiku@mellanox.com,
	Yossef Efraim <yossefe@mellanox.com>
Subject: [PATCH net-next 2/3] xfrm: Fix xfrm_dev_state_add to fail for unsupported HW SA option
Date: Tue, 28 Nov 2017 11:49:29 +0200	[thread overview]
Message-ID: <1511862571-3494-2-git-send-email-yossefe@mellanox.com> (raw)
In-Reply-To: <1511862571-3494-1-git-send-email-yossefe@mellanox.com>

From: Yossef Efraim <yossefe@mellanox.com>

xfrm_dev_state_add function returns success for unsupported HW SA options.
Resulting the calling function to create SW SA without corrlating HW SA.
Desipte IPSec device offloading option was chosen.
These not supported HW SA options are hard coded within xfrm_dev_state_add
function.
SW backward compatibility will break if we add any of these option as old
HW will fail with new SW.

This patch changes the behaviour to return -EINVAL in case unsupported
option is chosen.
Notifying user application regarding failure and not breaking backward
compatibility for newly added HW SA options.

Signed-off-by: Yossef Efraim <yossefe@mellanox.com>
---
 net/xfrm/xfrm_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
index 30e5746..dc68d9c 100644
--- a/net/xfrm/xfrm_device.c
+++ b/net/xfrm/xfrm_device.c
@@ -67,7 +67,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
 
 	/* We don't yet support UDP encapsulation, TFC padding and ESN. */
 	if (x->encap || x->tfcpad || (x->props.flags & XFRM_STATE_ESN))
-		return 0;
+		return -EINVAL;
 
 	dev = dev_get_by_index(net, xuo->ifindex);
 	if (!dev) {
-- 
2.8.1

  reply	other threads:[~2017-11-28  9:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28  9:49 [PATCH net-next 1/3] xfrm: Fix xfrm_replay_overflow_offload_esn yossefe
2017-11-28  9:49 ` yossefe [this message]
2017-12-01  6:21   ` [PATCH net-next 2/3] xfrm: Fix xfrm_dev_state_add to fail for unsupported HW SA option Steffen Klassert
2017-11-28  9:49 ` [PATCH net-next 3/3] xfrm: Add ESN support for IPSec HW offload yossefe
2017-12-01  6:23   ` Steffen Klassert
2017-12-01 19:23     ` Shannon Nelson
2018-01-10 10:35     ` Yossef Efraim
2017-12-01 19:23   ` Shannon Nelson
2018-01-10 11:37     ` Yossef Efraim
2017-12-01  6:20 ` [PATCH net-next 1/3] xfrm: Fix xfrm_replay_overflow_offload_esn 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=1511862571-3494-2-git-send-email-yossefe@mellanox.com \
    --to=yossefe@mellanox.com \
    --cc=borisp@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kliteyn@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=yossiku@mellanox.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).