All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Antony Antony <antony.antony@secunet.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	netdev@vger.kernel.org, devel@linux-ipsec.org
Subject: Re: [PATCH ipsec-next] xfrm: Add Direction to the SA in or out
Date: Mon, 4 Mar 2024 09:42:39 +0200	[thread overview]
Message-ID: <20240304074239.GB13620@unreal> (raw)
In-Reply-To: <d84a02e019ef188c4295089f6134af67ef7e7452.1709498351.git.antony.antony@secunet.com>

On Sun, Mar 03, 2024 at 10:08:41PM +0100, Antony Antony wrote:
> This patch introduces the 'dir' attribute, 'in' or 'out', to the
> xfrm_state, SA, enhancing usability by delineating the scope of values
> based on direction. An input SA will now exclusively encompass values
> pertinent to input, effectively segregating them from output-related
> values. This change aims to streamline the configuration process and
> improve the overall clarity of SA attributes.
> 
> Signed-off-by: Antony Antony <antony.antony@secunet.com>
> ---
>  include/net/xfrm.h        |  1 +
>  include/uapi/linux/xfrm.h |  8 ++++++++
>  net/xfrm/xfrm_compat.c    |  6 ++++--
>  net/xfrm/xfrm_device.c    |  5 +++++
>  net/xfrm/xfrm_state.c     |  1 +
>  net/xfrm/xfrm_user.c      | 43 +++++++++++++++++++++++++++++++++++----
>  6 files changed, 58 insertions(+), 6 deletions(-)

<...>

> +enum xfrm_sa_dir {
> +	XFRM_SA_DIR_UNSET = 0,
> +	XFRM_SA_DIR_IN	= 1,
> +	XFRM_SA_DIR_OUT	= 2,
> +	XFRM_SA_DIR_MAX = 3,
> +};

<...>

> +	if (attrs[XFRMA_SA_DIR]) {
> +		u8 sa_dir = nla_get_u8(attrs[XFRMA_SA_DIR]);
> +
> +		if (!sa_dir || sa_dir >= XFRM_SA_DIR_MAX)  {

Netlink approach is to rely on attrs[XFRMA_SA_DIR] as a marker for XFRM_SA_DIR_UNSET.
If attrs[XFRMA_SA_DIR] == NULL, then the direction is XFRM_SA_DIR_UNSET.
Also, why do you need XFRM_SA_DIR_MAX in UAPI?

Thanks

  parent reply	other threads:[~2024-03-04  7:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-03 21:08 [PATCH ipsec-next] xfrm: Add Direction to the SA in or out Antony Antony
2024-03-03 22:30 ` Eyal Birger
2024-03-06 18:38   ` [DKIM] Re: [devel-ipsec] " Antony Antony
2024-03-06 18:57     ` Eyal Birger
2024-03-10 20:05       ` Antony Antony
2024-03-04  7:42 ` Leon Romanovsky [this message]
2024-03-06 19:28   ` Antony Antony
2024-03-10 20:03 ` [PATCH ipsec-next v2] " Antony Antony
2024-03-11  7:25   ` Leon Romanovsky
2024-03-12 18:29     ` Antony Antony

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=20240304074239.GB13620@unreal \
    --to=leon@kernel.org \
    --cc=antony.antony@secunet.com \
    --cc=devel@linux-ipsec.org \
    --cc=herbert@gondor.apana.org.au \
    --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 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.